secret_box library

Encrypt messages with a secret key. Maps libsodium's crypto_secret_box_* api.

Properties

keyBytes int
Required length of key
final
macBytes int
final
nonceBytes int
Required length of nonce
final

Functions

easy(Uint8List message, Uint8List nonce, Uint8List key) Uint8List
Encrypts message with key. key must be keyBytes long. nonce must a unique value and must be nonceBytes long. Throws EncryptionError when encryption fails.
keyGen() UnmodifiableUint8ListView
Generates a key for a secret box.
openEasy(Uint8List ciphertext, Uint8List nonce, Uint8List key) Uint8List
Opens a message encrypted with easy. Throws DecryptionError when decryption fails.

Exceptions / Errors

DecryptionError
EncryptionError