Skip to main content

NamespaceVerifier

Trait NamespaceVerifier 

Source
pub trait NamespaceVerifier: Send + Sync {
    // Required methods
    fn ecosystem(&self) -> Ecosystem;
    fn initiate<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        now: DateTime<Utc>,
        package_name: &'life1 PackageName,
        did: &'life2 CanonicalDid,
        platform: &'life3 PlatformContext,
    ) -> Pin<Box<dyn Future<Output = Result<VerificationChallenge, NamespaceVerifyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn verify<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        now: DateTime<Utc>,
        package_name: &'life1 PackageName,
        did: &'life2 CanonicalDid,
        platform: &'life3 PlatformContext,
        challenge: &'life4 VerificationChallenge,
    ) -> Pin<Box<dyn Future<Output = Result<NamespaceOwnershipProof, NamespaceVerifyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
}
Expand description

Verifies ownership of a namespace (package) on an upstream registry.

Each ecosystem adapter implements this trait. The SDK stores adapters as Arc<dyn NamespaceVerifier> in a registry map keyed by Ecosystem.

Usage:

let verifier: Arc<dyn NamespaceVerifier> = registry.get(&Ecosystem::Npm)?;
let challenge = verifier.initiate(&package_name, &did, &platform_ctx).await?;
// ... user completes challenge ...
let proof = verifier.verify(&package_name, &did, &platform_ctx, &challenge).await?;

Required Methods§

Source

fn ecosystem(&self) -> Ecosystem

Returns the ecosystem this verifier handles.

Source

fn initiate<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, now: DateTime<Utc>, package_name: &'life1 PackageName, did: &'life2 CanonicalDid, platform: &'life3 PlatformContext, ) -> Pin<Box<dyn Future<Output = Result<VerificationChallenge, NamespaceVerifyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Initiate a verification challenge for the given package.

Args:

  • now: Current time (injected, never call Utc::now() directly).
  • package_name: The package to verify ownership of.
  • did: The caller’s canonical DID.
  • platform: Verified platform identity context for cross-referencing.
Source

fn verify<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, now: DateTime<Utc>, package_name: &'life1 PackageName, did: &'life2 CanonicalDid, platform: &'life3 PlatformContext, challenge: &'life4 VerificationChallenge, ) -> Pin<Box<dyn Future<Output = Result<NamespaceOwnershipProof, NamespaceVerifyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Verify the challenge was completed and return ownership proof.

Args:

  • now: Current time (injected, never call Utc::now() directly).
  • package_name: The package to verify ownership of.
  • did: The caller’s canonical DID.
  • platform: Verified platform identity context for cross-referencing.
  • challenge: The challenge previously returned by initiate.

Implementors§