Expand description
Decodes a Branca token and returns the plaintext as a String.
data
- The input which is to be decrypted with the user-supplied key.
key
- The user-supplied key to use for decryption.
ttl
- The time-to-live upon creation of the token with its timestamp in milliseconds (m/s).
If the supplied ttl is set to 0, then the expiration check is omitted. It is recommended to set this if you want to check the timestamp of an incoming token generated by the client.
Note:
-
The key must be 32 bytes in length, otherwise it returns a
BrancaError::BadKeyLength
Result. -
If the decryption fails, it returns a
BrancaError::DecryptFailed
Result. -
If the TTL is non-zero and the timestamp of the token is in the past. It is considered to be expired; returning a
BrancaError::ExpiredToken
Result. -
If the input is not in Base62 format, it returns a
BrancaError::InvalidBase62Token
Result.