AESEnvelopeProof.aes_parse_decoded_hex_map: def of qasim-bend-kit@0.1.0.2 Import: import qasim-bend-kit@0.1.0.2/proof/AES_EnvelopeProof.bend as AESEnvelopeProof Lines 904-974 of qasim-bend-kit@0.1.0.2/proof/AES_EnvelopeProof.bend: https://jend.leeeet.dev/read.txt?path=qasim-bend-kit@0.1.0.2/proof/AES_EnvelopeProof.bend&start_line=904&end_line=974 import Base import qasim-bend-kit@0.1.0.2/libs/AES256GCM.bend as AES def aes_parse_decoded_hex_map(+nonce: List<&2, U32>, +tag: List<&2, U32>, +ciphertext: List<&2, U32>, nonce_size: {List.length(&2, U32, nonce) == 12n : Nat}, tag_size: {List.length(&2, U32, tag) == 16n : Nat}) -> {Result.map(&2, &2, AES.Error, AES.Envelope, String, AES.encode, AES.parse_decoded_hex(AES.decode_hex(AES.hex_bytes(nonce)), AES.decode_hex(AES.hex_bytes(tag)), AES.decode_hex(AES.hex_bytes(ciphertext)))) == Done{"v1." ++ AES.hex_bytes(nonce) ++ "." ++ AES.hex_bytes(tag) ++ "." ++ AES.hex_bytes(ciphertext)} : Result<&2, &2, AES.Error, String>}: +n = aes_hex_mask_bytes(nonce) +t = aes_hex_mask_bytes(tag) +c = aes_hex_mask_bytes(ciphertext) nonce_step = Equal.cong(Maybe<&2, List<&2, U32>>, Result<&2, &2, AES.Error, String>, value => Result.map(&2, &2, AES.Error, AES.Envelope, String, AES.encode, AES.parse_decoded_hex(value, AES.decode_hex(AES.hex_bytes(tag)), AES.decode_hex(AES.hex_bytes(ciphertext)))), AES.decode_hex(AES.hex_bytes(nonce)), Some{n}, aes_decode_hex_bytes(nonce)) tag_step = Equal.cong(Maybe<&2, List<&2, U32>>, Result<&2, &2, AES.Error, String>, value => Result.map(&2, &2, AES.Error, AES.Envelope, String, AES.encode, AES.parse_decoded_hex(Some{n}, value, AES.decode_hex(AES.hex_bytes(ciphertext)))), AES.decode_hex(AES.hex_bytes(tag)), Some{t}, aes_decode_hex_bytes(tag)) cipher_step = Equal.cong(Maybe<&2, List<&2, U32>>, Result<&2, &2, AES.Error, String>, value => Result.map(&2, &2, AES.Error, AES.Envelope, String, AES.encode, AES.parse_decoded_hex(Some{n}, Some{t}, value)), AES.decode_hex(AES.hex_bytes(ciphertext)), Some{c}, aes_decode_hex_bytes(ciphertext)) first_two = Equal.trans(Result<&2, &2, AES.Error, String>, Result.map(&2, &2, AES.Error, AES.Envelope, String, AES.encode, AES.parse_decoded_hex(AES.decode_hex(AES.hex_bytes(nonce)), AES.decode_hex(AES.hex_bytes(tag)), AES.decode_hex(AES.hex_bytes(ciphertext)))), Result.map(&2, &2, AES.Error, AES.Envelope, String, AES.encode, AES.parse_decoded_hex(Some{n}, AES.decode_hex(AES.hex_bytes(tag)), AES.decode_hex(AES.hex_bytes(ciphertext)))), Result.map(&2, &2, AES.Error, AES.Envelope, String, AES.encode, AES.parse_decoded_hex(Some{n}, Some{t}, AES.decode_hex(AES.hex_bytes(ciphertext)))), nonce_step, tag_step) all_three = Equal.trans(Result<&2, &2, AES.Error, String>, Result.map(&2, &2, AES.Error, AES.Envelope, String, AES.encode, AES.parse_decoded_hex(AES.decode_hex(AES.hex_bytes(nonce)), AES.decode_hex(AES.hex_bytes(tag)), AES.decode_hex(AES.hex_bytes(ciphertext)))), Result.map(&2, &2, AES.Error, AES.Envelope, String, AES.encode, AES.parse_decoded_hex(Some{n}, Some{t}, AES.decode_hex(AES.hex_bytes(ciphertext)))), Result.map(&2, &2, AES.Error, AES.Envelope, String, AES.encode, AES.parse_decoded_hex(Some{n}, Some{t}, Some{c})), first_two, cipher_step) Equal.trans(Result<&2, &2, AES.Error, String>, Result.map(&2, &2, AES.Error, AES.Envelope, String, AES.encode, AES.parse_decoded_hex(AES.decode_hex(AES.hex_bytes(nonce)), AES.decode_hex(AES.hex_bytes(tag)), AES.decode_hex(AES.hex_bytes(ciphertext)))), Result.map(&2, &2, AES.Error, AES.Envelope, String, AES.encode, AES.parse_decoded_hex(Some{n}, Some{t}, Some{c})), Done{"v1." ++ AES.hex_bytes(nonce) ++ "." ++ AES.hex_bytes(tag) ++ "." ++ AES.hex_bytes(ciphertext)}, all_three, aes_parse_decoded_checked_map(nonce, tag, ciphertext, nonce_size, tag_size)) Uses (20): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.cong https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.trans https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.length https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result.map https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.append https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/AES256GCM.bend&name=Envelope https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/AES256GCM.bend&name=Error https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/AES256GCM.bend&name=decode_hex https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/AES256GCM.bend&name=encode https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/AES256GCM.bend&name=hex_bytes https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/AES256GCM.bend&name=parse_decoded_hex https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/proof/AES_EnvelopeProof.bend&name=aes_decode_hex_bytes https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/proof/AES_EnvelopeProof.bend&name=aes_hex_mask_bytes https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/proof/AES_EnvelopeProof.bend&name=aes_parse_decoded_checked_map