Expand description
Encodes the message and returns a Branca Token as a String.
The contents of the message can be of any arbitrary sequence of bytes, ie. text, JSON, Protobuf, JWT or a MessagePack, etc.
data
- The data to be encoded as a Branca token.
key
- The key to use for encryption.
nonce
- The nonce to be used for encryption.
timestamp
- The timestamp at which the token was created.
Note:
-
The key must be 32 bytes in length, otherwise it returns a
BrancaError::BadKeyLength
Result. -
The nonce must be 24 bytes in length, otherwise it returns a
BrancaError::BadNonceLength
Result.