@gramota/verifier
v0.5.0
Published
Relying-party verifier for the EU Digital Identity Wallet. One client, one method, full IETF SD-JWT-VC + KB-JWT spec compliance.
Maintainers
Readme
@gramota/verifier
Relying-party verifier for the EU Digital Identity Wallet. One class, one method (
verify), 12 named security checks, IETF SD-JWT-VC + KB-JWT + OID4VP-compliant. DiscriminatedVerifyResultso you destructure success vs failure cleanly.
Part of Gramota — the TypeScript SDK for the EU Digital Identity Wallet (EUDIW).
Install
pnpm add @gramota/verifier
# or: npm install @gramota/verifier
# or: yarn add @gramota/verifierQuick example
import { Verifier } from "@gramota/verifier";
import { StaticTrustResolver } from "@gramota/trust";
const verifier = new Verifier({
audience: "https://verifier.example",
trust: new StaticTrustResolver([issuerJwk]),
});
const result = await verifier.verify(vpToken, { nonce: "n-12345" });
if (result.ok) {
console.log(result.claims); // { given_name: "Greta", ... }
console.log(result.metadata); // { issuer, audience, issuedAt, expiresAt, ... }
} else {
console.log(result.failedCheck); // e.g. "kb-jwt.audience"
console.log(result.reason);
}What's inside
Verifier— single class, configured once with{ audience, trust, ... }Verifier.verify(token, { nonce })→VerifyResult(success ∪ failure)- 12 named security checks run in order (parse → trust → issuer signature → hash binding → KB-JWT presence/cnf/sig/aud/nonce/time/transcript → status). Result reports which one failed.
additionalAudiencesconfig — accepts both the SD-JWT-VCaud=URLform and the OID4VPaud=x509_san_dns:hostform (production EU wallets send the latter)inspect(token)— peek at the parsed structure without verification (debugging)VerifierErrorcarries the full failure record for logs / dashboards
For the high-level wallet + issuer counterparts, see the main repo.
