Skip to content
Proposed specification for review. We are seeking feedback on key architectural choices in the industry consultation.

Verify a Credential

PDTF credential verification has four jobs: validate the VC structure, verify the issuer’s signature, confirm through OpenID Federation that the issuer is trusted for the claimed paths, and check the credential has not been revoked or suspended.

In @pdtf/core, the easiest way to do that is VcValidator. It combines DID resolution, proof verification, federation trust resolution, and Bitstring Status List checking in one pipeline.

Terminal window
npm install @pdtf/core
import { DidResolver, FederationRegistryResolver, VcValidator, type VerifiableCredential } from '@pdtf/core';
const didResolver = new DidResolver({
defaultTtlMs: 60 * 60 * 1000,
});
const federationResolver = new FederationRegistryResolver({
trustAnchors: ['https://propdata.org.uk'],
cacheTtlMs: 60 * 60 * 1000,
});
const validator = new VcValidator();

DidResolver resolves did:key locally and did:web over HTTPS. FederationRegistryResolver resolves the issuer’s trust chain to the PDTF Trust Anchor at https://propdata.org.uk and caches it. VcValidator orchestrates the checks. There is no separate Trusted Issuer Registry: OpenID Federation replaced it (04 §1.1). See Verify Trust for the resolver on its own.

Federation authorisation is path-based, not issuer-wide: the issuer’s pdtf-verified-issuer Trust Mark lists the entity:path combinations it may assert in delegation.authorised_paths. That means you should tell the validator which PDTF entity paths the credential is asserting.

For an EPC credential, that might be:

const credentialPaths = [
'Property:/energyEfficiency/*',
];

If you skip credentialPaths, the validator can still check structure, signature, and revocation, but it cannot confirm the issuer is authorised for the data being claimed.

const vc: VerifiableCredential = await loadCredentialSomehow();
const result = await validator.validate(vc, {
didResolver,
federationResolver,
credentialPaths,
});
if (!result.valid) {
console.error(result.errors);
throw new Error('Credential failed validation');
}
console.log('Credential is valid');
console.log(result.trust.trustLevel); // 'trusted_proxy'
console.log(result.trust.trustMarkId); // 'https://propdata.org.uk/trust-marks/pdtf-verified-issuer'

The result is stage-based:

  • structure: required VC and PDTF fields
  • signature: resolves the issuer DID, checks verificationMethod, confirms the key is in assertionMethod, then runs verifyProof
  • trust: resolves the issuer’s Entity Configuration, walks authority_hints to the Trust Anchor, verifies the Trust Mark, and checks delegation.authorised_paths covers the claimed paths
  • status: fetches the signed Bitstring Status List credential, verifies it, and checks the credential’s revocation (and, where present, suspension) bit

The trust result reports the issuer’s level from delegation.trust_level: root_issuer, trusted_proxy or account_provider. The fourth level, assertion, is never returned by federation resolution. It applies to a credential whose evidence is a UserAttestation (a person’s own statement), so read it from the evidence. See 04 §8.

VcValidator is intentionally fail-closed in the places that matter:

  • issuer must match the DID used in proof.verificationMethod
  • the verification method must exist in the DID document
  • the verification method must be listed in assertionMethod
  • credentialStatus must be present for revocation checking
  • a set revocation or suspension bit means the credential is rejected
  • if federation trust resolution fails, the credential is rejected; there is no fallback trust level

That aligns with the PDTF model: a valid signature is not enough on its own. When composing transaction state, a credential that fails trust resolution is excluded and logged as unauthorised (07 §3.3).

5. Verify just the proof, if you need a lower-level check

Section titled “5. Verify just the proof, if you need a lower-level check”

If you already resolved the public key yourself, you can call verifyProof directly:

import { DidResolver, verifyProof, type VerifiableCredential } from '@pdtf/core';
import { base58btc } from 'multiformats/bases/base58';
const vc: VerifiableCredential = await loadCredentialSomehow();
const resolver = new DidResolver();
const vm = vc.proof!.verificationMethod;
const issuerDid = vm.split('#')[0]!;
const didDoc = await resolver.resolve(issuerDid);
const method = didDoc.verificationMethod!.find((m) => m.id === vm)!;
const decoded = base58btc.decode(method.publicKeyMultibase!);
const publicKey = decoded[0] === 0xed && decoded[1] === 0x01
? decoded.slice(2)
: decoded;
const ok = verifyProof({
document: vc,
publicKey,
});
console.log({ ok });

Use this lower-level path when you are embedding verification into a custom flow, but prefer VcValidator for production verification because it also checks federation authorisation and revocation.

For most PDTF consumers, the right flow is:

  1. Parse the VC JSON.
  2. Call validator.validate(...) with credentialPaths.
  3. Reject if any stage fails.
  4. Log warnings and the trust result (trust chain, Trust Mark, trust level) for audit.
  5. Cache DID documents, trust chains, and status lists for short periods only. Trust Marks are short-lived (days), so do not cache them beyond their exp.

If the credential is about access or authority, such as SellerCapacity, Offer, Gift, Representation, or TransactionRole, do not skip the status check. Revocation is what turns an old mandate into an invalid one, and suspension holds a disputed one (14 §8).