SDK — Credential Operations
SDK — Credential Operations
Source: packages/sdk/src/credentials.ts.
| SDK method | Endpoint |
|---|---|
issueCredential(params) | POST /api/v1/credentials/issue |
verifyCredential(vc) | POST /api/v1/credentials/verify |
revokeCredential(id, reason) | POST /api/v1/credentials/revoke |
getCredential(id) | GET /api/v1/credentials/{id} |
checkRevocationStatus(id) | GET /api/v1/credentials/{id}/status |
createPresentation(params) | POST /api/v1/presentations/create |
verifyPresentation(vp, challenge?, domain?) | POST /api/v1/presentations/verify |
Example: issue → present → verify
1 import type { VerifiableCredential, VerifiablePresentation } from '@infinia/ida-sdk'; 2 3 // 1. Issue 4 const vc: VerifiableCredential = await client.issueCredential({ 5 issuerDid: 'did:adi:university…', 6 issuerName: 'Acme University', 7 subjectDid: 'did:adi:alice…', 8 type: ['VerifiableCredential', 'UniversityDegreeCredential'], 9 credentialSubject: { degree: 'MSc', graduationDate: '2026-06-15' }, 10 schemaId: '01HXVN…', 11 }); 12 13 // 2. Holder builds VP (same SDK, different identity) 14 const vp: VerifiablePresentation = await holderClient.createPresentation({ 15 holderDid: 'did:adi:alice…', 16 credentialIds: [vc.id], 17 challenge: '<verifier-challenge>', 18 domain: 'verifier.example.com', 19 }); 20 21 // 3. Verifier verifies 22 const result = await verifierClient.verifyPresentation(vp, '<verifier-challenge>', 'verifier.example.com'); 23 if (!result.valid) { 24 console.error('VP failed:', result.errors); 25 }
Revocation
1 await issuerClient.revokeCredential(vc.id, 'subject violated terms'); 2 const { revoked } = await anyClient.checkRevocationStatus(vc.id); 3 console.assert(revoked === true);