JsonWebSignature.fromJson constructor
Constructs a JsonWebSignature from its flattened or general JSON representation
Implementation
factory JsonWebSignature.fromJson(Map<String, dynamic> json) {
Iterable<_JwsRecipient> signatures;
final rawSignatures = json['signatures'] as List<dynamic>?;
if (rawSignatures != null) {
signatures = rawSignatures
.whereType<Map<String, dynamic>>()
.map((v) => _JwsRecipient.fromJson(v));
} else {
signatures = [_JwsRecipient.fromJson(json)];
}
return JsonWebSignature._(
decodeBase64EncodedBytes(json['payload']),
List.unmodifiable(signatures),
);
}