From 4f0b41846ee8783ec6457540309e653cb3969001 Mon Sep 17 00:00:00 2001 From: Ilias Elbarnoussi Date: Tue, 11 Jun 2024 14:06:08 +0200 Subject: [PATCH 1/5] add didcomm, dids, issuance, revocation, anoncred services to client Signed-off-by: Ilias Elbarnoussi --- src/client.ts | 52 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/src/client.ts b/src/client.ts index 262497f..1042e48 100644 --- a/src/client.ts +++ b/src/client.ts @@ -7,6 +7,15 @@ import { ProjectsService, SdJwtVcCredentialTemplatesService, WebhooksService, + RevocationService, + DidCommIssuanceService, + DidCommVerificationService, + IssuanceService, + DidCommMessagingService, + DidCommConnectionsService, + DidCommInvitationsService, + DiDsService, + AnoncredsCredentialTemplatesService } from '../generated' export default class Paradym { @@ -14,14 +23,32 @@ export default class Paradym { projectProfile: typeof ProjectProfileService webhooks: typeof WebhooksService templates: { - credentials: typeof SdJwtVcCredentialTemplatesService - presentations: typeof PresentationTemplatesService + sdJwtVc: { + credentials: typeof SdJwtVcCredentialTemplatesService + presentations: typeof PresentationTemplatesService + }, + anoncreds: { + credentials: 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 +61,30 @@ export default class Paradym { this.webhooks = WebhooksService this.templates = { - credentials: SdJwtVcCredentialTemplatesService, - presentations: PresentationTemplatesService, + sdJwtVc: { + credentials: SdJwtVcCredentialTemplatesService, + presentations: PresentationTemplatesService, + }, + anoncreds: { + credentials: 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 } } From 297aabd6a8e4089c8b95f5a98ec9be7f7ba61635 Mon Sep 17 00:00:00 2001 From: Ilias Elbarnoussi Date: Tue, 11 Jun 2024 14:08:26 +0200 Subject: [PATCH 2/5] fix styling Signed-off-by: Ilias Elbarnoussi --- src/client.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/client.ts b/src/client.ts index 1042e48..4986dc2 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,21 +1,21 @@ import { + AnoncredsCredentialTemplatesService, + DiDsService, + DidCommConnectionsService, + DidCommInvitationsService, + DidCommIssuanceService, + DidCommMessagingService, + DidCommVerificationService, + IssuanceService, OpenAPI, OpenId4VcIssuanceService, OpenId4VcVerificationService, PresentationTemplatesService, ProjectProfileService, ProjectsService, + RevocationService, SdJwtVcCredentialTemplatesService, WebhooksService, - RevocationService, - DidCommIssuanceService, - DidCommVerificationService, - IssuanceService, - DidCommMessagingService, - DidCommConnectionsService, - DidCommInvitationsService, - DiDsService, - AnoncredsCredentialTemplatesService } from '../generated' export default class Paradym { @@ -26,7 +26,7 @@ export default class Paradym { sdJwtVc: { credentials: typeof SdJwtVcCredentialTemplatesService presentations: typeof PresentationTemplatesService - }, + } anoncreds: { credentials: typeof AnoncredsCredentialTemplatesService } @@ -67,7 +67,7 @@ export default class Paradym { }, anoncreds: { credentials: AnoncredsCredentialTemplatesService, - } + }, } this.openId4Vc = { issuance: OpenId4VcIssuanceService, From 2b289ecbbc0938e357b8196dd696db73dc437ed8 Mon Sep 17 00:00:00 2001 From: Ilias Elbarnoussi <90471760+IliasElbarnoussi@users.noreply.github.com> Date: Tue, 11 Jun 2024 14:17:52 +0200 Subject: [PATCH 3/5] Update src/client.ts Co-authored-by: Timo Glastra --- src/client.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/client.ts b/src/client.ts index 4986dc2..bfa76cb 100644 --- a/src/client.ts +++ b/src/client.ts @@ -23,12 +23,10 @@ export default class Paradym { projectProfile: typeof ProjectProfileService webhooks: typeof WebhooksService templates: { - sdJwtVc: { - credentials: typeof SdJwtVcCredentialTemplatesService - presentations: typeof PresentationTemplatesService - } - anoncreds: { - credentials: typeof AnoncredsCredentialTemplatesService + presentations: typeof PresentationTemplatesService, + credentials: { + sdJwtVc: typeof SdJwtVcCredentialTemplatesService, + anoncreds: typeof AnoncredsCredentialTemplatesService } } From 31282d6ebf6a09fa42e4c9c9fec55565404c9337 Mon Sep 17 00:00:00 2001 From: Ilias Elbarnoussi Date: Tue, 11 Jun 2024 14:25:11 +0200 Subject: [PATCH 4/5] adjust structure --- src/client.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/client.ts b/src/client.ts index bfa76cb..4986dc2 100644 --- a/src/client.ts +++ b/src/client.ts @@ -23,10 +23,12 @@ export default class Paradym { projectProfile: typeof ProjectProfileService webhooks: typeof WebhooksService templates: { - presentations: typeof PresentationTemplatesService, - credentials: { - sdJwtVc: typeof SdJwtVcCredentialTemplatesService, - anoncreds: typeof AnoncredsCredentialTemplatesService + sdJwtVc: { + credentials: typeof SdJwtVcCredentialTemplatesService + presentations: typeof PresentationTemplatesService + } + anoncreds: { + credentials: typeof AnoncredsCredentialTemplatesService } } From 71f48b674607ff068e05f7b51a5daff54ec91f1c Mon Sep 17 00:00:00 2001 From: Ilias Elbarnoussi Date: Wed, 12 Jun 2024 10:56:43 +0200 Subject: [PATCH 5/5] fix templates structure --- src/client.ts | 21 +++++++++------------ test/credentialTemplate.test.ts | 4 ++-- test/presentationTemplate.test.ts | 2 +- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/client.ts b/src/client.ts index 4986dc2..4925232 100644 --- a/src/client.ts +++ b/src/client.ts @@ -23,12 +23,10 @@ export default class Paradym { projectProfile: typeof ProjectProfileService webhooks: typeof WebhooksService templates: { - sdJwtVc: { - credentials: typeof SdJwtVcCredentialTemplatesService - presentations: typeof PresentationTemplatesService - } - anoncreds: { - credentials: typeof AnoncredsCredentialTemplatesService + presentations: typeof PresentationTemplatesService + credentials: { + sdJwtVc: typeof SdJwtVcCredentialTemplatesService + anoncreds: typeof AnoncredsCredentialTemplatesService } } @@ -61,14 +59,13 @@ export default class Paradym { this.webhooks = WebhooksService this.templates = { - sdJwtVc: { - credentials: SdJwtVcCredentialTemplatesService, - presentations: PresentationTemplatesService, - }, - anoncreds: { - credentials: AnoncredsCredentialTemplatesService, + presentations: PresentationTemplatesService, + credentials: { + sdJwtVc: SdJwtVcCredentialTemplatesService, + anoncreds: AnoncredsCredentialTemplatesService, }, } + this.openId4Vc = { issuance: OpenId4VcIssuanceService, verification: OpenId4VcVerificationService, 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', })