JsonWebEncryption.fromJson constructor

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

Constructs a JsonWebEncryption from its flattened or general JSON representation

Implementation

JsonWebEncryption.fromJson(Map<String, dynamic> json)
    : this._(
        decodeBase64EncodedBytes(json['ciphertext']),
        List.unmodifiable(json.containsKey('recipients')
            ? (json['recipients'] as List).map((v) => _JweRecipient._(
                header: JsonObject.from(v['header']),
                encryptedKey: decodeBase64EncodedBytes(v['encrypted_key'])))
            : [
                _JweRecipient._(
                    header: JsonObject.from(json['header']),
                    encryptedKey:
                        decodeBase64EncodedBytes(json['encrypted_key']))
              ]),
        protectedHeader: JsonObject.decode(json['protected']),
        unprotectedHeader: json['unprotected'] == null
            ? null
            : JsonObject.from(json['unprotected']),
        initializationVector: decodeBase64EncodedBytes(json['iv']),
        additionalAuthenticatedData: json['aad'] == null
            ? null
            : decodeBase64EncodedBytes(json['aad']),
        authenticationTag: decodeBase64EncodedBytes(json['tag']),
      );