clientDataHash method

  1. @override
Uint8List clientDataHash(
  1. PassKeysOptions options,
  2. {String? challenge}
)
override

Creates a client data hash for PassKeys authentication.

  • options: The PassKeysOptions for the client data hash.
  • challenge: A random challenge for the client data hash.

Returns a Uint8List representing the client data hash.

Implementation

@override
Uint8List clientDataHash(PassKeysOptions options, {String? challenge}) {
  options.challenge = challenge ?? _randomChallenge(options);
  final clientDataJson = jsonEncode({
    "type": options.type,
    "challenge": options.challenge,
    "origin": options.origin,
    "crossOrigin": options.crossOrigin
  });
  return Uint8List.fromList(utf8.encode(clientDataJson));
}