pub struct CredentialVerifier;Expand description
Verifier for Verifiable Credentials.
Performs structural validation, expiry checks, and subject matching. Cryptographic proof verification requires the issuer’s public key, which must be resolved via the DID Document.
Implementations§
Source§impl CredentialVerifier
impl CredentialVerifier
Sourcepub fn verify_structure(
credential: &VerifiableCredential,
) -> Result<(), CredentialError>
pub fn verify_structure( credential: &VerifiableCredential, ) -> Result<(), CredentialError>
Verify a credential’s structure and expiry.
Checks:
- The credential has a non-empty
id - The type array includes “VerifiableCredential”
- The subject has a non-empty
id - The credential has not expired
This does NOT verify the cryptographic proof (that requires the issuer’s public key resolved from their DID Document).
Sourcepub fn is_expired(credential: &VerifiableCredential) -> bool
pub fn is_expired(credential: &VerifiableCredential) -> bool
Check if a credential has expired.
Returns false if the credential has no expiration date.
Sourcepub fn verify_subject(
credential: &VerifiableCredential,
subject_did: &str,
) -> bool
pub fn verify_subject( credential: &VerifiableCredential, subject_did: &str, ) -> bool
Verify the credential was issued for the given subject DID.
Auto Trait Implementations§
impl Freeze for CredentialVerifier
impl RefUnwindSafe for CredentialVerifier
impl Send for CredentialVerifier
impl Sync for CredentialVerifier
impl Unpin for CredentialVerifier
impl UnwindSafe for CredentialVerifier
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