Verifiable Credentials verifier supporting W3C Data Integrity Proofs (ecdsa-jcs-2022), did:web, and StatusList2021
Project description
VC Verifier
Open-source Verifiable Credentials verifier supporting W3C standards.
Features
- W3C Data Integrity Proofs -
ecdsa-jcs-2022cryptosuite - ECDSA P-256 (secp256r1) signature verification
- did:web DID method resolution
- StatusList2021 revocation/suspension checking
- JCS (JSON Canonicalization Scheme, RFC 8785) support
Installation
pip install vc-verifier
Or from source:
git clone https://github.com/RLDAC/vc-verifier.git
cd vc-verifier
pip install -e .
Quick Start
Python API
from vc_verifier import verify_credential, VCVerifier
# Verify a credential
credential = {
"@context": ["https://www.w3.org/ns/credentials/v2"],
"type": ["VerifiableCredential"],
"issuer": "did:web:example.com",
"credentialSubject": {
"id": "did:example:holder",
"name": "Alice"
},
"proof": {
"type": "DataIntegrityProof",
"cryptosuite": "ecdsa-jcs-2022",
"verificationMethod": "did:web:example.com#key-1",
"proofValue": "..."
}
}
# Simple verification
result = verify_credential(credential)
print(f"Valid: {result.is_valid}")
# With more control
verifier = VCVerifier(verify_status=True)
result = verifier.verify(credential)
if result.is_valid:
print("Credential is valid!")
else:
print(f"Errors: {result.errors}")
Command Line
# Verify a local file
vc-verify credential.json
# Verify from URL
vc-verify https://example.com/credentials/123
# Verify from stdin
cat credential.json | vc-verify -
# Output as JSON
vc-verify credential.json --json-output
# Skip revocation check
vc-verify credential.json --no-status
Supported Standards
| Standard | Support |
|---|---|
| W3C VC Data Model 2.0 | Full |
| W3C Data Integrity | ecdsa-jcs-2022 |
| did:web | Full |
| StatusList2021 | Revocation, Suspension |
Cryptographic Details
Signature Verification
- Extract
prooffrom credential - Canonicalize the unsigned credential using JCS (RFC 8785)
- Encode as UTF-8 bytes
- Verify ECDSA P-256 signature against the public key
JCS Canonicalization (RFC 8785)
json.dumps(data, sort_keys=True, separators=(",", ":"), ensure_ascii=False)
DID Resolution
did:web:example.com -> https://example.com/.well-known/did.json
did:web:example.com:path:doc -> https://example.com/path/doc/did.json
did:web:example.com%3A8080 -> https://example.com:8080/.well-known/did.json
StatusList2021
Bitstring encoding: base64(gzip(bitstring))
- Bit 0 = MSB of byte 0
0= valid,1= revoked/suspended
API Reference
VCVerifier
class VCVerifier:
def __init__(
self,
did_resolver: DIDResolver | None = None,
statuslist_checker: StatusListChecker | None = None,
verify_status: bool = True,
) -> None: ...
def verify(self, credential: dict) -> VerificationResult: ...
VerificationResult
@dataclass
class VerificationResult:
status: VerificationStatus # VALID, INVALID, or ERROR
credential_id: str | None
issuer: str | None
proof: ProofVerificationResult | None
credential_status: StatusCheckResult | None
errors: list[str]
warnings: list[str]
@property
def is_valid(self) -> bool: ...
DIDResolver
class DIDResolver:
def __init__(
self,
timeout: float = 30.0,
verify_ssl: bool = True,
) -> None: ...
def resolve(self, did: str, use_cache: bool = True) -> DIDDocument: ...
StatusListChecker
class StatusListChecker:
def __init__(
self,
timeout: float = 30.0,
verify_ssl: bool = True,
) -> None: ...
def check_status(
self,
credential: dict,
use_cache: bool = True,
) -> StatusCheckResult | None: ...
Development
# Clone
git clone https://github.com/RLDAC/vc-verifier.git
cd vc-verifier
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Lint
ruff check src tests
License
MIT License - see LICENSE for details.
Related
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
vc_verifier-0.2.0.tar.gz
(15.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vc_verifier-0.2.0.tar.gz.
File metadata
- Download URL: vc_verifier-0.2.0.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48c4c53abca0e7cbc3b9c3e24c56143109c3590737f270e4faeb089876bc59f7
|
|
| MD5 |
95a540c26db85a8afa41ab3fb8997864
|
|
| BLAKE2b-256 |
85459ef992a78a0fbb8e96ecaa794c9ee657d746aba42624d29681f8d40d0d28
|
File details
Details for the file vc_verifier-0.2.0-py3-none-any.whl.
File metadata
- Download URL: vc_verifier-0.2.0-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0d0de687da1e32efdb55ae2f66e045ecf328da09a56e78322b02c704119307f
|
|
| MD5 |
d539084033a30754335737857cc55b26
|
|
| BLAKE2b-256 |
3afe3c40ec1c278c49dfb9377db09c873e70500fb4082d265e5afe10f580cf28
|