pub fn encode(data: &[u8], key: &[u8], timestamp: u32) -> Result<String, BrancaError> {
    // Use CSPRNG to generate a unique nonce.
    let n = Nonce::generate();

    encode_with_nonce(data, key, &n, timestamp)
}
/// 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.
///
/// `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 generated nonce is 24 bytes in length, otherwise it returns a `BrancaError::BadNonceLength` Result.
///
/// * This function panics if unable to securely generate random bytes.
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.

`timestamp` - The timestamp at which the token was created.



The key must be 32 bytes in length, otherwise it returns a `BrancaError::BadKeyLength` Result.

The generated nonce is 24 bytes in length, otherwise it returns a `BrancaError::BadNonceLength` Result.

This function panics if unable to securely generate random bytes.
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 . ` timestamp ` - The timestamp at which the token was created . The key must be 32 bytes in length otherwise it returns a ` BrancaError :: BadKeyLength ` Result . The generated nonce is 24 bytes in length otherwise it returns a ` BrancaError :: BadNonceLength ` Result . This function panics if unable to securely generate random bytes .
pub fn encode(data: &[u8], key: &[u8], timestamp: u32) -> Result<String, BrancaError> {
    // Use CSPRNG to generate a unique nonce.
    let n = Nonce::generate();
    encode_with_nonce(data, key, &n, timestamp)
}
pub fn encode ( data : & [ u8 ] , key : & [ u8 ] , timestamp : u32 ) -> Result < String , BrancaError > { // Use CSPRNG to generate a unique nonce. let n = Nonce :: generate ( ) ; encode_with_nonce ( data , key , & n , timestamp ) }
Encodes the message and returns a Branca Token as a String.
Encodes the message and returns a Branca Token as a String .
data
&[u8]
key
&[u8]
timestamp
u32