toJson method
Converts this instance to a JSON map.
Output follows the standard WebAuthn format with nested 'response' object.
Implementation
Map<String, dynamic> toJson() {
final response = <String, dynamic>{
'clientDataJSON': clientDataJSON,
'authenticatorData': authenticatorData,
'signature': signature,
};
// Only include userHandle if it's not empty
if (userHandle.isNotEmpty) {
response['userHandle'] = userHandle;
}
return {
'id': id,
'rawId': rawId,
'type': 'public-key',
'response': response,
'clientExtensionResults': <String, dynamic>{},
};
}