toJson method

Map<String, dynamic> toJson()

Converts this instance to a JSON map.

Implementation

Map<String, dynamic> toJson() {
  final response = <String, dynamic>{
    'clientDataJSON': clientDataJSON,
    'attestationObject': attestationObject,
  };

  // Only include non-null transports
  final nonNullTransports = transports.whereType<String>().toList();
  if (nonNullTransports.isNotEmpty) {
    response['transports'] = nonNullTransports;
  }

  return {
    'id': id,
    'rawId': rawId,
    'type': 'public-key',
    'response': response,
    'clientExtensionResults': <String, dynamic>{},
  };
}