OpenAgentID documentation
Source referencesRust module referenceopenagent-crypto-wasm

openagent-crypto-wasm · ed25519

Declared module signatures, types, configuration, and source documentation.

Source: openagent-sdk/crates/openagent-crypto-wasm/src/ed25519.rs. SHA-256: e179bc0994784a264936ee081d125197bc8c5a2396fd4195a5c539e3fd97c0f4.

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.

ed25519::SIGNING_KEY_LEN

Length of an Ed25519 signing (private) key in bytes.

pub const SIGNING_KEY_LEN: usize;

Source line: 21.

ed25519::VERIFYING_KEY_LEN

Length of an Ed25519 verifying (public) key in bytes.

pub const VERIFYING_KEY_LEN: usize;

Source line: 23.

ed25519::SIGNATURE_LEN

Length of an Ed25519 signature in bytes.

pub const SIGNATURE_LEN: usize;

Source line: 25.

ed25519::Keypair

An Ed25519 keypair, suitable for both Rust and WASM contexts.

Holds the 32-byte signing key and the derived 32-byte verifying key. The signing key bytes are zeroized when this struct is dropped.

Security

Debug deliberately redacts the signing key. Do not log a [Keypair] in any way that could expose signing_key.

pub struct Keypair {

}

Source line: 36.

ed25519::Keypair::signing_key_bytes

Returns a copy of the 32-byte signing (private) key bytes.

The returned array should be wiped after use.

#[inline]
pub fn signing_key_bytes(&self) -> [u8; SIGNING_KEY_LEN];

Source line: 61.

ed25519::Keypair::verifying_key_bytes

Returns a copy of the 32-byte verifying (public) key bytes.

#[inline]
pub fn verifying_key_bytes(&self) -> [u8; VERIFYING_KEY_LEN];

Source line: 67.

ed25519::generate_keypair

Generates a fresh Ed25519 keypair using the OS / WASM host CSPRNG.

Examples

let kp = openagent_crypto_wasm::ed25519::generate_keypair();
assert_eq!(kp.signing_key_bytes().len(), 32);
assert_eq!(kp.verifying_key_bytes().len(), 32);
pub fn generate_keypair() -> Keypair;

Source line: 81.

ed25519::keypair_from_signing_key

Constructs an Ed25519 keypair from raw signing-key bytes.

The verifying key is computed deterministically from the signing key.

Errors

[CryptoError::InvalidLength] if signing_key is not exactly [SIGNING_KEY_LEN] bytes.

pub fn keypair_from_signing_key(signing_key: &[u8]) -> Result<Keypair, CryptoError>;

Source line: 102.

ed25519::public_from_private

Derives the Ed25519 verifying (public) key from a signing (private) key.

Errors

[CryptoError::InvalidLength] if signing_key is not exactly 32 bytes.

pub fn public_from_private(signing_key: &[u8]) -> Result<[u8; VERIFYING_KEY_LEN], CryptoError>;

Source line: 119.

ed25519::sign

Signs message with the supplied 32-byte Ed25519 signing key.

Returns the 64-byte detached signature.

Errors

[CryptoError::InvalidLength] if signing_key is not exactly 32 bytes.

pub fn sign(signing_key: &[u8], message: &[u8]) -> Result<[u8; SIGNATURE_LEN], CryptoError>;

Source line: 131.

ed25519::verify

Verifies an Ed25519 signature against the given verifying key and message.

Returns Ok(()) on success.

Errors

  • [CryptoError::InvalidLength] if either verifying_key or signature has the wrong length.
  • [CryptoError::InvalidPublicKey] if verifying_key is not on the curve.
  • [CryptoError::SignatureInvalid] if verification fails.
pub fn verify(verifying_key: &[u8], message: &[u8], signature: &[u8]) -> Result<(), CryptoError>;

Source line: 150.

On this page