Weave Identity
Adapters
Identity adapters for Weave Identity: Ed25519, multi-sig, and custom adapter implementations behind the Identity trait.
Purpose
Identity abstraction with DID-like documents, adapters, keypairs, public keys, signatures, delegation, and resolvers.
This page follows the real source shape for Weave Identity 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
DelegationCertificate— adapters/weave-identity/src/ed25519_adapter.rsEd25519Adapter— adapters/weave-identity/src/ed25519_adapter.rsIdentity— adapters/weave-identity/src/identity.rsIdentityDocument— adapters/weave-identity/src/resolver.rsKeyPair— adapters/weave-identity/src/keypair.rsPublicKey— adapters/weave-identity/src/keypair.rsSignature— adapters/weave-identity/src/signature.rsVerificationMethod— adapters/weave-identity/src/resolver.rsIdentityError— adapters/weave-identity/src/error.rsIdentityType— adapters/weave-identity/src/identity.rsIdentityResolver— adapters/weave-identity/src/resolver.rsWeaveIdentityAdapter— adapters/weave-identity/src/adapter.rs
Example shape
use std::sync::Arc;
use weave_identity::{Ed25519Adapter, WeaveIdentityAdapter};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Ed25519Adapter is the reference implementation of WeaveIdentityAdapter.
// Treating it as `Arc<dyn WeaveIdentityAdapter>` keeps callers swappable
// with HSM or FROST adapters that share the same trait surface.
let adapter: Arc<dyn WeaveIdentityAdapter> = Arc::new(Ed25519Adapter::new());
// create_agent_identity is the canonical hook every adapter implements;
// it returns a DID plus the typed Identity, both bound to the adapter.
let (did, identity) = adapter.create_agent_identity(Some("alice")).await?;
// sign_data and verify_data round-trip through the adapter so all bytes
// pass through identical canonicalisation regardless of backing key store.
let payload = b"adapter round-trip";
let signature = adapter.sign_data(&identity, payload).await?;
let verified = adapter.verify_data(&identity, payload, &signature).await?;
println!(
"did={} pubkey_len={} signature_verified={}",
did,
identity.public_key().len(),
verified,
);
Ok(())
}