Skip to main content

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

Reusable request options

  • type - ​​_Must provide_ string. Type: ui-receive_pin or ui-receive_passphrase
  • payload - ​​_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_value should be the value after blind keyboard mapping.
  • If you want the PIN to stay on the device, set payload to @@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 value and set passphraseOnDevice to true.
  • If you enter in the software interface, please decide whether to use save to cache the current session based on the product design.