openagent-crypto-wasm · x25519
Declared module signatures, types, configuration, and source documentation.
Source: openagent-sdk/crates/openagent-crypto-wasm/src/x25519.rs. SHA-256: c3377cf2c8c6a2f73d789a2ae207d9fdc9c28dd61499daee727076477af34af6.
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.
x25519::SECRET_KEY_LEN
Length of an X25519 secret (private) key in bytes.
pub const SECRET_KEY_LEN: usize;Source line: 15.
x25519::PUBLIC_KEY_LEN
Length of an X25519 public key in bytes.
pub const PUBLIC_KEY_LEN: usize;Source line: 17.
x25519::SHARED_SECRET_LEN
Length of an X25519 raw shared secret in bytes.
pub const SHARED_SECRET_LEN: usize;Source line: 19.
x25519::X25519Keypair
An X25519 keypair (Curve25519, RFC 7748).
The secret key is zeroized on drop.
pub struct X25519Keypair {
}Source line: 24.
x25519::X25519Keypair::secret_key_bytes
Returns a copy of the 32-byte secret key bytes.
#[inline]
pub fn secret_key_bytes(&self) -> [u8; SECRET_KEY_LEN];Source line: 47.
x25519::X25519Keypair::public_key_bytes
Returns a copy of the 32-byte public key bytes.
#[inline]
pub fn public_key_bytes(&self) -> [u8; PUBLIC_KEY_LEN];Source line: 53.
x25519::generate_keypair
Generates a fresh X25519 keypair using the OS / WASM host CSPRNG.
pub fn generate_keypair() -> X25519Keypair;Source line: 59.
x25519::public_from_secret
Derives an X25519 public key from a 32-byte secret key.
Errors
[CryptoError::InvalidLength] if secret_key is not exactly 32 bytes.
pub fn public_from_secret(secret_key: &[u8]) -> Result<[u8; PUBLIC_KEY_LEN], CryptoError>;Source line: 77.
x25519::diffie_hellman
Performs an X25519 Diffie-Hellman key exchange.
Returns the raw 32-byte shared secret. Callers MUST process this through
a KDF (e.g. [crate::hkdf_sha256]) before using it as keying material.
Errors
[CryptoError::InvalidLength] if either input is not 32 bytes.
pub fn diffie_hellman(
secret_key: &[u8],
peer_public_key: &[u8],
) -> Result<[u8; SHARED_SECRET_LEN], CryptoError>;Source line: 94.