def aes_encode_fields_split
qasim-bend-kit@0.1.0.2 · proof/AES_EnvelopeProof.bend:512
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
512def aes_encode_fields_split(+envelope: AES.Envelope) ->
513 {String.split(AES.encode_impl(envelope), Chr{46}) ==
514 ["v1", AES.hex_bytes(AES.fixed_bytes(12n,
515 AES.nonce_bytes(AES.envelope_nonce(envelope)))),
516 AES.hex_bytes(AES.fixed_bytes(16n,
517 AES.tag_bytes(AES.envelope_tag(envelope)))),
518 AES.hex_bytes(AES.ciphertext(envelope))] : List<&2, String>}:
519 match envelope:
520 case AES.Envelope{nonce, ciphertext, tag, valid}:
521 match nonce:
522 case AES.Nonce{nonce_bytes, size, valid}:
523 aes_split_v1_hex_fields(
524 AES.fixed_bytes(12n, nonce_bytes),
525 AES.fixed_bytes(16n, AES.tag_bytes(tag)), ciphertext)