@twin.org/identity-models 0.0.1-next.4 → 0.0.1-next.41

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.
Files changed (82) hide show
  1. package/dist/cjs/index.cjs +150 -21
  2. package/dist/esm/index.mjs +150 -22
  3. package/dist/types/factories/identityResolverConnectorFactory.d.ts +6 -0
  4. package/dist/types/index.d.ts +36 -11
  5. package/dist/types/models/IIdentityComponent.d.ts +127 -5
  6. package/dist/types/models/IIdentityConnector.d.ts +21 -32
  7. package/dist/types/models/IIdentityResolverComponent.d.ts +13 -0
  8. package/dist/types/models/IIdentityResolverConnector.d.ts +14 -0
  9. package/dist/types/models/api/identity/IIdentityCreateRequest.d.ts +14 -0
  10. package/dist/types/models/api/identity/IIdentityCreateResponse.d.ts +10 -0
  11. package/dist/types/models/api/identity/IIdentityProofCreateRequest.d.ts +33 -0
  12. package/dist/types/models/api/identity/IIdentityProofCreateResponse.d.ts +10 -0
  13. package/dist/types/models/api/identity/IIdentityProofVerifyRequest.d.ts +20 -0
  14. package/dist/types/models/api/identity/IIdentityProofVerifyResponse.d.ts +11 -0
  15. package/dist/types/models/api/identity/IIdentityServiceCreateRequest.d.ts +31 -0
  16. package/dist/types/models/api/identity/IIdentityServiceCreateResponse.d.ts +10 -0
  17. package/dist/types/models/api/identity/IIdentityServiceRemoveRequest.d.ts +18 -0
  18. package/dist/types/models/api/identity/IIdentityVerifiableCredentialCreateRequest.d.ts +36 -0
  19. package/dist/types/models/api/identity/IIdentityVerifiableCredentialCreateResponse.d.ts +19 -0
  20. package/dist/types/models/api/identity/IIdentityVerifiableCredentialRevokeRequest.d.ts +18 -0
  21. package/dist/types/models/api/identity/IIdentityVerifiableCredentialUnrevokeRequest.d.ts +18 -0
  22. package/dist/types/models/api/identity/IIdentityVerifiableCredentialVerifyRequest.d.ts +14 -0
  23. package/dist/types/models/api/identity/IIdentityVerifiableCredentialVerifyResponse.d.ts +19 -0
  24. package/dist/types/models/api/identity/IIdentityVerifiablePresentationCreateRequest.d.ts +45 -0
  25. package/dist/types/models/api/identity/IIdentityVerifiablePresentationCreateResponse.d.ts +19 -0
  26. package/dist/types/models/api/identity/IIdentityVerifiablePresentationVerifyRequest.d.ts +14 -0
  27. package/dist/types/models/api/identity/IIdentityVerifiablePresentationVerifyResponse.d.ts +23 -0
  28. package/dist/types/models/api/identity/IIdentityVerificationMethodCreateRequest.d.ts +28 -0
  29. package/dist/types/models/api/identity/IIdentityVerificationMethodCreateResponse.d.ts +10 -0
  30. package/dist/types/models/api/identity/IIdentityVerificationMethodRemoveRequest.d.ts +18 -0
  31. package/dist/types/models/api/{IIdentityResolveRequest.d.ts → resolver/IIdentityResolveRequest.d.ts} +2 -2
  32. package/dist/types/utils/documentHelper.d.ts +33 -2
  33. package/dist/types/utils/verificationHelper.d.ts +29 -0
  34. package/docs/changelog.md +17 -1
  35. package/docs/reference/classes/DocumentHelper.md +119 -5
  36. package/docs/reference/classes/VerificationHelper.md +83 -0
  37. package/docs/reference/index.md +26 -5
  38. package/docs/reference/interfaces/IIdentityComponent.md +472 -6
  39. package/docs/reference/interfaces/IIdentityConnector.md +137 -141
  40. package/docs/reference/interfaces/IIdentityCreateRequest.md +17 -0
  41. package/docs/reference/interfaces/IIdentityCreateResponse.md +11 -0
  42. package/docs/reference/interfaces/IIdentityProfileComponent.md +52 -44
  43. package/docs/reference/interfaces/IIdentityProfileConnector.md +52 -40
  44. package/docs/reference/interfaces/IIdentityProfileGetPublicResponse.md +2 -2
  45. package/docs/reference/interfaces/IIdentityProofCreateRequest.md +43 -0
  46. package/docs/reference/interfaces/IIdentityProofCreateResponse.md +11 -0
  47. package/docs/reference/interfaces/IIdentityProofVerifyRequest.md +23 -0
  48. package/docs/reference/interfaces/IIdentityProofVerifyResponse.md +15 -0
  49. package/docs/reference/interfaces/IIdentityResolveRequest.md +3 -3
  50. package/docs/reference/interfaces/IIdentityResolverComponent.md +29 -0
  51. package/docs/reference/interfaces/IIdentityResolverConnector.md +33 -0
  52. package/docs/reference/interfaces/IIdentityServiceCreateRequest.md +43 -0
  53. package/docs/reference/interfaces/IIdentityServiceCreateResponse.md +11 -0
  54. package/docs/reference/interfaces/IIdentityServiceRemoveRequest.md +23 -0
  55. package/docs/reference/interfaces/IIdentityVerifiableCredentialCreateRequest.md +49 -0
  56. package/docs/reference/interfaces/IIdentityVerifiableCredentialCreateResponse.md +23 -0
  57. package/docs/reference/interfaces/IIdentityVerifiableCredentialRevokeRequest.md +23 -0
  58. package/docs/reference/interfaces/IIdentityVerifiableCredentialUnrevokeRequest.md +23 -0
  59. package/docs/reference/interfaces/IIdentityVerifiableCredentialVerifyRequest.md +17 -0
  60. package/docs/reference/interfaces/IIdentityVerifiableCredentialVerifyResponse.md +23 -0
  61. package/docs/reference/interfaces/IIdentityVerifiablePresentationCreateRequest.md +61 -0
  62. package/docs/reference/interfaces/IIdentityVerifiablePresentationCreateResponse.md +23 -0
  63. package/docs/reference/interfaces/IIdentityVerifiablePresentationVerifyRequest.md +17 -0
  64. package/docs/reference/interfaces/IIdentityVerifiablePresentationVerifyResponse.md +29 -0
  65. package/docs/reference/interfaces/IIdentityVerificationMethodCreateRequest.md +37 -0
  66. package/docs/reference/interfaces/IIdentityVerificationMethodCreateResponse.md +11 -0
  67. package/docs/reference/interfaces/IIdentityVerificationMethodRemoveRequest.md +23 -0
  68. package/docs/reference/variables/IdentityResolverConnectorFactory.md +5 -0
  69. package/locales/en.json +10 -4
  70. package/package.json +4 -4
  71. package/dist/types/models/identityRole.d.ts +0 -21
  72. package/docs/reference/type-aliases/IdentityRole.md +0 -5
  73. package/docs/reference/variables/IdentityRole.md +0 -25
  74. /package/dist/types/models/api/{IIdentityProfileCreateRequest.d.ts → profile/IIdentityProfileCreateRequest.d.ts} +0 -0
  75. /package/dist/types/models/api/{IIdentityProfileGetPublicRequest.d.ts → profile/IIdentityProfileGetPublicRequest.d.ts} +0 -0
  76. /package/dist/types/models/api/{IIdentityProfileGetPublicResponse.d.ts → profile/IIdentityProfileGetPublicResponse.d.ts} +0 -0
  77. /package/dist/types/models/api/{IIdentityProfileGetRequest.d.ts → profile/IIdentityProfileGetRequest.d.ts} +0 -0
  78. /package/dist/types/models/api/{IIdentityProfileGetResponse.d.ts → profile/IIdentityProfileGetResponse.d.ts} +0 -0
  79. /package/dist/types/models/api/{IIdentityProfileListRequest.d.ts → profile/IIdentityProfileListRequest.d.ts} +0 -0
  80. /package/dist/types/models/api/{IIdentityProfileListResponse.d.ts → profile/IIdentityProfileListResponse.d.ts} +0 -0
  81. /package/dist/types/models/api/{IIdentityProfileUpdateRequest.d.ts → profile/IIdentityProfileUpdateRequest.d.ts} +0 -0
  82. /package/dist/types/models/api/{IIdentityResolveResponse.d.ts → resolver/IIdentityResolveResponse.d.ts} +0 -0
@@ -1,5 +1,6 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
- import type { DidVerificationMethodType, IDidDocument, IDidDocumentVerificationMethod, IDidService, IDidVerifiableCredential, IDidVerifiablePresentation } from "@twin.org/standards-w3c-did";
2
+ import type { IJsonLdContextDefinitionRoot, IJsonLdNodeObject } from "@twin.org/data-json-ld";
3
+ import type { DidVerificationMethodType, IDidDocument, IDidDocumentVerificationMethod, IProof, IDidService, IDidVerifiableCredential, IDidVerifiablePresentation, ProofTypes } from "@twin.org/standards-w3c-did";
3
4
  /**
4
5
  * Interface describing an identity connector.
5
6
  */
@@ -10,13 +11,6 @@ export interface IIdentityConnector extends IComponent {
10
11
  * @returns The created document.
11
12
  */
12
13
  createDocument(controller: string): Promise<IDidDocument>;
13
- /**
14
- * Resolve a document from its id.
15
- * @param documentId The id of the document to resolve.
16
- * @returns The resolved document.
17
- * @throws NotFoundError if the id can not be resolved.
18
- */
19
- resolveDocument(documentId: string): Promise<IDidDocument>;
20
14
  /**
21
15
  * Add a verification method to the document in JSON Web key Format.
22
16
  * @param controller The controller of the identity who can make changes.
@@ -47,7 +41,7 @@ export interface IIdentityConnector extends IComponent {
47
41
  * @returns The service.
48
42
  * @throws NotFoundError if the id can not be resolved.
49
43
  */
50
- addService(controller: string, documentId: string, serviceId: string, serviceType: string, serviceEndpoint: string): Promise<IDidService>;
44
+ addService(controller: string, documentId: string, serviceId: string, serviceType: string | string[], serviceEndpoint: string | string[]): Promise<IDidService>;
51
45
  /**
52
46
  * Remove a service from the document.
53
47
  * @param controller The controller of the identity who can make changes.
@@ -60,16 +54,14 @@ export interface IIdentityConnector extends IComponent {
60
54
  * Create a verifiable credential for a verification method.
61
55
  * @param controller The controller of the identity who can make changes.
62
56
  * @param verificationMethodId The verification method id to use.
63
- * @param credentialId The id of the credential.
64
- * @param types The type for the data stored in the verifiable credential.
65
- * @param subject The subject data to store for the credential.
66
- * @param contexts Additional contexts to include in the credential.
57
+ * @param id The id of the credential.
58
+ * @param subject The credential subject to store in the verifiable credential.
67
59
  * @param revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.
68
60
  * @returns The created verifiable credential and its token.
69
61
  * @throws NotFoundError if the id can not be resolved.
70
62
  */
71
- createVerifiableCredential<T>(controller: string, verificationMethodId: string, credentialId: string | undefined, types: string | string[] | undefined, subject: T | T[], contexts?: string | string[], revocationIndex?: number): Promise<{
72
- verifiableCredential: IDidVerifiableCredential<T>;
63
+ createVerifiableCredential(controller: string, verificationMethodId: string, id: string | undefined, subject: IJsonLdNodeObject, revocationIndex?: number): Promise<{
64
+ verifiableCredential: IDidVerifiableCredential;
73
65
  jwt: string;
74
66
  }>;
75
67
  /**
@@ -77,9 +69,9 @@ export interface IIdentityConnector extends IComponent {
77
69
  * @param credentialJwt The credential to verify.
78
70
  * @returns The credential stored in the jwt and the revocation status.
79
71
  */
80
- checkVerifiableCredential<T>(credentialJwt: string): Promise<{
72
+ checkVerifiableCredential(credentialJwt: string): Promise<{
81
73
  revoked: boolean;
82
- verifiableCredential?: IDidVerifiableCredential<T>;
74
+ verifiableCredential?: IDidVerifiableCredential;
83
75
  }>;
84
76
  /**
85
77
  * Revoke verifiable credential(s).
@@ -100,15 +92,16 @@ export interface IIdentityConnector extends IComponent {
100
92
  /**
101
93
  * Create a verifiable presentation from the supplied verifiable credentials.
102
94
  * @param controller The controller of the identity who can make changes.
103
- * @param presentationMethodId The method to associate with the presentation.
95
+ * @param verificationMethodId The method to associate with the presentation.
96
+ * @param presentationId The id of the presentation.
97
+ * @param contexts The contexts for the data stored in the verifiable credential.
104
98
  * @param types The types for the data stored in the verifiable credential.
105
99
  * @param verifiableCredentials The credentials to use for creating the presentation in jwt format.
106
- * @param contexts Additional contexts to include in the presentation.
107
100
  * @param expiresInMinutes The time in minutes for the presentation to expire.
108
101
  * @returns The created verifiable presentation and its token.
109
102
  * @throws NotFoundError if the id can not be resolved.
110
103
  */
111
- createVerifiablePresentation(controller: string, presentationMethodId: string, types: string | string[] | undefined, verifiableCredentials: string[], contexts?: string | string[], expiresInMinutes?: number): Promise<{
104
+ createVerifiablePresentation(controller: string, verificationMethodId: string, presentationId: string | undefined, contexts: IJsonLdContextDefinitionRoot | undefined, types: string | string[] | undefined, verifiableCredentials: (string | IDidVerifiableCredential)[], expiresInMinutes?: number): Promise<{
112
105
  verifiablePresentation: IDidVerifiablePresentation;
113
106
  jwt: string;
114
107
  }>;
@@ -126,20 +119,16 @@ export interface IIdentityConnector extends IComponent {
126
119
  * Create a proof for arbitrary data with the specified verification method.
127
120
  * @param controller The controller of the identity who can make changes.
128
121
  * @param verificationMethodId The verification method id to use.
129
- * @param bytes The data bytes to sign.
130
- * @returns The proof signature type and value.
122
+ * @param proofType The type of proof to create.
123
+ * @param unsecureDocument The unsecure document to create the proof for.
124
+ * @returns The proof.
131
125
  */
132
- createProof(controller: string, verificationMethodId: string, bytes: Uint8Array): Promise<{
133
- type: string;
134
- value: Uint8Array;
135
- }>;
126
+ createProof(controller: string, verificationMethodId: string, proofType: ProofTypes, unsecureDocument: IJsonLdNodeObject): Promise<IProof>;
136
127
  /**
137
128
  * Verify proof for arbitrary data with the specified verification method.
138
- * @param verificationMethodId The verification method id to use.
139
- * @param bytes The data bytes to verify.
140
- * @param signatureType The type of the signature for the proof.
141
- * @param signatureValue The value of the signature for the proof.
142
- * @returns True if the signature is valid.
129
+ * @param document The document to verify.
130
+ * @param proof The proof to verify.
131
+ * @returns True if the proof is verified.
143
132
  */
144
- verifyProof(verificationMethodId: string, bytes: Uint8Array, signatureType: string, signatureValue: Uint8Array): Promise<boolean>;
133
+ verifyProof(document: IJsonLdNodeObject, proof: IProof): Promise<boolean>;
145
134
  }
@@ -0,0 +1,13 @@
1
+ import type { IComponent } from "@twin.org/core";
2
+ import type { IDidDocument } from "@twin.org/standards-w3c-did";
3
+ /**
4
+ * Interface describing a contract which provides identity operations.
5
+ */
6
+ export interface IIdentityResolverComponent extends IComponent {
7
+ /**
8
+ * Resolve an identity.
9
+ * @param identity The id of the document to resolve.
10
+ * @returns The resolved document.
11
+ */
12
+ identityResolve(identity: string): Promise<IDidDocument>;
13
+ }
@@ -0,0 +1,14 @@
1
+ import type { IComponent } from "@twin.org/core";
2
+ import type { IDidDocument } from "@twin.org/standards-w3c-did";
3
+ /**
4
+ * Interface describing an identity connector.
5
+ */
6
+ export interface IIdentityResolverConnector extends IComponent {
7
+ /**
8
+ * Resolve a document from its id.
9
+ * @param documentId The id of the document to resolve.
10
+ * @returns The resolved document.
11
+ * @throws NotFoundError if the id can not be resolved.
12
+ */
13
+ resolveDocument(documentId: string): Promise<IDidDocument>;
14
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Request to create an identity.
3
+ */
4
+ export interface IIdentityCreateRequest {
5
+ /**
6
+ * The data for the request.
7
+ */
8
+ body?: {
9
+ /**
10
+ * The optional namespace to create the identity in.
11
+ */
12
+ namespace?: string;
13
+ };
14
+ }
@@ -0,0 +1,10 @@
1
+ import type { IDidDocument } from "@twin.org/standards-w3c-did";
2
+ /**
3
+ * Response to creating an identity.
4
+ */
5
+ export interface IIdentityCreateResponse {
6
+ /**
7
+ * The response payload.
8
+ */
9
+ body: IDidDocument;
10
+ }
@@ -0,0 +1,33 @@
1
+ import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import type { ProofTypes } from "@twin.org/standards-w3c-did";
3
+ /**
4
+ * Request to create a proof.
5
+ */
6
+ export interface IIdentityProofCreateRequest {
7
+ /**
8
+ * The path parameters.
9
+ */
10
+ pathParams: {
11
+ /**
12
+ * The identity to create the proof for.
13
+ */
14
+ identity: string;
15
+ /**
16
+ * The verification method id to use.
17
+ */
18
+ verificationMethodId: string;
19
+ };
20
+ /**
21
+ * The data for the request.
22
+ */
23
+ body: {
24
+ /**
25
+ * The type of proof to create.
26
+ */
27
+ proofType: ProofTypes;
28
+ /**
29
+ * The document to create the proof for.
30
+ */
31
+ document: IJsonLdNodeObject;
32
+ };
33
+ }
@@ -0,0 +1,10 @@
1
+ import type { IProof } from "@twin.org/standards-w3c-did";
2
+ /**
3
+ * Response to creating a proof.
4
+ */
5
+ export interface IIdentityProofCreateResponse {
6
+ /**
7
+ * The response payload.
8
+ */
9
+ body: IProof;
10
+ }
@@ -0,0 +1,20 @@
1
+ import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import type { IProof } from "@twin.org/standards-w3c-did";
3
+ /**
4
+ * Request to verify a proof.
5
+ */
6
+ export interface IIdentityProofVerifyRequest {
7
+ /**
8
+ * The data for the request.
9
+ */
10
+ body: {
11
+ /**
12
+ * The document to verify the proof for.
13
+ */
14
+ document: IJsonLdNodeObject;
15
+ /**
16
+ * The proof to verify.
17
+ */
18
+ proof: IProof;
19
+ };
20
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Response to verifying a proof.
3
+ */
4
+ export interface IIdentityProofVerifyResponse {
5
+ /**
6
+ * The response payload.
7
+ */
8
+ body: {
9
+ verified: boolean;
10
+ };
11
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Request to create a service.
3
+ */
4
+ export interface IIdentityServiceCreateRequest {
5
+ /**
6
+ * The path parameters.
7
+ */
8
+ pathParams: {
9
+ /**
10
+ * The identity to create the service for.
11
+ */
12
+ identity: string;
13
+ };
14
+ /**
15
+ * The data for the request.
16
+ */
17
+ body: {
18
+ /**
19
+ * The id of the service.
20
+ */
21
+ serviceId: string;
22
+ /**
23
+ * The type of the service.
24
+ */
25
+ type: string | string[];
26
+ /**
27
+ * The endpoint for the service.
28
+ */
29
+ endpoint: string | string[];
30
+ };
31
+ }
@@ -0,0 +1,10 @@
1
+ import type { IDidService } from "@twin.org/standards-w3c-did";
2
+ /**
3
+ * Response to creating a service.
4
+ */
5
+ export interface IIdentityServiceCreateResponse {
6
+ /**
7
+ * The response payload.
8
+ */
9
+ body: IDidService;
10
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Request to remove a service.
3
+ */
4
+ export interface IIdentityServiceRemoveRequest {
5
+ /**
6
+ * The path parameters.
7
+ */
8
+ pathParams: {
9
+ /**
10
+ * The identity to remove the service from.
11
+ */
12
+ identity: string;
13
+ /**
14
+ * The service to remove.
15
+ */
16
+ serviceId: string;
17
+ };
18
+ }
@@ -0,0 +1,36 @@
1
+ import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ /**
3
+ * Request to create a verifiable credential.
4
+ */
5
+ export interface IIdentityVerifiableCredentialCreateRequest {
6
+ /**
7
+ * The path parameters.
8
+ */
9
+ pathParams: {
10
+ /**
11
+ * The identity to create the verification credential for.
12
+ */
13
+ identity: string;
14
+ /**
15
+ * The verification method id to use.
16
+ */
17
+ verificationMethodId: string;
18
+ };
19
+ /**
20
+ * The data for the request.
21
+ */
22
+ body: {
23
+ /**
24
+ * The id of the credential.
25
+ */
26
+ credentialId?: string;
27
+ /**
28
+ * The credential subject to store in the verifiable credential.
29
+ */
30
+ subject: IJsonLdNodeObject;
31
+ /**
32
+ * The bitmap revocation index of the credential, if undefined will not have revocation status.
33
+ */
34
+ revocationIndex?: number;
35
+ };
36
+ }
@@ -0,0 +1,19 @@
1
+ import type { IDidVerifiableCredential } from "@twin.org/standards-w3c-did";
2
+ /**
3
+ * Response to creating a verifiable credential.
4
+ */
5
+ export interface IIdentityVerifiableCredentialCreateResponse {
6
+ /**
7
+ * The response payload.
8
+ */
9
+ body: {
10
+ /**
11
+ * The verifiable credential that was created.
12
+ */
13
+ verifiableCredential: IDidVerifiableCredential;
14
+ /**
15
+ * The JWT token for the verifiable credential.
16
+ */
17
+ jwt: string;
18
+ };
19
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Request to revoke a verifiable credential.
3
+ */
4
+ export interface IIdentityVerifiableCredentialRevokeRequest {
5
+ /**
6
+ * The path parameters.
7
+ */
8
+ pathParams: {
9
+ /**
10
+ * The identity to revoke the verification credential for.
11
+ */
12
+ identity: string;
13
+ /**
14
+ * The revocation index to revoke.
15
+ */
16
+ revocationIndex: number;
17
+ };
18
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Request to unrevoke a verifiable credential.
3
+ */
4
+ export interface IIdentityVerifiableCredentialUnrevokeRequest {
5
+ /**
6
+ * The path parameters.
7
+ */
8
+ pathParams: {
9
+ /**
10
+ * The identity to unrevoke the verification credential for.
11
+ */
12
+ identity: string;
13
+ /**
14
+ * The revocation index to unrevoke.
15
+ */
16
+ revocationIndex: number;
17
+ };
18
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Request to verify a verifiable credential.
3
+ */
4
+ export interface IIdentityVerifiableCredentialVerifyRequest {
5
+ /**
6
+ * The path parameters.
7
+ */
8
+ query: {
9
+ /**
10
+ * The jwt to verify.
11
+ */
12
+ jwt: string;
13
+ };
14
+ }
@@ -0,0 +1,19 @@
1
+ import type { IDidVerifiableCredential } from "@twin.org/standards-w3c-did";
2
+ /**
3
+ * Response to verifying a verifiable credential.
4
+ */
5
+ export interface IIdentityVerifiableCredentialVerifyResponse {
6
+ /**
7
+ * The response payload.
8
+ */
9
+ body: {
10
+ /**
11
+ * Has the credential been revoked.
12
+ */
13
+ revoked: boolean;
14
+ /**
15
+ * The verifiable credential that was verified.
16
+ */
17
+ verifiableCredential?: IDidVerifiableCredential;
18
+ };
19
+ }
@@ -0,0 +1,45 @@
1
+ import type { IJsonLdContextDefinitionRoot } from "@twin.org/data-json-ld";
2
+ import type { IDidVerifiableCredential } from "@twin.org/standards-w3c-did";
3
+ /**
4
+ * Request to create a verifiable presentation.
5
+ */
6
+ export interface IIdentityVerifiablePresentationCreateRequest {
7
+ /**
8
+ * The path parameters.
9
+ */
10
+ pathParams: {
11
+ /**
12
+ * The identity to create the verification presentation for.
13
+ */
14
+ identity: string;
15
+ /**
16
+ * The verification method id to use.
17
+ */
18
+ verificationMethodId: string;
19
+ };
20
+ /**
21
+ * The data for the request.
22
+ */
23
+ body: {
24
+ /**
25
+ * The id of the presentation.
26
+ */
27
+ presentationId?: string;
28
+ /**
29
+ * The context to use for the presentation.
30
+ */
31
+ contexts?: IJsonLdContextDefinitionRoot;
32
+ /**
33
+ * The types of the presentation.
34
+ */
35
+ types?: string | string[];
36
+ /**
37
+ * The verifiable credentials to include in the presentation.
38
+ */
39
+ verifiableCredentials: (string | IDidVerifiableCredential)[];
40
+ /**
41
+ * The expiration time for the presentation.
42
+ */
43
+ expiresInMinutes?: number;
44
+ };
45
+ }
@@ -0,0 +1,19 @@
1
+ import type { IDidVerifiablePresentation } from "@twin.org/standards-w3c-did";
2
+ /**
3
+ * Response to creating a verifiable presentation.
4
+ */
5
+ export interface IIdentityVerifiablePresentationCreateResponse {
6
+ /**
7
+ * The response payload.
8
+ */
9
+ body: {
10
+ /**
11
+ * The verifiable presentation that was created.
12
+ */
13
+ verifiablePresentation: IDidVerifiablePresentation;
14
+ /**
15
+ * The JWT token for the verifiable presentation.
16
+ */
17
+ jwt: string;
18
+ };
19
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Request to verify a verifiable presentation.
3
+ */
4
+ export interface IIdentityVerifiablePresentationVerifyRequest {
5
+ /**
6
+ * The path parameters.
7
+ */
8
+ query: {
9
+ /**
10
+ * The jwt to verify.
11
+ */
12
+ jwt: string;
13
+ };
14
+ }
@@ -0,0 +1,23 @@
1
+ import type { IDidDocument, IDidVerifiablePresentation } from "@twin.org/standards-w3c-did";
2
+ /**
3
+ * Response to verifying a verifiable presentation.
4
+ */
5
+ export interface IIdentityVerifiablePresentationVerifyResponse {
6
+ /**
7
+ * The response payload.
8
+ */
9
+ body: {
10
+ /**
11
+ * Has the presentation been revoked.
12
+ */
13
+ revoked: boolean;
14
+ /**
15
+ * The verifiable presentation that was verified.
16
+ */
17
+ verifiablePresentation?: IDidVerifiablePresentation;
18
+ /**
19
+ * The issuers of the presentation.
20
+ */
21
+ issuers?: IDidDocument[];
22
+ };
23
+ }
@@ -0,0 +1,28 @@
1
+ import type { DidVerificationMethodType } from "@twin.org/standards-w3c-did";
2
+ /**
3
+ * Request to create a verification method.
4
+ */
5
+ export interface IIdentityVerificationMethodCreateRequest {
6
+ /**
7
+ * The path parameters.
8
+ */
9
+ pathParams: {
10
+ /**
11
+ * The identity to create the verification method for.
12
+ */
13
+ identity: string;
14
+ };
15
+ /**
16
+ * The data for the request.
17
+ */
18
+ body: {
19
+ /**
20
+ * The type of the verification method to create.
21
+ */
22
+ verificationMethodType: DidVerificationMethodType;
23
+ /**
24
+ * The optional id for the verification method, will be allocated if not supplied.
25
+ */
26
+ verificationMethodId?: string;
27
+ };
28
+ }
@@ -0,0 +1,10 @@
1
+ import type { IDidDocumentVerificationMethod } from "@twin.org/standards-w3c-did";
2
+ /**
3
+ * Response to creating a verification method.
4
+ */
5
+ export interface IIdentityVerificationMethodCreateResponse {
6
+ /**
7
+ * The response payload.
8
+ */
9
+ body: IDidDocumentVerificationMethod;
10
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Request to remove a verification method.
3
+ */
4
+ export interface IIdentityVerificationMethodRemoveRequest {
5
+ /**
6
+ * The path parameters.
7
+ */
8
+ pathParams: {
9
+ /**
10
+ * The identity to remove the verification method from.
11
+ */
12
+ identity: string;
13
+ /**
14
+ * The verification method to remove.
15
+ */
16
+ verificationMethodId: string;
17
+ };
18
+ }
@@ -7,8 +7,8 @@ export interface IIdentityResolveRequest {
7
7
  */
8
8
  pathParams: {
9
9
  /**
10
- * The identity to get the document for.
10
+ * The identity to resolve.
11
11
  */
12
- id: string;
12
+ identity: string;
13
13
  };
14
14
  }