Skip to content

Commit

Permalink
add didcomm, dids, issuance, revocation & anoncred services to client (
Browse files Browse the repository at this point in the history
  • Loading branch information
IliasElbarnoussi committed Jun 12, 2024
1 parent 8216f1f commit a1297a4
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 5 deletions.
45 changes: 43 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import {
AnoncredsCredentialTemplatesService,
DiDsService,
DidCommConnectionsService,
DidCommInvitationsService,
DidCommIssuanceService,
DidCommMessagingService,
DidCommVerificationService,
IssuanceService,
OpenAPI,
OpenId4VcIssuanceService,
OpenId4VcVerificationService,
PresentationTemplatesService,
ProjectProfileService,
ProjectsService,
RevocationService,
SdJwtVcCredentialTemplatesService,
WebhooksService,
} from '../generated'
Expand All @@ -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,
Expand All @@ -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
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/credentialTemplate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
})

Expand All @@ -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',
})
Expand Down
2 changes: 1 addition & 1 deletion test/presentationTemplate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
})

Expand Down

0 comments on commit a1297a4

Please sign in to comment.