enableBiometric method

Future<void> enableBiometric({
  1. required BiometricOptionsIOS ios,
  2. required BiometricOptionsAndroid android,
})

Implementation

Future<void> enableBiometric({
  required BiometricOptionsIOS ios,
  required BiometricOptionsAndroid android,
}) async {
  final kid = await native.generateUUID();
  final deviceInfo = await native.getDeviceInfo();
  final challengeResponse =
      await _apiClient.getChallenge("biometric_request");
  final now = DateTime.now().toUtc().millisecondsSinceEpoch / 1000;
  final payload = {
    "iat": now,
    "exp": now + 300,
    "challenge": challengeResponse.token,
    "action": "setup",
    "device_info": deviceInfo,
  };
  final jwt = await native.createBiometricPrivateKey(
    kid: kid,
    payload: payload,
    ios: ios,
    android: android,
  );
  await _apiClient.sendSetupBiometricRequest(BiometricRequest(
    clientID: clientID,
    jwt: jwt,
  ));
  await _storage.setBiometricKeyID(name, kid);
}