@twin.org/identity-service 0.0.3-next.9 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/es/identityProfileRoutes.js +1 -2
- package/dist/es/identityProfileRoutes.js.map +1 -1
- package/dist/es/identityProfileService.js +3 -3
- package/dist/es/identityProfileService.js.map +1 -1
- package/dist/es/identityResolverRoutes.js +3 -4
- package/dist/es/identityResolverRoutes.js.map +1 -1
- package/dist/es/identityResolverService.js +3 -0
- package/dist/es/identityResolverService.js.map +1 -1
- package/dist/es/identityRoutes.js +284 -14
- package/dist/es/identityRoutes.js.map +1 -1
- package/dist/es/identityService.js +154 -31
- package/dist/es/identityService.js.map +1 -1
- package/dist/es/models/IIdentityResolverServiceConfig.js.map +1 -1
- package/dist/es/models/IIdentityServiceConfig.js.map +1 -1
- package/dist/es/models/IIdentityServiceConstructorOptions.js.map +1 -1
- package/dist/es/restEntryPoints.js +3 -0
- package/dist/es/restEntryPoints.js.map +1 -1
- package/dist/types/identityProfileService.d.ts +3 -3
- package/dist/types/identityResolverRoutes.d.ts +1 -1
- package/dist/types/identityResolverService.d.ts +1 -0
- package/dist/types/identityRoutes.d.ts +33 -1
- package/dist/types/identityService.d.ts +59 -12
- package/dist/types/models/IIdentityResolverServiceConfig.d.ts +1 -1
- package/dist/types/models/IIdentityServiceConfig.d.ts +1 -1
- package/dist/types/models/IIdentityServiceConstructorOptions.d.ts +4 -0
- package/dist/types/restEntryPoints.d.ts +3 -0
- package/docs/changelog.md +682 -101
- package/docs/examples.md +196 -1
- package/docs/open-api/spec.json +804 -482
- package/docs/reference/classes/IdentityProfileService.md +11 -11
- package/docs/reference/classes/IdentityResolverService.md +7 -3
- package/docs/reference/classes/IdentityService.md +188 -44
- package/docs/reference/functions/generateRestRoutesIdentityResolver.md +1 -1
- package/docs/reference/functions/identityAlsoKnownAsCreate.md +31 -0
- package/docs/reference/functions/identityAlsoKnownAsRemove.md +31 -0
- package/docs/reference/functions/identityVerifiableCredentialVerifyDocument.md +31 -0
- package/docs/reference/functions/identityVerifiablePresentationVerifyDocument.md +31 -0
- package/docs/reference/index.md +4 -0
- package/docs/reference/interfaces/IIdentityProfileServiceConstructorOptions.md +2 -2
- package/docs/reference/interfaces/IIdentityResolverServiceConfig.md +3 -3
- package/docs/reference/interfaces/IIdentityResolverServiceConstructorOptions.md +4 -4
- package/docs/reference/interfaces/IIdentityServiceConfig.md +3 -3
- package/docs/reference/interfaces/IIdentityServiceConstructorOptions.md +10 -2
- package/docs/reference/variables/restEntryPoints.md +2 -0
- package/locales/en.json +2 -0
- package/package.json +17 -16
|
@@ -47,7 +47,7 @@ export function generateRestRoutesIdentity(baseRouteName, componentName) {
|
|
|
47
47
|
id: "identityCreateResponseExample",
|
|
48
48
|
response: {
|
|
49
49
|
body: {
|
|
50
|
-
"@context": DidContexts.
|
|
50
|
+
"@context": DidContexts.Context,
|
|
51
51
|
id: "did:iota:tst:0xe3088ba9aa8c28e1d139708a14e8c0fdff11ee8223baac4aa5bcf3321e4bfc6a",
|
|
52
52
|
service: [
|
|
53
53
|
{
|
|
@@ -251,6 +251,70 @@ export function generateRestRoutesIdentity(baseRouteName, componentName) {
|
|
|
251
251
|
}
|
|
252
252
|
]
|
|
253
253
|
};
|
|
254
|
+
const identityAlsoKnownAsCreateRoute = {
|
|
255
|
+
operationId: "identityAlsoKnownAsCreate",
|
|
256
|
+
summary: "Add an alias to the alsoKnownAs property on the document",
|
|
257
|
+
tag: tagsIdentity[0].name,
|
|
258
|
+
method: "POST",
|
|
259
|
+
path: `${baseRouteName}/:identity/alias`,
|
|
260
|
+
handler: async (httpRequestContext, request) => identityAlsoKnownAsCreate(httpRequestContext, componentName, request),
|
|
261
|
+
requestType: {
|
|
262
|
+
type: "IIdentityAlsoKnownAsCreateRequest",
|
|
263
|
+
examples: [
|
|
264
|
+
{
|
|
265
|
+
id: "identityAlsoKnownAsCreateRequestExample",
|
|
266
|
+
request: {
|
|
267
|
+
pathParams: {
|
|
268
|
+
identity: "did:iota:tst:0xe3088ba9aa8c28e1d139708a14e8c0fdff11ee8223baac4aa5bcf3321e4bfc6a"
|
|
269
|
+
},
|
|
270
|
+
body: {
|
|
271
|
+
alias: "did:example:123"
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
]
|
|
276
|
+
},
|
|
277
|
+
responseType: [
|
|
278
|
+
{
|
|
279
|
+
type: "INoContentResponse"
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
};
|
|
283
|
+
const identityAlsoKnownAsRemoveRoute = {
|
|
284
|
+
operationId: "identityAlsoKnownAsRemove",
|
|
285
|
+
summary: "Remove an alias from the alsoKnownAs property on the document",
|
|
286
|
+
tag: tagsIdentity[0].name,
|
|
287
|
+
method: "DELETE",
|
|
288
|
+
path: `${baseRouteName}/:identity/alias/:alias`,
|
|
289
|
+
handler: async (httpRequestContext, request) => identityAlsoKnownAsRemove(httpRequestContext, componentName, request),
|
|
290
|
+
requestType: {
|
|
291
|
+
type: "IIdentityAlsoKnownAsRemoveRequest",
|
|
292
|
+
examples: [
|
|
293
|
+
{
|
|
294
|
+
id: "identityAlsoKnownAsRemoveRequestExample",
|
|
295
|
+
request: {
|
|
296
|
+
pathParams: {
|
|
297
|
+
identity: "did:iota:tst:0xe3088ba9aa8c28e1d139708a14e8c0fdff11ee8223baac4aa5bcf3321e4bfc6a",
|
|
298
|
+
alias: "did:example:123"
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
]
|
|
303
|
+
},
|
|
304
|
+
responseType: [
|
|
305
|
+
{
|
|
306
|
+
type: "INoContentResponse",
|
|
307
|
+
examples: [
|
|
308
|
+
{
|
|
309
|
+
id: "identityAlsoKnownAsRemoveResponseExample",
|
|
310
|
+
response: {
|
|
311
|
+
statusCode: HttpStatusCode.noContent
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
]
|
|
317
|
+
};
|
|
254
318
|
const identityVerifiableCredentialCreateRoute = {
|
|
255
319
|
operationId: "identityVerifiableCredentialCreate",
|
|
256
320
|
summary: "Create an identity verifiable credential",
|
|
@@ -364,8 +428,72 @@ export function generateRestRoutesIdentity(baseRouteName, componentName) {
|
|
|
364
428
|
}
|
|
365
429
|
]
|
|
366
430
|
}
|
|
367
|
-
]
|
|
368
|
-
|
|
431
|
+
]
|
|
432
|
+
};
|
|
433
|
+
const identityVerifiableCredentialVerifyDocumentRoute = {
|
|
434
|
+
operationId: "identityVerifiableCredentialVerifyDocument",
|
|
435
|
+
summary: "Verify an identity verifiable credential document",
|
|
436
|
+
tag: tagsIdentity[0].name,
|
|
437
|
+
method: "POST",
|
|
438
|
+
path: `${baseRouteName}/verifiable-credential/verify/document`,
|
|
439
|
+
handler: async (httpRequestContext, request) => identityVerifiableCredentialVerifyDocument(httpRequestContext, componentName, request),
|
|
440
|
+
requestType: {
|
|
441
|
+
type: "IIdentityVerifiableCredentialVerifyDocumentRequest",
|
|
442
|
+
examples: [
|
|
443
|
+
{
|
|
444
|
+
id: "identityVerifiableCredentialVerifyDocumentRequestExample",
|
|
445
|
+
request: {
|
|
446
|
+
body: {
|
|
447
|
+
"@context": ["https://www.w3.org/2018/credentials/v1", "https://schema.org"],
|
|
448
|
+
id: "https://example.com/credentials/3732",
|
|
449
|
+
type: ["VerifiableCredential", "Person"],
|
|
450
|
+
credentialSubject: {
|
|
451
|
+
id: "did:entity-storage:0x4757993355b921a8229bd780f30921b6a0216a72e6c3f37a09d13b8426a17def",
|
|
452
|
+
name: "Jane Doe"
|
|
453
|
+
},
|
|
454
|
+
issuer: "did:entity-storage:0x879c31386f992cfa29b77fe31e37256d69f6a57653cee4eb60ad4c4613c5515a",
|
|
455
|
+
issuanceDate: "2025-01-24T09:21:51.500Z",
|
|
456
|
+
credentialStatus: {
|
|
457
|
+
id: "did:entity-storage:0x879c31386f992cfa29b77fe31e37256d69f6a57653cee4eb60ad4c4613c5515a#revocation",
|
|
458
|
+
type: "BitstringStatusList",
|
|
459
|
+
revocationBitmapIndex: "5"
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
]
|
|
465
|
+
},
|
|
466
|
+
responseType: [
|
|
467
|
+
{
|
|
468
|
+
type: "IIdentityVerifiableCredentialVerifyResponse",
|
|
469
|
+
examples: [
|
|
470
|
+
{
|
|
471
|
+
id: "identityVerifiableCredentialVerifyResponseExample",
|
|
472
|
+
response: {
|
|
473
|
+
body: {
|
|
474
|
+
revoked: false,
|
|
475
|
+
verifiableCredential: {
|
|
476
|
+
"@context": ["https://www.w3.org/2018/credentials/v1", "https://schema.org"],
|
|
477
|
+
id: "https://example.com/credentials/3732",
|
|
478
|
+
type: ["VerifiableCredential", "Person"],
|
|
479
|
+
credentialSubject: {
|
|
480
|
+
id: "did:entity-storage:0x4757993355b921a8229bd780f30921b6a0216a72e6c3f37a09d13b8426a17def",
|
|
481
|
+
name: "Jane Doe"
|
|
482
|
+
},
|
|
483
|
+
issuer: "did:entity-storage:0x879c31386f992cfa29b77fe31e37256d69f6a57653cee4eb60ad4c4613c5515a",
|
|
484
|
+
issuanceDate: "2025-01-24T09:21:51.500Z",
|
|
485
|
+
credentialStatus: {
|
|
486
|
+
id: "did:entity-storage:0x879c31386f992cfa29b77fe31e37256d69f6a57653cee4eb60ad4c4613c5515a#revocation",
|
|
487
|
+
type: "BitstringStatusList",
|
|
488
|
+
revocationBitmapIndex: "5"
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
]
|
|
495
|
+
}
|
|
496
|
+
]
|
|
369
497
|
};
|
|
370
498
|
const identityVerifiableCredentialRevokeRoute = {
|
|
371
499
|
operationId: "identityVerifiableCredentialRevoke",
|
|
@@ -526,8 +654,70 @@ export function generateRestRoutesIdentity(baseRouteName, componentName) {
|
|
|
526
654
|
}
|
|
527
655
|
]
|
|
528
656
|
}
|
|
529
|
-
]
|
|
530
|
-
|
|
657
|
+
]
|
|
658
|
+
};
|
|
659
|
+
const identityVerifiablePresentationVerifyDocumentRoute = {
|
|
660
|
+
operationId: "identityVerifiablePresentationVerifyDocument",
|
|
661
|
+
summary: "Verify an identity verifiable presentation document",
|
|
662
|
+
tag: tagsIdentity[0].name,
|
|
663
|
+
method: "POST",
|
|
664
|
+
path: `${baseRouteName}/verifiable-presentation/verify/document`,
|
|
665
|
+
handler: async (httpRequestContext, request) => identityVerifiablePresentationVerifyDocument(httpRequestContext, componentName, request),
|
|
666
|
+
requestType: {
|
|
667
|
+
type: "IIdentityVerifiablePresentationVerifyDocumentRequest",
|
|
668
|
+
examples: [
|
|
669
|
+
{
|
|
670
|
+
id: "identityVerifiablePresentationVerifyDocumentRequestExample",
|
|
671
|
+
request: {
|
|
672
|
+
body: {
|
|
673
|
+
"@context": ["https://www.w3.org/2018/credentials/v1", "https://schema.org"],
|
|
674
|
+
id: "https://example.com/credentials/3732",
|
|
675
|
+
type: ["VerifiableCredential", "Person"],
|
|
676
|
+
verifiableCredential: [
|
|
677
|
+
{
|
|
678
|
+
"@context": ["https://www.w3.org/2018/credentials/v1", "https://schema.org"],
|
|
679
|
+
id: "https://example.com/credentials/3732",
|
|
680
|
+
type: ["VerifiableCredential", "Person"],
|
|
681
|
+
credentialSubject: {
|
|
682
|
+
id: "did:entity-storage:0x4757993355b921a8229bd780f30921b6a0216a72e6c3f37a09d13b8426a17def",
|
|
683
|
+
name: "Jane Doe"
|
|
684
|
+
},
|
|
685
|
+
issuer: "did:entity-storage:0x879c31386f992cfa29b77fe31e37256d69f6a57653cee4eb60ad4c4613c5515a",
|
|
686
|
+
issuanceDate: "2025-01-24T09:21:51.500Z",
|
|
687
|
+
credentialStatus: {
|
|
688
|
+
id: "did:entity-storage:0x879c31386f992cfa29b77fe31e37256d69f6a57653cee4eb60ad4c4613c5515a#revocation",
|
|
689
|
+
type: "BitstringStatusList",
|
|
690
|
+
revocationBitmapIndex: "5"
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
]
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
]
|
|
698
|
+
},
|
|
699
|
+
responseType: [
|
|
700
|
+
{
|
|
701
|
+
type: "IIdentityVerifiablePresentationVerifyResponse",
|
|
702
|
+
examples: [
|
|
703
|
+
{
|
|
704
|
+
id: "identityVerifiablePresentationVerifyResponseExample",
|
|
705
|
+
response: {
|
|
706
|
+
body: {
|
|
707
|
+
revoked: false,
|
|
708
|
+
verifiablePresentation: {
|
|
709
|
+
"@context": ["https://www.w3.org/2018/credentials/v1", "https://schema.org"],
|
|
710
|
+
id: "presentationId",
|
|
711
|
+
type: ["VerifiablePresentation", "Person"],
|
|
712
|
+
verifiableCredential: ["eyJraWQiOi...D1Z3AQ"],
|
|
713
|
+
holder: "did:entity-storage:0xcea318e06e89f3fb4048160770effd84d0cfa5801fee13dfa6f9413a00429cec"
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
]
|
|
719
|
+
}
|
|
720
|
+
]
|
|
531
721
|
};
|
|
532
722
|
const identityProofCreateRoute = {
|
|
533
723
|
operationId: "identityProofCreate",
|
|
@@ -578,7 +768,7 @@ export function generateRestRoutesIdentity(baseRouteName, componentName) {
|
|
|
578
768
|
response: {
|
|
579
769
|
body: {
|
|
580
770
|
"@context": [
|
|
581
|
-
"https://
|
|
771
|
+
"https://w3id.org/security/data-integrity/v2",
|
|
582
772
|
"https://www.w3.org/ns/credentials/examples/v2"
|
|
583
773
|
],
|
|
584
774
|
type: "DataIntegrityProof",
|
|
@@ -625,7 +815,7 @@ export function generateRestRoutesIdentity(baseRouteName, componentName) {
|
|
|
625
815
|
}
|
|
626
816
|
},
|
|
627
817
|
proof: {
|
|
628
|
-
"@context": "https://
|
|
818
|
+
"@context": "https://w3id.org/security/data-integrity/v2",
|
|
629
819
|
type: "DataIntegrityProof",
|
|
630
820
|
cryptosuite: "eddsa-jcs-2022",
|
|
631
821
|
created: "2025-01-24T11:32:13.106Z",
|
|
@@ -652,8 +842,7 @@ export function generateRestRoutesIdentity(baseRouteName, componentName) {
|
|
|
652
842
|
}
|
|
653
843
|
]
|
|
654
844
|
}
|
|
655
|
-
]
|
|
656
|
-
skipAuth: true
|
|
845
|
+
]
|
|
657
846
|
};
|
|
658
847
|
return [
|
|
659
848
|
identityCreateRoute,
|
|
@@ -662,11 +851,15 @@ export function generateRestRoutesIdentity(baseRouteName, componentName) {
|
|
|
662
851
|
identityVerificationMethodRemoveRoute,
|
|
663
852
|
identityServiceCreateRoute,
|
|
664
853
|
identityServiceRemoveRoute,
|
|
854
|
+
identityAlsoKnownAsCreateRoute,
|
|
855
|
+
identityAlsoKnownAsRemoveRoute,
|
|
665
856
|
identityVerifiableCredentialCreateRoute,
|
|
857
|
+
identityVerifiableCredentialVerifyDocumentRoute,
|
|
666
858
|
identityVerifiableCredentialVerifyRoute,
|
|
667
859
|
identityVerifiableCredentialRevokeRoute,
|
|
668
860
|
identityVerifiableCredentialUnrevokeRoute,
|
|
669
861
|
identityVerifiablePresentationCreateRoute,
|
|
862
|
+
identityVerifiablePresentationVerifyDocumentRoute,
|
|
670
863
|
identityVerifiablePresentationVerifyRoute,
|
|
671
864
|
identityProofCreateRoute,
|
|
672
865
|
identityProofVerifyRoute
|
|
@@ -785,6 +978,45 @@ export async function identityServiceRemove(httpRequestContext, componentName, r
|
|
|
785
978
|
statusCode: HttpStatusCode.noContent
|
|
786
979
|
};
|
|
787
980
|
}
|
|
981
|
+
/**
|
|
982
|
+
* Create an identity alias.
|
|
983
|
+
* @param httpRequestContext The request context for the API.
|
|
984
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
985
|
+
* @param request The request.
|
|
986
|
+
* @returns The response object with additional http response properties.
|
|
987
|
+
*/
|
|
988
|
+
export async function identityAlsoKnownAsCreate(httpRequestContext, componentName, request) {
|
|
989
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
990
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
991
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.identity", request.pathParams.identity);
|
|
992
|
+
const contextIds = await ContextIdStore.getContextIds();
|
|
993
|
+
ContextIdHelper.guard(contextIds, ContextIdKeys.Organization);
|
|
994
|
+
const component = ComponentFactory.get(componentName);
|
|
995
|
+
await component.alsoKnownAsAdd(request.pathParams.identity, request.body.alias, contextIds[ContextIdKeys.Organization]);
|
|
996
|
+
return {
|
|
997
|
+
statusCode: HttpStatusCode.noContent
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Remove an identity alias.
|
|
1002
|
+
* @param httpRequestContext The request context for the API.
|
|
1003
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
1004
|
+
* @param request The request.
|
|
1005
|
+
* @returns The response object with additional http response properties.
|
|
1006
|
+
*/
|
|
1007
|
+
export async function identityAlsoKnownAsRemove(httpRequestContext, componentName, request) {
|
|
1008
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1009
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1010
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.identity", request.pathParams.identity);
|
|
1011
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.alias", request.pathParams.alias);
|
|
1012
|
+
const contextIds = await ContextIdStore.getContextIds();
|
|
1013
|
+
ContextIdHelper.guard(contextIds, ContextIdKeys.Organization);
|
|
1014
|
+
const component = ComponentFactory.get(componentName);
|
|
1015
|
+
await component.alsoKnownAsRemove(request.pathParams.identity, request.pathParams.alias, contextIds[ContextIdKeys.Organization]);
|
|
1016
|
+
return {
|
|
1017
|
+
statusCode: HttpStatusCode.noContent
|
|
1018
|
+
};
|
|
1019
|
+
}
|
|
788
1020
|
/**
|
|
789
1021
|
* Create a verifiable credential.
|
|
790
1022
|
* @param httpRequestContext The request context for the API.
|
|
@@ -802,7 +1034,9 @@ export async function identityVerifiableCredentialCreate(httpRequestContext, com
|
|
|
802
1034
|
const component = ComponentFactory.get(componentName);
|
|
803
1035
|
const result = await component.verifiableCredentialCreate(DocumentHelper.joinId(request.pathParams.identity, request.pathParams.verificationMethodId), request.body.credentialId, request.body.subject, {
|
|
804
1036
|
revocationIndex: request.body.revocationIndex,
|
|
805
|
-
expirationDate: Coerce.
|
|
1037
|
+
expirationDate: Coerce.dateTime(request.body.expirationDate),
|
|
1038
|
+
jwtHeaderFields: request.body.jwtHeaderFields,
|
|
1039
|
+
jwtPayloadFields: request.body.jwtPayloadFields
|
|
806
1040
|
}, contextIds[ContextIdKeys.Organization]);
|
|
807
1041
|
return {
|
|
808
1042
|
body: result
|
|
@@ -818,9 +1052,25 @@ export async function identityVerifiableCredentialCreate(httpRequestContext, com
|
|
|
818
1052
|
export async function identityVerifiableCredentialVerify(httpRequestContext, componentName, request) {
|
|
819
1053
|
Guards.object(ROUTES_SOURCE, "request", request);
|
|
820
1054
|
Guards.object(ROUTES_SOURCE, "request.query", request.query);
|
|
821
|
-
Guards.stringValue(ROUTES_SOURCE, "request.query.jwt", request.query.jwt);
|
|
822
1055
|
const component = ComponentFactory.get(componentName);
|
|
823
|
-
const result = await component.verifiableCredentialVerify(request.query
|
|
1056
|
+
const result = await component.verifiableCredentialVerify(request.query?.jwt);
|
|
1057
|
+
return {
|
|
1058
|
+
body: result
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Verify a verifiable credential document.
|
|
1063
|
+
* @param httpRequestContext The request context for the API.
|
|
1064
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
1065
|
+
* @param request The request.
|
|
1066
|
+
* @returns The response object with additional http response properties.
|
|
1067
|
+
*/
|
|
1068
|
+
export async function identityVerifiableCredentialVerifyDocument(httpRequestContext, componentName, request) {
|
|
1069
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1070
|
+
Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
1071
|
+
Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
1072
|
+
const component = ComponentFactory.get(componentName);
|
|
1073
|
+
const result = await component.verifiableCredentialVerify(request.body);
|
|
824
1074
|
return {
|
|
825
1075
|
body: result
|
|
826
1076
|
};
|
|
@@ -882,7 +1132,11 @@ export async function identityVerifiablePresentationCreate(httpRequestContext, c
|
|
|
882
1132
|
const contextIds = await ContextIdStore.getContextIds();
|
|
883
1133
|
ContextIdHelper.guard(contextIds, ContextIdKeys.Organization);
|
|
884
1134
|
const component = ComponentFactory.get(componentName);
|
|
885
|
-
const result = await component.verifiablePresentationCreate(DocumentHelper.joinId(request.pathParams.identity, request.pathParams.verificationMethodId), request.body.presentationId, request.body.contexts, request.body.types, request.body.verifiableCredentials,
|
|
1135
|
+
const result = await component.verifiablePresentationCreate(DocumentHelper.joinId(request.pathParams.identity, request.pathParams.verificationMethodId), request.body.presentationId, request.body.contexts, request.body.types, request.body.verifiableCredentials, {
|
|
1136
|
+
expirationDate: Coerce.dateTime(request.body.expirationDate),
|
|
1137
|
+
jwtHeaderFields: request.body.jwtHeaderFields,
|
|
1138
|
+
jwtPayloadFields: request.body.jwtPayloadFields
|
|
1139
|
+
}, contextIds[ContextIdKeys.Organization]);
|
|
886
1140
|
return {
|
|
887
1141
|
body: result
|
|
888
1142
|
};
|
|
@@ -904,6 +1158,22 @@ export async function identityVerifiablePresentationVerify(httpRequestContext, c
|
|
|
904
1158
|
body: result
|
|
905
1159
|
};
|
|
906
1160
|
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Verify a verifiable presentation document.
|
|
1163
|
+
* @param httpRequestContext The request context for the API.
|
|
1164
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
1165
|
+
* @param request The request.
|
|
1166
|
+
* @returns The response object with additional http response properties.
|
|
1167
|
+
*/
|
|
1168
|
+
export async function identityVerifiablePresentationVerifyDocument(httpRequestContext, componentName, request) {
|
|
1169
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1170
|
+
Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
1171
|
+
const component = ComponentFactory.get(componentName);
|
|
1172
|
+
const result = await component.verifiablePresentationVerify(request.body);
|
|
1173
|
+
return {
|
|
1174
|
+
body: result
|
|
1175
|
+
};
|
|
1176
|
+
}
|
|
907
1177
|
/**
|
|
908
1178
|
* Create an identity proof.
|
|
909
1179
|
* @param httpRequestContext The request context for the API.
|
|
@@ -920,7 +1190,7 @@ export async function identityProofCreate(httpRequestContext, componentName, req
|
|
|
920
1190
|
const contextIds = await ContextIdStore.getContextIds();
|
|
921
1191
|
ContextIdHelper.guard(contextIds, ContextIdKeys.Organization);
|
|
922
1192
|
const component = ComponentFactory.get(componentName);
|
|
923
|
-
const result = await component.proofCreate(request.pathParams.identity, request.body.proofType, request.body.document, contextIds[ContextIdKeys.Organization]);
|
|
1193
|
+
const result = await component.proofCreate(DocumentHelper.joinId(request.pathParams.identity, request.pathParams.verificationMethodId), request.body.proofType, request.body.document, contextIds[ContextIdKeys.Organization]);
|
|
924
1194
|
return {
|
|
925
1195
|
body: result
|
|
926
1196
|
};
|