JoseObject.fromJson constructor

JoseObject.fromJson(
  1. Map<String, dynamic> json
)

Constructs a JsonWebSignature or JsonWebEncryption from its json representation.

Implementation

factory JoseObject.fromJson(Map<String, dynamic> json) {
  if (json.containsKey('payload')) return JsonWebSignature.fromJson(json);
  if (json.containsKey('ciphertext')) return JsonWebEncryption.fromJson(json);
  throw ArgumentError.value(
      json, 'json', 'Not a valid `JsonWebSignature` or `JsonWebEncryption`');
}