@twin.org/identity-models 0.0.1-next.23 → 0.0.1-next.24

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 (58) hide show
  1. package/dist/cjs/index.cjs +29 -5
  2. package/dist/esm/index.mjs +29 -5
  3. package/dist/types/index.d.ts +22 -0
  4. package/dist/types/models/IIdentityComponent.d.ts +22 -22
  5. package/dist/types/models/IIdentityConnector.d.ts +5 -5
  6. package/dist/types/models/api/identity/IIdentityCreateRequest.d.ts +14 -0
  7. package/dist/types/models/api/identity/IIdentityCreateResponse.d.ts +10 -0
  8. package/dist/types/models/api/identity/IIdentityProofCreateRequest.d.ts +27 -0
  9. package/dist/types/models/api/identity/IIdentityProofCreateResponse.d.ts +10 -0
  10. package/dist/types/models/api/identity/IIdentityProofVerifyRequest.d.ts +19 -0
  11. package/dist/types/models/api/identity/IIdentityProofVerifyResponse.d.ts +11 -0
  12. package/dist/types/models/api/identity/IIdentityServiceCreateRequest.d.ts +31 -0
  13. package/dist/types/models/api/identity/IIdentityServiceCreateResponse.d.ts +10 -0
  14. package/dist/types/models/api/identity/IIdentityServiceRemoveRequest.d.ts +18 -0
  15. package/dist/types/models/api/identity/IIdentityVerifiableCredentialCreateRequest.d.ts +36 -0
  16. package/dist/types/models/api/identity/IIdentityVerifiableCredentialCreateResponse.d.ts +19 -0
  17. package/dist/types/models/api/identity/IIdentityVerifiableCredentialRevokeRequest.d.ts +18 -0
  18. package/dist/types/models/api/identity/IIdentityVerifiableCredentialUnrevokeRequest.d.ts +18 -0
  19. package/dist/types/models/api/identity/IIdentityVerifiableCredentialVerifyRequest.d.ts +14 -0
  20. package/dist/types/models/api/identity/IIdentityVerifiableCredentialVerifyResponse.d.ts +19 -0
  21. package/dist/types/models/api/identity/IIdentityVerifiablePresentationCreateRequest.d.ts +45 -0
  22. package/dist/types/models/api/identity/IIdentityVerifiablePresentationCreateResponse.d.ts +19 -0
  23. package/dist/types/models/api/identity/IIdentityVerifiablePresentationVerifyRequest.d.ts +14 -0
  24. package/dist/types/models/api/identity/IIdentityVerifiablePresentationVerifyResponse.d.ts +23 -0
  25. package/dist/types/models/api/identity/IIdentityVerificationMethodCreateRequest.d.ts +28 -0
  26. package/dist/types/models/api/identity/IIdentityVerificationMethodCreateResponse.d.ts +10 -0
  27. package/dist/types/models/api/identity/IIdentityVerificationMethodRemoveRequest.d.ts +18 -0
  28. package/dist/types/models/api/resolver/IIdentityResolveRequest.d.ts +1 -1
  29. package/dist/types/utils/documentHelper.d.ts +9 -2
  30. package/docs/changelog.md +1 -1
  31. package/docs/reference/classes/DocumentHelper.md +32 -4
  32. package/docs/reference/index.md +22 -0
  33. package/docs/reference/interfaces/IIdentityComponent.md +70 -70
  34. package/docs/reference/interfaces/IIdentityConnector.md +9 -9
  35. package/docs/reference/interfaces/IIdentityCreateRequest.md +17 -0
  36. package/docs/reference/interfaces/IIdentityCreateResponse.md +11 -0
  37. package/docs/reference/interfaces/IIdentityProofCreateRequest.md +37 -0
  38. package/docs/reference/interfaces/IIdentityProofCreateResponse.md +11 -0
  39. package/docs/reference/interfaces/IIdentityProofVerifyRequest.md +23 -0
  40. package/docs/reference/interfaces/IIdentityProofVerifyResponse.md +15 -0
  41. package/docs/reference/interfaces/IIdentityResolveRequest.md +2 -2
  42. package/docs/reference/interfaces/IIdentityServiceCreateRequest.md +43 -0
  43. package/docs/reference/interfaces/IIdentityServiceCreateResponse.md +11 -0
  44. package/docs/reference/interfaces/IIdentityServiceRemoveRequest.md +23 -0
  45. package/docs/reference/interfaces/IIdentityVerifiableCredentialCreateRequest.md +49 -0
  46. package/docs/reference/interfaces/IIdentityVerifiableCredentialCreateResponse.md +23 -0
  47. package/docs/reference/interfaces/IIdentityVerifiableCredentialRevokeRequest.md +23 -0
  48. package/docs/reference/interfaces/IIdentityVerifiableCredentialUnrevokeRequest.md +23 -0
  49. package/docs/reference/interfaces/IIdentityVerifiableCredentialVerifyRequest.md +17 -0
  50. package/docs/reference/interfaces/IIdentityVerifiableCredentialVerifyResponse.md +23 -0
  51. package/docs/reference/interfaces/IIdentityVerifiablePresentationCreateRequest.md +61 -0
  52. package/docs/reference/interfaces/IIdentityVerifiablePresentationCreateResponse.md +23 -0
  53. package/docs/reference/interfaces/IIdentityVerifiablePresentationVerifyRequest.md +17 -0
  54. package/docs/reference/interfaces/IIdentityVerifiablePresentationVerifyResponse.md +29 -0
  55. package/docs/reference/interfaces/IIdentityVerificationMethodCreateRequest.md +37 -0
  56. package/docs/reference/interfaces/IIdentityVerificationMethodCreateResponse.md +11 -0
  57. package/docs/reference/interfaces/IIdentityVerificationMethodRemoveRequest.md +23 -0
  58. package/package.json +1 -1
@@ -38,19 +38,43 @@ class DocumentHelper {
38
38
  * @param documentId The full document id.
39
39
  * @returns The parsed document id.
40
40
  */
41
- static parse(documentId) {
41
+ static parseId(documentId) {
42
42
  if (!core.Is.stringValue(documentId)) {
43
43
  return {
44
44
  id: "",
45
- hash: ""
45
+ fragment: ""
46
46
  };
47
47
  }
48
- const hashIndex = documentId.indexOf("#");
48
+ const fragmentIndex = documentId.indexOf("#");
49
49
  return {
50
- id: hashIndex === -1 ? documentId : documentId.slice(0, hashIndex),
51
- hash: hashIndex === -1 ? undefined : documentId.slice(hashIndex + 1)
50
+ id: fragmentIndex === -1 ? documentId : documentId.slice(0, fragmentIndex),
51
+ fragment: fragmentIndex === -1 ? undefined : documentId.slice(fragmentIndex + 1)
52
52
  };
53
53
  }
54
+ /**
55
+ * Join the document id parts.
56
+ * @param documentId The document id.
57
+ * @param fragment The fragment part for the identifier.
58
+ * @returns The full id.
59
+ */
60
+ static joinId(documentId, fragment) {
61
+ if (!core.Is.stringValue(documentId)) {
62
+ return "";
63
+ }
64
+ let fullId = documentId;
65
+ if (core.Is.stringValue(fragment)) {
66
+ if (fragment.startsWith(documentId)) {
67
+ fragment = fragment.slice(documentId.length);
68
+ }
69
+ if (fragment.startsWith("#")) {
70
+ fullId += fragment;
71
+ }
72
+ else {
73
+ fullId += `#${fragment}`;
74
+ }
75
+ }
76
+ return fullId;
77
+ }
54
78
  }
55
79
 
56
80
  // Copyright 2024 IOTA Stiftung.
@@ -36,19 +36,43 @@ class DocumentHelper {
36
36
  * @param documentId The full document id.
37
37
  * @returns The parsed document id.
38
38
  */
39
- static parse(documentId) {
39
+ static parseId(documentId) {
40
40
  if (!Is.stringValue(documentId)) {
41
41
  return {
42
42
  id: "",
43
- hash: ""
43
+ fragment: ""
44
44
  };
45
45
  }
46
- const hashIndex = documentId.indexOf("#");
46
+ const fragmentIndex = documentId.indexOf("#");
47
47
  return {
48
- id: hashIndex === -1 ? documentId : documentId.slice(0, hashIndex),
49
- hash: hashIndex === -1 ? undefined : documentId.slice(hashIndex + 1)
48
+ id: fragmentIndex === -1 ? documentId : documentId.slice(0, fragmentIndex),
49
+ fragment: fragmentIndex === -1 ? undefined : documentId.slice(fragmentIndex + 1)
50
50
  };
51
51
  }
52
+ /**
53
+ * Join the document id parts.
54
+ * @param documentId The document id.
55
+ * @param fragment The fragment part for the identifier.
56
+ * @returns The full id.
57
+ */
58
+ static joinId(documentId, fragment) {
59
+ if (!Is.stringValue(documentId)) {
60
+ return "";
61
+ }
62
+ let fullId = documentId;
63
+ if (Is.stringValue(fragment)) {
64
+ if (fragment.startsWith(documentId)) {
65
+ fragment = fragment.slice(documentId.length);
66
+ }
67
+ if (fragment.startsWith("#")) {
68
+ fullId += fragment;
69
+ }
70
+ else {
71
+ fullId += `#${fragment}`;
72
+ }
73
+ }
74
+ return fullId;
75
+ }
52
76
  }
53
77
 
54
78
  // Copyright 2024 IOTA Stiftung.
@@ -1,6 +1,28 @@
1
1
  export * from "./factories/identityConnectorFactory";
2
2
  export * from "./factories/identityProfileConnectorFactory";
3
3
  export * from "./factories/identityResolverConnectorFactory";
4
+ export * from "./models/api/identity/IIdentityCreateRequest";
5
+ export * from "./models/api/identity/IIdentityCreateResponse";
6
+ export * from "./models/api/identity/IIdentityProofCreateRequest";
7
+ export * from "./models/api/identity/IIdentityProofCreateResponse";
8
+ export * from "./models/api/identity/IIdentityProofVerifyRequest";
9
+ export * from "./models/api/identity/IIdentityProofVerifyResponse";
10
+ export * from "./models/api/identity/IIdentityServiceCreateRequest";
11
+ export * from "./models/api/identity/IIdentityServiceCreateResponse";
12
+ export * from "./models/api/identity/IIdentityServiceRemoveRequest";
13
+ export * from "./models/api/identity/IIdentityVerifiableCredentialCreateRequest";
14
+ export * from "./models/api/identity/IIdentityVerifiableCredentialCreateResponse";
15
+ export * from "./models/api/identity/IIdentityVerifiableCredentialRevokeRequest";
16
+ export * from "./models/api/identity/IIdentityVerifiableCredentialUnrevokeRequest";
17
+ export * from "./models/api/identity/IIdentityVerifiableCredentialVerifyRequest";
18
+ export * from "./models/api/identity/IIdentityVerifiableCredentialVerifyResponse";
19
+ export * from "./models/api/identity/IIdentityVerifiablePresentationCreateRequest";
20
+ export * from "./models/api/identity/IIdentityVerifiablePresentationCreateResponse";
21
+ export * from "./models/api/identity/IIdentityVerifiablePresentationVerifyRequest";
22
+ export * from "./models/api/identity/IIdentityVerifiablePresentationVerifyResponse";
23
+ export * from "./models/api/identity/IIdentityVerificationMethodCreateRequest";
24
+ export * from "./models/api/identity/IIdentityVerificationMethodCreateResponse";
25
+ export * from "./models/api/identity/IIdentityVerificationMethodRemoveRequest";
4
26
  export * from "./models/api/profile/IIdentityProfileCreateRequest";
5
27
  export * from "./models/api/profile/IIdentityProfileGetPublicRequest";
6
28
  export * from "./models/api/profile/IIdentityProfileGetPublicResponse";
@@ -7,61 +7,61 @@ import type { DidVerificationMethodType, IDidDocument, IDidDocumentVerificationM
7
7
  export interface IIdentityComponent extends IComponent {
8
8
  /**
9
9
  * Create a new identity.
10
- * @param controller The controller of the identity who can make changes.
11
10
  * @param namespace The namespace of the connector to use for the identity, defaults to service configured namespace.
11
+ * @param controller The controller of the identity who can make changes.
12
12
  * @returns The created identity document.
13
13
  */
14
- identityCreate(controller: string, namespace?: string): Promise<IDidDocument>;
14
+ identityCreate(namespace?: string, controller?: string): Promise<IDidDocument>;
15
15
  /**
16
16
  * Add a verification method to the document in JSON Web key Format.
17
- * @param controller The controller of the identity who can make changes.
18
17
  * @param identity The id of the document to add the verification method to.
19
18
  * @param verificationMethodType The type of the verification method to add.
20
19
  * @param verificationMethodId The id of the verification method, if undefined uses the kid of the generated JWK.
20
+ * @param controller The controller of the identity who can make changes.
21
21
  * @returns The verification method.
22
22
  * @throws NotFoundError if the id can not be resolved.
23
23
  * @throws NotSupportedError if the platform does not support multiple keys.
24
24
  */
25
- verificationMethodCreate(controller: string, identity: string, verificationMethodType: DidVerificationMethodType, verificationMethodId?: string): Promise<IDidDocumentVerificationMethod>;
25
+ verificationMethodCreate(identity: string, verificationMethodType: DidVerificationMethodType, verificationMethodId?: string, controller?: string): Promise<IDidDocumentVerificationMethod>;
26
26
  /**
27
27
  * Remove a verification method from the document.
28
- * @param controller The controller of the identity who can make changes.
29
28
  * @param verificationMethodId The id of the verification method.
29
+ * @param controller The controller of the identity who can make changes.
30
30
  * @returns Nothing.
31
31
  * @throws NotFoundError if the id can not be resolved.
32
32
  * @throws NotSupportedError if the platform does not support multiple revocable keys.
33
33
  */
34
- verificationMethodRemove(controller: string, verificationMethodId: string): Promise<void>;
34
+ verificationMethodRemove(verificationMethodId: string, controller?: string): Promise<void>;
35
35
  /**
36
36
  * Add a service to the document.
37
- * @param controller The controller of the identity who can make changes.
38
37
  * @param identity The id of the document to add the service to.
39
38
  * @param serviceId The id of the service.
40
39
  * @param serviceType The type of the service.
41
40
  * @param serviceEndpoint The endpoint for the service.
41
+ * @param controller The controller of the identity who can make changes.
42
42
  * @returns The service.
43
43
  * @throws NotFoundError if the id can not be resolved.
44
44
  */
45
- serviceCreate(controller: string, identity: string, serviceId: string, serviceType: string, serviceEndpoint: string): Promise<IDidService>;
45
+ serviceCreate(identity: string, serviceId: string, serviceType: string | string[], serviceEndpoint: string | string[], controller?: string): Promise<IDidService>;
46
46
  /**
47
47
  * Remove a service from the document.
48
- * @param controller The controller of the identity who can make changes.
49
48
  * @param serviceId The id of the service.
49
+ * @param controller The controller of the identity who can make changes.
50
50
  * @returns Nothing.
51
51
  * @throws NotFoundError if the id can not be resolved.
52
52
  */
53
- serviceRemove(controller: string, serviceId: string): Promise<void>;
53
+ serviceRemove(serviceId: string, controller?: string): Promise<void>;
54
54
  /**
55
55
  * Create a verifiable credential for a verification method.
56
- * @param controller The controller of the identity who can make changes.
57
56
  * @param verificationMethodId The verification method id to use.
58
57
  * @param id The id of the credential.
59
- * @param credential The credential to store in the verifiable credential.
58
+ * @param subject The credential subject to store in the verifiable credential.
60
59
  * @param revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.
60
+ * @param controller The controller of the identity who can make changes.
61
61
  * @returns The created verifiable credential and its token.
62
62
  * @throws NotFoundError if the id can not be resolved.
63
63
  */
64
- verifiableCredentialCreate(controller: string, verificationMethodId: string, id: string | undefined, credential: IJsonLdNodeObject, revocationIndex?: number): Promise<{
64
+ verifiableCredentialCreate(verificationMethodId: string, id: string | undefined, subject: IJsonLdNodeObject, revocationIndex?: number, controller?: string): Promise<{
65
65
  verifiableCredential: IDidVerifiableCredential;
66
66
  jwt: string;
67
67
  }>;
@@ -76,33 +76,33 @@ export interface IIdentityComponent extends IComponent {
76
76
  }>;
77
77
  /**
78
78
  * Revoke verifiable credential.
79
- * @param controller The controller of the identity who can make changes.
80
79
  * @param issuerId The id of the document to update the revocation list for.
81
80
  * @param credentialIndex The revocation bitmap index revoke.
81
+ * @param controller The controller of the identity who can make changes.
82
82
  * @returns Nothing.
83
83
  */
84
- verifiableCredentialRevoke(controller: string, issuerId: string, credentialIndex: number): Promise<void>;
84
+ verifiableCredentialRevoke(issuerId: string, credentialIndex: number, controller?: string): Promise<void>;
85
85
  /**
86
86
  * Unrevoke verifiable credential.
87
- * @param controller The controller of the identity who can make changes.
88
87
  * @param issuerId The id of the document to update the revocation list for.
89
88
  * @param credentialIndex The revocation bitmap index to un revoke.
89
+ * @param controller The controller of the identity who can make changes.
90
90
  * @returns Nothing.
91
91
  */
92
- verifiableCredentialUnrevoke(controller: string, issuerId: string, credentialIndex: number): Promise<void>;
92
+ verifiableCredentialUnrevoke(issuerId: string, credentialIndex: number, controller?: string): Promise<void>;
93
93
  /**
94
94
  * Create a verifiable presentation from the supplied verifiable credentials.
95
- * @param controller The controller of the identity who can make changes.
96
- * @param presentationMethodId The method to associate with the presentation.
95
+ * @param verificationMethodId The method to associate with the presentation.
97
96
  * @param presentationId The id of the presentation.
98
97
  * @param contexts The contexts for the data stored in the verifiable credential.
99
98
  * @param types The types for the data stored in the verifiable credential.
100
99
  * @param verifiableCredentials The credentials to use for creating the presentation in jwt format.
101
100
  * @param expiresInMinutes The time in minutes for the presentation to expire.
101
+ * @param controller The controller of the identity who can make changes.
102
102
  * @returns The created verifiable presentation and its token.
103
103
  * @throws NotFoundError if the id can not be resolved.
104
104
  */
105
- verifiablePresentationCreate(controller: string, presentationMethodId: string, presentationId: string | undefined, contexts: IJsonLdContextDefinitionRoot | undefined, types: string | string[] | undefined, verifiableCredentials: (string | IDidVerifiableCredential)[], expiresInMinutes?: number): Promise<{
105
+ verifiablePresentationCreate(verificationMethodId: string, presentationId: string | undefined, contexts: IJsonLdContextDefinitionRoot | undefined, types: string | string[] | undefined, verifiableCredentials: (string | IDidVerifiableCredential)[], expiresInMinutes?: number, controller?: string): Promise<{
106
106
  verifiablePresentation: IDidVerifiablePresentation;
107
107
  jwt: string;
108
108
  }>;
@@ -118,12 +118,12 @@ export interface IIdentityComponent extends IComponent {
118
118
  }>;
119
119
  /**
120
120
  * Create a proof for arbitrary data with the specified verification method.
121
- * @param controller The controller of the identity who can make changes.
122
121
  * @param verificationMethodId The verification method id to use.
123
122
  * @param bytes The data bytes to sign.
123
+ * @param controller The controller of the identity who can make changes.
124
124
  * @returns The proof.
125
125
  */
126
- proofCreate(controller: string, verificationMethodId: string, bytes: Uint8Array): Promise<IDidProof>;
126
+ proofCreate(verificationMethodId: string, bytes: Uint8Array, controller?: string): Promise<IDidProof>;
127
127
  /**
128
128
  * Verify proof for arbitrary data with the specified verification method.
129
129
  * @param bytes The data bytes to verify.
@@ -41,7 +41,7 @@ export interface IIdentityConnector extends IComponent {
41
41
  * @returns The service.
42
42
  * @throws NotFoundError if the id can not be resolved.
43
43
  */
44
- 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>;
45
45
  /**
46
46
  * Remove a service from the document.
47
47
  * @param controller The controller of the identity who can make changes.
@@ -55,12 +55,12 @@ export interface IIdentityConnector extends IComponent {
55
55
  * @param controller The controller of the identity who can make changes.
56
56
  * @param verificationMethodId The verification method id to use.
57
57
  * @param id The id of the credential.
58
- * @param credential The credential to store in the verifiable credential.
58
+ * @param subject The credential subject to store in the verifiable credential.
59
59
  * @param revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.
60
60
  * @returns The created verifiable credential and its token.
61
61
  * @throws NotFoundError if the id can not be resolved.
62
62
  */
63
- createVerifiableCredential(controller: string, verificationMethodId: string, id: string | undefined, credential: IJsonLdNodeObject, revocationIndex?: number): Promise<{
63
+ createVerifiableCredential(controller: string, verificationMethodId: string, id: string | undefined, subject: IJsonLdNodeObject, revocationIndex?: number): Promise<{
64
64
  verifiableCredential: IDidVerifiableCredential;
65
65
  jwt: string;
66
66
  }>;
@@ -92,7 +92,7 @@ export interface IIdentityConnector extends IComponent {
92
92
  /**
93
93
  * Create a verifiable presentation from the supplied verifiable credentials.
94
94
  * @param controller The controller of the identity who can make changes.
95
- * @param presentationMethodId The method to associate with the presentation.
95
+ * @param verificationMethodId The method to associate with the presentation.
96
96
  * @param presentationId The id of the presentation.
97
97
  * @param contexts The contexts for the data stored in the verifiable credential.
98
98
  * @param types The types for the data stored in the verifiable credential.
@@ -101,7 +101,7 @@ export interface IIdentityConnector extends IComponent {
101
101
  * @returns The created verifiable presentation and its token.
102
102
  * @throws NotFoundError if the id can not be resolved.
103
103
  */
104
- createVerifiablePresentation(controller: string, presentationMethodId: string, presentationId: string | undefined, contexts: IJsonLdContextDefinitionRoot | undefined, types: string | string[] | undefined, verifiableCredentials: (string | IDidVerifiableCredential)[], 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<{
105
105
  verifiablePresentation: IDidVerifiablePresentation;
106
106
  jwt: string;
107
107
  }>;
@@ -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,27 @@
1
+ /**
2
+ * Request to create a proof.
3
+ */
4
+ export interface IIdentityProofCreateRequest {
5
+ /**
6
+ * The path parameters.
7
+ */
8
+ pathParams: {
9
+ /**
10
+ * The identity to create the proof for.
11
+ */
12
+ identity: string;
13
+ /**
14
+ * The verification method id to use.
15
+ */
16
+ verificationMethodId: string;
17
+ };
18
+ /**
19
+ * The data for the request.
20
+ */
21
+ body: {
22
+ /**
23
+ * The data bytes base64 encoded.
24
+ */
25
+ bytes: string;
26
+ };
27
+ }
@@ -0,0 +1,10 @@
1
+ import type { IDidProof } 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: IDidProof;
10
+ }
@@ -0,0 +1,19 @@
1
+ import type { IDidProof } from "@twin.org/standards-w3c-did";
2
+ /**
3
+ * Request to verify a proof.
4
+ */
5
+ export interface IIdentityProofVerifyRequest {
6
+ /**
7
+ * The data for the request.
8
+ */
9
+ body: {
10
+ /**
11
+ * The data bytes base64 encoded.
12
+ */
13
+ bytes: string;
14
+ /**
15
+ * The proof to verify.
16
+ */
17
+ proof: IDidProof;
18
+ };
19
+ }
@@ -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
+ }