def aes_parse_fields_encoded_map
qasim-bend-kit@0.1.0.2 · proof/AES_EnvelopeProof.bend:1009
import qasim-bend-kit@0.1.0.2/proof/AES_EnvelopeProof.bend as AESEnvelopeProof
import Base
import qasim-bend-kit@0.1.0.2/libs/AES256GCM.bend as AES
1009def aes_parse_fields_encoded_map(+envelope: AES.Envelope) ->
1010 {Result.map(&2, &2, AES.Error, AES.Envelope, String, AES.encode,
1011 AES.parse_fields(String.split(AES.encode(envelope), Chr{46}))) ==
1012 Done{AES.encode(envelope)} :
1013 Result<&2, &2, AES.Error, String>}:
1014 fields: List<&2, String> = "v1" <>
1015 AES.hex_bytes(AES.fixed_bytes(12n,
1016 AES.nonce_bytes(AES.envelope_nonce(envelope)))) <>
1017 AES.hex_bytes(AES.fixed_bytes(16n,
1018 AES.tag_bytes(AES.envelope_tag(envelope)))) <>
1019 AES.hex_bytes(AES.ciphertext(envelope)) <> Nil{}
1020 Equal.trans(Result<&2, &2, AES.Error, String>,
1021 Result.map(&2, &2, AES.Error, AES.Envelope, String, AES.encode,
1022 AES.parse_fields(String.split(AES.encode(envelope), Chr{46}))),
1023 Result.map(&2, &2, AES.Error, AES.Envelope, String, AES.encode,
1024 AES.parse_fields(fields)),
1025 Done{AES.encode(envelope)},
1026 Equal.cong(List<&2, String>,
1027 Result<&2, &2, AES.Error, String>,
1028 parts => Result.map(&2, &2, AES.Error, AES.Envelope,
1029 String, AES.encode, AES.parse_fields(parts)),
1030 String.split(AES.encode(envelope), Chr{46}), fields,
1031 aes_encode_fields_split(envelope)),
1032 aes_parse_encoder_fields_map(envelope))