pub struct NpmVerifier { /* private fields */ }Expand description
npm registry namespace ownership verifier.
Verifies package ownership by checking the maintainers field in the
public package metadata endpoint. Falls back to matching the repository.url
against the user’s verified GitHub claim.
Usage:
ⓘ
let verifier = NpmVerifier::new();
let challenge = verifier.initiate(&package, &did, &platform).await?;
let proof = verifier.verify(&package, &did, &platform, &challenge).await?;Implementations§
Source§impl NpmVerifier
impl NpmVerifier
Sourcepub fn with_base_url(base_url: Url) -> Self
pub fn with_base_url(base_url: Url) -> Self
Create a verifier with a custom base URL (for testing).
Args:
base_url: The base URL to use instead ofhttps://registry.npmjs.org.
Trait Implementations§
Source§impl Default for NpmVerifier
impl Default for NpmVerifier
Source§impl NamespaceVerifier for NpmVerifier
impl NamespaceVerifier for NpmVerifier
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,
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. Read more
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,
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. Read more
Auto Trait Implementations§
impl Freeze for NpmVerifier
impl !RefUnwindSafe for NpmVerifier
impl Send for NpmVerifier
impl Sync for NpmVerifier
impl Unpin for NpmVerifier
impl UnsafeUnpin for NpmVerifier
impl !UnwindSafe for NpmVerifier
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more