def parse_decoded
qasim-bend-kit@0.1.0.2 · libs/AES256GCM.bend:512
import qasim-bend-kit@0.1.0.2/libs/AES256GCM.bend as AES256GCM
import Base
512def parse_decoded(+nonce_bytes: List<&2, U32>, +tag_bytes: List<&2, U32>, +ciphertext: List<&2, U32>,
513 nonce_size: Maybe<&0, {List.length(&2, U32, nonce_bytes) == 12n : Nat}>,
514 tag_size: Maybe<&0, {List.length(&2, U32, tag_bytes) == 16n : Nat}>,
515 nonce_valid: Maybe<&0, {bytes_valid(nonce_bytes) == True{} : Bool}>,
516 tag_valid: Maybe<&0, {bytes_valid(tag_bytes) == True{} : Bool}>,
517 ciphertext_valid: Maybe<&0, {bytes_valid(ciphertext) == True{} : Bool}>) -> Result<&2, &2, Error, Envelope>:
518 match nonce_size tag_size nonce_valid tag_valid ciphertext_valid:
519 case Some{ns} Some{ts} Some{nv} Some{tv} Some{cv}:
520 Done{Envelope{Nonce{nonce_bytes, ns, nv}, ciphertext, Tag{tag_bytes, ts, tv}, cv}}
521 case _ _ _ _ _: Fail{InvalidEnvelope{}}