End-to-End Examples

View as Markdown

A complete issue → present → verify round-trip:

1import { IDAClient } from '@infinia/ida-sdk';
2
3const issuer = new IDAClient({ baseUrl, jwt: ISSUER_JWT });
4const holder = new IDAClient({ baseUrl, jwt: HOLDER_JWT });
5const verifier = new IDAClient({ baseUrl, jwt: VERIFIER_JWT });
6
7// 1. Issuer signs a credential
8const vc = await issuer.issueCredential({
9 schemaId: 'kyc-v1',
10 subject: HOLDER_DID,
11 claims: { country: 'AE', ageOver: 18 },
12});
13
14// 2. Holder builds a presentation
15const vp = await holder.createPresentation({
16 credentialIds: [vc.id],
17 challenge: 'verifier-nonce',
18});
19
20// 3. Verifier checks
21const result = await verifier.verifyPresentation(vp);
22console.log(result.valid); // true