Weave documentation
Rust referenceweave-sdk

weave-sdk · identity

Source declarations, signatures and documentation for identity.

Source: sigil/weave/libs/weave-sdk/src/identity.rs. SHA-256: 889c8cbec114d9655e97f1b7bd632d3916b68dca7b98f588db65887f561ef53c.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

identity::WeaveIdentity

Agent identity within the Weave network. Wraps OAS DID identity with Weave-specific operations.

#[derive(Clone)]
pub struct WeaveIdentity {

}

Source line: 11.

identity::WeaveIdentity::new

Create a new identity from components.

pub fn new(did: String, signing_key: SigningKey, document: serde_json::Value) -> Self;

Source line: 32.

identity::WeaveIdentity::generate

Generate a fresh agent identity with Ed25519 keypair. Creates a minimal OAS-compatible DID document.

pub fn generate(namespace: &str, identifier: &str) -> Result<Self>;

Source line: 42.

identity::WeaveIdentity::generate_for_did

Generate fresh device keys for an explicitly assigned DID.

This supports recipient enrollment and compromised-device replacement before the new device has repository access. Authorization still requires a signed access-manifest revision from an existing admin.

pub fn generate_for_did(did: &str) -> Result<Self>;

Source line: 52.

identity::WeaveIdentity::did

The agent's DID string.

pub fn did(&self) -> &str;

Source line: 96.

identity::WeaveIdentity::document

The DID document as JSON.

pub fn document(&self) -> &serde_json::Value;

Source line: 101.

identity::WeaveIdentity::public_key_bytes

The Ed25519 public key bytes (32 bytes).

pub fn public_key_bytes(&self) -> [u8; 32];

Source line: 106.

identity::WeaveIdentity::derive_strand_keypair

Derive an unlinkable application-scoped Strand signing key.

The derivation signs a domain-separated context with this identity, then hashes the deterministic Ed25519 signature into a fresh seed. The resulting public key cannot be linked to the identity public key without possession of the identity secret, and another repository context produces a different Strand key.

pub fn derive_strand_keypair(&self, context: &[u8]) -> weave_crypto::KeyPair;

Source line: 121.

identity::WeaveIdentity::verifying_key

The Ed25519 verifying key.

pub fn verifying_key(&self) -> VerifyingKey;

Source line: 135.

identity::WeaveIdentity::sign

Sign a message with the agent's private key.

pub fn sign(&self, message: &[u8]) -> Vec<u8>;

Source line: 140.

identity::WeaveIdentity::verify

Verify a signature against this identity's public key.

pub fn verify(&self, message: &[u8], signature: &[u8]) -> Result<()>;

Source line: 146.

identity::WeaveIdentity::discovery_key

Discovery key derived from the public key (BLAKE3 hash). Used for DHT lookups without revealing the full public key.

pub fn discovery_key(&self) -> [u8; 32];

Source line: 161.

identity::WeaveIdentity::save

Save identity to a directory (creates identity.json).

pub fn save(&self, dir: &Path) -> Result<()>;

Source line: 166.

identity::WeaveIdentity::load

Load identity from a directory.

pub fn load(dir: &Path) -> Result<Self>;

Source line: 183.

On this page