Expand description
Message-level cryptography for the Zoe protocol
This module provides cryptographic primitives for message encryption, key derivation, and mnemonic-based key management used in the Zoe messaging protocol.
§Key Features
- ChaCha20-Poly1305 encryption for message content
- BIP39 mnemonic phrase support for key derivation
- Ed25519 and ML-DSA key generation from mnemonics
- Self-encryption and ephemeral ECDH patterns
- Argon2 key derivation with configurable parameters
Structs§
- Argon2
Params - ChaCha20
Poly1305 Content - Minimal encrypted content for wire protocol messages Optimized for space - no key_id since it’s determined by channel context
- Ed25519
Self Encrypted Content - Ed25519-derived ChaCha20-Poly1305 encrypted content Simple self-encryption using only the sender’s ed25519 keypair derived from mnemonic Only the sender can decrypt this content (encrypt-to-self pattern) Public key is available from message sender field - no need to duplicate
- Encryption
Key - ChaCha20-Poly1305 encryption key
- Ephemeral
Ecdh Content - Ephemeral ECDH ChaCha20-Poly1305 encrypted content Simple public key encryption using ephemeral X25519 keys Anyone can encrypt for the recipient using only their public key
- KeyDerivation
Info - Information about how a key was derived
- MlDsa
Self Encrypted Content - ML-DSA-derived ChaCha20-Poly1305 encrypted content Simple self-encryption using only the sender’s ML-DSA keypair derived from mnemonic Only the sender can decrypt this content (encrypt-to-self pattern) Public key is available from message sender field - no need to duplicate
- Mnemonic
Phrase - Mnemonic phrase for key derivation
Enums§
- Crypto
Error - KeyDerivation
Method - Key derivation methods supported by the system
- Pqxdh
Encrypted Content - PQXDH encrypted content for asynchronous secure communication
Functions§
- ed25519_
to_ x25519_ private - Convert Ed25519 private key to X25519 private key Both curves use the same underlying Curve25519
- ed25519_
to_ x25519_ public - Convert Ed25519 public key to X25519 public key Derives X25519 public key from the corresponding Ed25519 private key Note: This is a simplified approach that requires the private key
- ed25519_
to_ x25519_ public_ from_ verifying_ key - Convert Ed25519 public key (VerifyingKey) to X25519 public key Uses curve25519-dalek’s Edwards to Montgomery conversion to match the same conversion that happens in the private key derivation path
- generate_
ed25519_ from_ mnemonic - Generate an ed25519 signing key from a mnemonic phrase
- generate_
ml_ dsa_ from_ mnemonic - Generate an ML-DSA signing key from a mnemonic phrase
- recover_
ed25519_ from_ mnemonic - Recover an ed25519 signing key from a mnemonic phrase (deterministic)
- recover_
ml_ dsa_ from_ mnemonic - Recover an ML-DSA signing key from a mnemonic phrase (deterministic)