From a1297a4e355639384b1e31b1072d78574112aadb Mon Sep 17 00:00:00 2001 From: Ilias Elbarnoussi <90471760+IliasElbarnoussi@users.noreply.github.com> Date: Wed, 12 Jun 2024 11:00:19 +0200 Subject: [PATCH] add didcomm, dids, issuance, revocation & anoncred services to client (#13) --- src/client.ts | 45 +++++++++++++++++++++++++++++-- test/credentialTemplate.test.ts | 4 +-- test/presentationTemplate.test.ts | 2 +- 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/src/client.ts b/src/client.ts index 262497f..4925232 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,10 +1,19 @@ import { + AnoncredsCredentialTemplatesService, + DiDsService, + DidCommConnectionsService, + DidCommInvitationsService, + DidCommIssuanceService, + DidCommMessagingService, + DidCommVerificationService, + IssuanceService, OpenAPI, OpenId4VcIssuanceService, OpenId4VcVerificationService, PresentationTemplatesService, ProjectProfileService, ProjectsService, + RevocationService, SdJwtVcCredentialTemplatesService, WebhooksService, } from '../generated' @@ -14,14 +23,30 @@ export default class Paradym { projectProfile: typeof ProjectProfileService webhooks: typeof WebhooksService templates: { - credentials: typeof SdJwtVcCredentialTemplatesService presentations: typeof PresentationTemplatesService + credentials: { + sdJwtVc: typeof SdJwtVcCredentialTemplatesService + anoncreds: typeof AnoncredsCredentialTemplatesService + } } + openId4Vc: { issuance: typeof OpenId4VcIssuanceService verification: typeof OpenId4VcVerificationService } + didComm: { + issuance: typeof DidCommIssuanceService + verification: typeof DidCommVerificationService + messaging: typeof DidCommMessagingService + connections: typeof DidCommConnectionsService + invitations: typeof DidCommInvitationsService + } + + revocation: typeof RevocationService + issuance: typeof IssuanceService + dids: typeof DiDsService + constructor({ apiKey, baseUrl = 'https://api.paradym.id' }: { apiKey: string; baseUrl?: string }) { OpenAPI.HEADERS = { 'x-access-token': apiKey, @@ -34,13 +59,29 @@ export default class Paradym { this.webhooks = WebhooksService this.templates = { - credentials: SdJwtVcCredentialTemplatesService, presentations: PresentationTemplatesService, + credentials: { + sdJwtVc: SdJwtVcCredentialTemplatesService, + anoncreds: AnoncredsCredentialTemplatesService, + }, } + this.openId4Vc = { issuance: OpenId4VcIssuanceService, verification: OpenId4VcVerificationService, } + + this.didComm = { + issuance: DidCommIssuanceService, + verification: DidCommVerificationService, + messaging: DidCommMessagingService, + connections: DidCommConnectionsService, + invitations: DidCommInvitationsService, + } + + this.revocation = RevocationService + this.issuance = IssuanceService + this.dids = DiDsService } } diff --git a/test/credentialTemplate.test.ts b/test/credentialTemplate.test.ts index 97f008e..21319c9 100644 --- a/test/credentialTemplate.test.ts +++ b/test/credentialTemplate.test.ts @@ -7,7 +7,7 @@ dotenv.config() describe('Credential Template', () => { it('should return all SdJwtVc credential templates', async () => { const client = new Paradym({ apiKey: process.env.X_ACCESS_TOKEN as string }) - const sdJwtCredentialTemplates = await client.templates.credentials.getAllSdJwtVcTemplates({ + const sdJwtCredentialTemplates = await client.templates.credentials.sdJwtVc.getAllCredentialTemplates({ projectId: 'clwt6e610000101s69ubga6lk', }) @@ -17,7 +17,7 @@ describe('Credential Template', () => { it('should return a SdJwtVc credential template', async () => { const client = new Paradym({ apiKey: process.env.X_ACCESS_TOKEN as string }) - const sdJwtCredentialTemplate = await client.templates.credentials.getSdJwtVcTemplate({ + const sdJwtCredentialTemplate = await client.templates.credentials.sdJwtVc.getSdJwtVcTemplate({ projectId: 'clwt6e610000101s69ubga6lk', credentialTemplateId: 'clwyt70o50021yylmethefm27', }) diff --git a/test/presentationTemplate.test.ts b/test/presentationTemplate.test.ts index 2b2aeb2..3a50741 100644 --- a/test/presentationTemplate.test.ts +++ b/test/presentationTemplate.test.ts @@ -7,7 +7,7 @@ dotenv.config() describe('Presentation Template', () => { it('should return all SdJwtVc presentation templates', async () => { const client = new Paradym({ apiKey: process.env.X_ACCESS_TOKEN as string }) - const sdJwtPresentationTemplates = await client.templates.presentations.getAllPresentationTemplatesPaginated({ + const sdJwtPresentationTemplates = await client.templates.presentations.getAllPresentationTemplates({ projectId: 'clwt6e610000101s69ubga6lk', })