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
Static
blindUsed by the signer to create a blind MAC
The blind sig request sent by user.
The messages known to the signer
Static
encodeStatic
encodeStatic
encodeStatic
fromStatic
fromStatic
fromGenerate a blind MAC from request
Static
generateGenerates a blind MAC over the commitment of unrevealed messages and revealed messages
Commitment over unrevealed messages sent by the requester of the blind MAC. Its assumed that the signers has verified the knowledge of committed messages
Static
generateGenerate a request for a blind MAC
messages the requester wants to hide from the signer. The key of the map is the index of the message as per the params.
Optional
blinding: Uint8ArrayIf not provided, a random blinding is generated
Optional
revealedMessages: Map<number, Uint8Array>Any messages that the requester wishes to inform the signer about. This is for informational purpose only and has no cryptographic use.
Static
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
A class extending
BytearrayWrapper
containing instruments for dealing with message encoding/decoding.