Respond to UI events
uiResponse is used to return user input or selection collected on the application side to the SDK. It is usually used in conjunction with UI_EVENT. For instance, when the device asks for a PIN, a Passphrase, or a confirmation, the application displays the UI and then uses uiResponse to return the result.
Common response types currently include PIN and Passphrase. The more timely the response, the less likely the hardware request process will be stuck in the waiting state.
const responseResult = await ukeySdk.uiResponse(response);
Fields
type- _Must provide_string. Type:ui-receive_pinorui-receive_passphrasepayload- _Must provide_object. Content
Send PIN Back
ukeySdk.uiResponse({
type: UI_RESPONSE.RECEIVE_PIN,
payload: ${pin_value},
});
- When entering the PIN on the software side,
pin_valueshould be the value after blind keyboard mapping. - If you want the PIN to stay on the device, set
payloadto@@UKEY_INPUT_PIN_IN_DEVICE.
Send Passphrase Back
ukeySdk.uiResponse({
type: UI_RESPONSE.RECEIVE_PASSPHRASE,
payload: {
value: ${passphrase_value},
passphraseOnDevice: false,
save: false,
},
});
- If you want Passphrase to be completed on the device, clear
valueand setpassphraseOnDevicetotrue. - If you enter in the software interface, please decide whether to use
saveto cache the current session based on the product design.