xref: /aosp_15_r20/hardware/interfaces/confirmationui/1.0/IConfirmationResultCallback.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2017 The Android Open Source Project
3*4d7e907cSAndroid Build Coastguard Worker *
4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*4d7e907cSAndroid Build Coastguard Worker *
8*4d7e907cSAndroid Build Coastguard Worker *      http://www.apache.org/licenses/LICENSE-2.0
9*4d7e907cSAndroid Build Coastguard Worker *
10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License.
15*4d7e907cSAndroid Build Coastguard Worker */
16*4d7e907cSAndroid Build Coastguard Worker
17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected];
18*4d7e907cSAndroid Build Coastguard Worker
19*4d7e907cSAndroid Build Coastguard Worker/**
20*4d7e907cSAndroid Build Coastguard Worker * Callback interface passed to IConfirmationUI::promptUserConfirmation().
21*4d7e907cSAndroid Build Coastguard Worker * Informs the caller about the result of the prompt operation.
22*4d7e907cSAndroid Build Coastguard Worker */
23*4d7e907cSAndroid Build Coastguard Workerinterface IConfirmationResultCallback {
24*4d7e907cSAndroid Build Coastguard Worker    /**
25*4d7e907cSAndroid Build Coastguard Worker     * This callback is called by the confirmation provider when it stops prompting the user.
26*4d7e907cSAndroid Build Coastguard Worker     * Iff the user has confirmed the prompted text, error is ErrorCode::OK and the
27*4d7e907cSAndroid Build Coastguard Worker     * parameters formattedMessage and confirmationToken hold the values needed to request
28*4d7e907cSAndroid Build Coastguard Worker     * a signature from keymaster.
29*4d7e907cSAndroid Build Coastguard Worker     * In all other cases formattedMessage and confirmationToken must be of length 0.
30*4d7e907cSAndroid Build Coastguard Worker     *
31*4d7e907cSAndroid Build Coastguard Worker     * @param error - OK: IFF the user has confirmed the prompt.
32*4d7e907cSAndroid Build Coastguard Worker     *              - Canceled: If the user has pressed the cancel button.
33*4d7e907cSAndroid Build Coastguard Worker     *              - Aborted: If IConfirmationUI::abort() was called.
34*4d7e907cSAndroid Build Coastguard Worker     *              - SystemError: If an unexpected System error occurred that prevented the TUI
35*4d7e907cSAndroid Build Coastguard Worker     *                             from being shut down gracefully.
36*4d7e907cSAndroid Build Coastguard Worker     * @param formattedMessage holds the prompt text and extra data.
37*4d7e907cSAndroid Build Coastguard Worker     *                         The message is CBOR (RFC 7049) encoded and has the following format:
38*4d7e907cSAndroid Build Coastguard Worker     *                         CBOR_MAP{ "prompt", <promptText>, "extra", <extraData> }
39*4d7e907cSAndroid Build Coastguard Worker     *                         The message is a CBOR encoded map (type 5) with the keys
40*4d7e907cSAndroid Build Coastguard Worker     *                         "prompt" and "extra". The keys are encoded as CBOR text string
41*4d7e907cSAndroid Build Coastguard Worker     *                         (type 3). The value <promptText> is encoded as CBOR text string
42*4d7e907cSAndroid Build Coastguard Worker     *                         (type 3), and the value <extraData> is encoded as CBOR byte string
43*4d7e907cSAndroid Build Coastguard Worker     *                         (type 2). The map must have exactly one key value pair for each of
44*4d7e907cSAndroid Build Coastguard Worker     *                         the keys "prompt" and "extra". Other keys are not allowed.
45*4d7e907cSAndroid Build Coastguard Worker     *                         The value of "prompt" is given by the proptText argument to
46*4d7e907cSAndroid Build Coastguard Worker     *                         IConfirmationUI::promptUserConfirmation and must not be modified
47*4d7e907cSAndroid Build Coastguard Worker     *                         by the implementation.
48*4d7e907cSAndroid Build Coastguard Worker     *                         The value of "extra" is given by the extraData argument to
49*4d7e907cSAndroid Build Coastguard Worker     *                         IConfirmationUI::promptUserConfirmation and must not be modified
50*4d7e907cSAndroid Build Coastguard Worker     *                         or interpreted by the implementation.
51*4d7e907cSAndroid Build Coastguard Worker     *
52*4d7e907cSAndroid Build Coastguard Worker     * @param confirmationToken a 32-byte HMAC-SHA256 value, computed over
53*4d7e907cSAndroid Build Coastguard Worker     *                          "confirmation token" || <formattedMessage>
54*4d7e907cSAndroid Build Coastguard Worker     *                          i.e. the literal UTF-8 encoded string "confirmation token", without
55*4d7e907cSAndroid Build Coastguard Worker     *                          the "", concatenated with the formatted message as returned in the
56*4d7e907cSAndroid Build Coastguard Worker     *                          formattedMessage argument. The HMAC is keyed with a 256-bit secret
57*4d7e907cSAndroid Build Coastguard Worker     *                          which is shared with Keymaster. In test mode the test key MUST be
58*4d7e907cSAndroid Build Coastguard Worker     *                          used (see types.hal TestModeCommands and TestKeyBits).
59*4d7e907cSAndroid Build Coastguard Worker     */
60*4d7e907cSAndroid Build Coastguard Worker    result(ResponseCode error, vec<uint8_t> formattedMessage, vec<uint8_t> confirmationToken);
61*4d7e907cSAndroid Build Coastguard Worker};
62