TrustBundle.fromJson constructor
TrustBundle.fromJson(
- Map value
Implementation
factory TrustBundle.fromJson(Map value) {
if (value['kind'] != 'zuke.ed25519-trust') {
throw const FormatException(
'Invalid Ed25519 trust bundle format; regenerate it for the current Zuke release',
);
}
final keys = (value['keys'] as List? ?? const [])
.whereType<Map>()
.map(TrustKey.fromJson)
.toList();
final identities = <String>{};
for (final key in keys) {
if (!identities.add('${key.signerId}|${key.keyId}')) {
throw const FormatException('Duplicate trust key identity');
}
}
return TrustBundle(keys);
}