extendCredentials static method

void extendCredentials(
  1. List<String> credentialHandles,
  2. dynamic exportCallback(
    1. Map<String, String?>
    )
)

Extend a list of credentials from one device to another.

The user must be in an authenticated state to extend any credentials. During this flow the user is prompted for a biometric challenge. If biometrics are not set, it falls back to PIN.

After the challenge is completed, a rendezvous token is provided with 90 seconds time-to-live, after which a new token is generated.

NOTE: to cancel the credentials flow, cancelExtendCredentials must be invoked.

credentialHandles is the list of credential handles to extend. exportCallback is a callback that receives status updates during the execution of the flow. Its argument is a map with the following contents:

  • "status": one of constant values in the ExtendCredentialsStatus class.
  • "token": only present if status is "update". Contains the new rendezvous token value.
  • "errorMessage": only present if status is "error". Contains the error message.

Implementation

static void extendCredentials(List<String> credentialHandles, Function(Map<String, String?>) exportCallback) {
  _exportCallback = exportCallback;

  _exportSubscription = _eventChannel.receiveBroadcastStream(credentialHandles).listen((event) {
    if (_exportCallback != null) {
      _exportCallback!(event.cast<String, String?>());
    }
  });
}