@twin.org/identity-models 0.0.1-next.8 → 0.0.1

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