Weave Identity Ed25519
Internals
Internals of the Ed25519 identity adapter — DID format/parse, signature verification, and permission callback wiring.
Purpose
Ed25519 identity adapter with DID formatting/parsing, permission callbacks, signing, verification, and builder APIs.
This page follows the real source shape for Weave Identity Ed25519 and explains the workflow a developer is likely to use first.
Developer workflow
Start from the smallest constructor or builder, perform one meaningful operation, inspect the returned state, then add the relevant policy, storage, or network integration. The examples below should be expanded whenever the crate API changes.
Primary types to know
Ed25519Adapter— adapters/ed25519/src/lib.rsEd25519AdapterBuilder— adapters/ed25519/src/lib.rsEd25519AdapterConfig— adapters/ed25519/src/lib.rsEd25519IdentityMetadata— adapters/ed25519/src/lib.rs
Example shape
use weave_identity_ed25519::{DelegationCertificate, Ed25519Adapter};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Internals: each Ed25519Adapter owns a SigningKey plus an optional
// IdentityResolver. The adapter signs delegation certificates and other
// typed payloads via the same key path.
let adapter = Ed25519Adapter::new();
// Mint a delegation cert. The certificate carries `issuer -> subject` plus
// a validity window; new_signed() produces a canonical, Ed25519-signed blob.
let now = chrono::Utc::now();
let cert = DelegationCertificate::new_signed(
&adapter,
"did:l1fe:agent:alice",
"did:l1fe:agent:bot-7",
now,
now + chrono::Duration::hours(8),
vec!["read:inbox".into(), "write:outbox".into()],
)?;
assert!(cert.is_time_valid(now + chrono::Duration::minutes(30)));
// canonical_bytes is the byte payload the signature commits to.
let bytes = cert.canonical_bytes()?;
println!(
"issuer={} subject={} bytes={}",
cert.issuer(), cert.subject(), bytes.len(),
);
Ok(())
}