Static
Readonly
maxThe field element size is 32 bytes so the maximum byte size of encoded message must be 32.
Static
Readonly
textStatic
Readonly
textReturn the wrapped bytearray
Return the hex representation of the wrapped bytearray
Return the length of the wrapped bytearray
Verify the MAC
Ordered list of messages. Order and contents should be kept same for both signer and verifier
If true, the messages are encoded as field elements otherwise they are assumed to be already encoded.
Verifies the MAC on the given messages. Takes the messages as a JS object, flattens it, encodes the values similar to signing and then verifies the MAC.
Static
encodeStatic
encodeStatic
encodeStatic
fromStatic
fromStatic
generateSigner creates a new MAC
Ordered list of messages. Order and contents should be kept same for both signer and verifier
If true, the messages are encoded as field elements otherwise they are assumed to be already encoded.
Static
getStatic
reversibleDecode the given representation. This should only be used when the encoding was done
using this.reversibleEncodeStringMessageForSigning
. Also, this function trims any characters from the first
occurrence of a null characters (UTF-16 code unit 0) so if the encoded (using this.reversibleEncodeStringMessageForSigning
)
string also had a null then the decoded string will be different from it.
whether to decompress the bytes before converting to a string
Static
reversibleEncode the given string to bytes and create a field element by considering the bytes in little-endian format. Use this way of encoding only if the input string's UTF-8 representation is <= 32 bytes else this will throw an error. Also adds trailing 0s to the bytes to make the size 32 bytes so use this function carefully. The only place this is currently useful is verifiable encryption as in some cases the prover might not be willing/available at the time of decryption and thus the decryptor must be able to decrypt it independently. This is different from selective disclosure where the verifier can check that the revealed message is same as the encoded one before even verifying the proof.
utf-8 string of at most 32 bytes
whether to compress the text before encoding to bytes. Compression might not always help as things like public keys, DIDs, UUIDs, etc. are designed to be random and thus won't be compressed
Static
sign
Proof of knowledge of BBDT16 MAC protocol