Weave documentation
Rust referenceweave-identity

weave-identity · adapter

Source declarations, signatures and documentation for adapter.

Source: sigil/weave/adapters/weave-identity/src/adapter.rs. SHA-256: c51b951df4b2c4cda6c48021f7b2e445c1be465df8ffa333971f4096eb8188ae.

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.

adapter::WeaveIdentityAdapter

Core trait for pluggable identity operations

This trait abstracts all identity operations to support multiple identity systems (DID, PKI, custom) without coupling libraries to specific implementations.

#[async_trait]
pub trait WeaveIdentityAdapter: Send + Sync {
    /// Generate a new keypair for the specified identity type
    async fn generate_keypair(&self, identity_type: IdentityType) -> Result<KeyPair>;

    /// Derive an identity from a keypair, with optional contextual name
    async fn derive_identity(
        &self,
        keypair: &KeyPair,
        identity_type: IdentityType,
        name: Option<&str>,
    ) -> Result<Identity>;

    /// Sign data with a keypair
    async fn sign(&self, keypair: &KeyPair, data: &[u8]) -> Result<Signature>;

    /// Verify a signature against an identity
    async fn verify(&self, identity: &Identity, data: &[u8], signature: &Signature)
        -> Result<bool>;

    /// Create a new identity with keypair (convenience method)
    async fn create_identity(
        &self,
        identity_type: IdentityType,
        name: Option<&str>,
    ) -> Result<(KeyPair, Identity)> ;

    /// Parse an identity from string representation
    async fn parse_identity(&self, identity_str: &str) -> Result<Identity>;

    /// Get the public key from an identity
    async fn get_public_key(&self, identity: &Identity) -> Result<Vec<u8>>;

    /// Create an agent identity
    async fn create_agent_identity(
        &self,
        instance_id: Option<&str>,
    ) -> Result<(KeyPair, Identity)> ;

    /// Create an autonomous organization identity
    async fn create_ao_identity(&self, org_name: &str) -> Result<(KeyPair, Identity)> ;

    /// Create a human identity
    async fn create_human_identity(&self) -> Result<(KeyPair, Identity)> ;

    /// Validate identity format and cryptographic integrity
    async fn validate_identity(&self, identity: &Identity) -> Result<bool>;

    /// Get identity type from a DID string
    fn get_identity_type(&self, did: &str) -> Result<IdentityType>;

    /// Verify that one identity is controlled by another (e.g., agent by org)
    async fn verify_control(&self, controlled: &Identity, controller: &Identity) -> Result<bool>;
}

Source line: 12.

On this page