openagent-crypto-wasm · aead
Declared module signatures, types, configuration, and source documentation.
Source: openagent-sdk/crates/openagent-crypto-wasm/src/aead.rs. SHA-256: b05c0a00dca8d771fd7d2443a5bd1f00e5d223dc3acfda28d9a8bf5a626d674c.
This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.
aead::AES256GCM_KEY_LEN
Length of an AES-256-GCM key in bytes.
pub const AES256GCM_KEY_LEN: usize;Source line: 22.
aead::AES256GCM_NONCE_LEN
Length of an AES-256-GCM nonce in bytes (96 bits, recommended).
pub const AES256GCM_NONCE_LEN: usize;Source line: 24.
aead::XCHACHA20POLY1305_KEY_LEN
Length of an XChaCha20-Poly1305 key in bytes.
pub const XCHACHA20POLY1305_KEY_LEN: usize;Source line: 27.
aead::XCHACHA20POLY1305_NONCE_LEN
Length of an XChaCha20-Poly1305 nonce in bytes (192 bits, extended).
pub const XCHACHA20POLY1305_NONCE_LEN: usize;Source line: 29.
aead::aes256gcm_encrypt
Encrypts plaintext with AES-256-GCM.
Returns ciphertext || tag (16-byte tag appended).
Errors
- [
CryptoError::InvalidLength] ifkeyornoncehas the wrong length. - [
CryptoError::AeadFailed] if the underlying cipher rejects the input.
pub fn aes256gcm_encrypt(
key: &[u8],
nonce: &[u8],
plaintext: &[u8],
aad: &[u8],
) -> Result<Vec<u8>, CryptoError>;Source line: 39.
aead::aes256gcm_decrypt
Decrypts ciphertext with AES-256-GCM, verifying the tag.
ciphertext must be actual_ciphertext || tag. Returns the plaintext on
successful tag verification.
Errors
- [
CryptoError::InvalidLength] ifkeyornoncehas the wrong length. - [
CryptoError::AeadFailed] (operation ="decrypt") on tag failure.
pub fn aes256gcm_decrypt(
key: &[u8],
nonce: &[u8],
ciphertext: &[u8],
aad: &[u8],
) -> Result<Vec<u8>, CryptoError>;Source line: 89.
aead::xchacha20poly1305_encrypt
Encrypts plaintext with XChaCha20-Poly1305 (extended-nonce variant).
Returns ciphertext || tag (16-byte tag appended).
Errors
- [
CryptoError::InvalidLength] ifkeyornoncehas the wrong length. - [
CryptoError::AeadFailed] if the cipher rejects the input.
pub fn xchacha20poly1305_encrypt(
key: &[u8],
nonce: &[u8],
plaintext: &[u8],
aad: &[u8],
) -> Result<Vec<u8>, CryptoError>;Source line: 138.
aead::xchacha20poly1305_decrypt
Decrypts ciphertext with XChaCha20-Poly1305, verifying the tag.
Errors
- [
CryptoError::InvalidLength] ifkeyornoncehas the wrong length. - [
CryptoError::AeadFailed] (operation ="decrypt") on tag failure.
pub fn xchacha20poly1305_decrypt(
key: &[u8],
nonce: &[u8],
ciphertext: &[u8],
aad: &[u8],
) -> Result<Vec<u8>, CryptoError>;Source line: 185.