libsodium-compatible sealed boxes

Sealed boxes are designed to anonymously send messages to a recipient given their public key. Only the recipient can decrypt these messages, using their private key. While the recipient can verify the integrity of the message, it cannot verify the identity of the sender.

A message is encrypted using an ephemeral key pair, whose secret part is destroyed right after the encryption process.

Types

Functions

fn open(m: []u8, c: []const u8, keypair: KeyPair) IdentityElementError || WeakPublicKeyError || AuthenticationError!void

Decrypt a message using a key pair. m must be exactly seal_length bytes sma…

Decrypt a message using a key pair. m must be exactly seal_length bytes smaller than c, as c also includes metadata.

fn seal(c: []u8, m: []const u8, public_key: [public_length]u8) WeakPublicKeyError || IdentityElementError!void

Encrypt a message m for a recipient whose public key is public_key. c mus…

Encrypt a message m for a recipient whose public key is public_key. c must be seal_length bytes larger than m, so that the required metadata can be added.

Values

public_length
comptime_int
seal_length
type
secret_length
comptime_int
seed_length
comptime_int