@twin.org/identity-models 0.0.1-next.9 → 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.
- package/dist/cjs/index.cjs +150 -21
- package/dist/esm/index.mjs +150 -22
- package/dist/types/factories/identityResolverConnectorFactory.d.ts +6 -0
- package/dist/types/index.d.ts +37 -11
- package/dist/types/models/IIdentityComponent.d.ts +134 -5
- package/dist/types/models/IIdentityConnector.d.ts +25 -29
- package/dist/types/models/IIdentityResolverComponent.d.ts +13 -0
- package/dist/types/models/IIdentityResolverConnector.d.ts +14 -0
- package/dist/types/models/api/identity/IIdentityCreateRequest.d.ts +14 -0
- package/dist/types/models/api/identity/IIdentityCreateResponse.d.ts +10 -0
- package/dist/types/models/api/identity/IIdentityProofCreateRequest.d.ts +33 -0
- package/dist/types/models/api/identity/IIdentityProofCreateResponse.d.ts +10 -0
- package/dist/types/models/api/identity/IIdentityProofVerifyRequest.d.ts +20 -0
- package/dist/types/models/api/identity/IIdentityProofVerifyResponse.d.ts +11 -0
- package/dist/types/models/api/identity/IIdentityRemoveRequest.d.ts +14 -0
- package/dist/types/models/api/identity/IIdentityServiceCreateRequest.d.ts +31 -0
- package/dist/types/models/api/identity/IIdentityServiceCreateResponse.d.ts +10 -0
- package/dist/types/models/api/identity/IIdentityServiceRemoveRequest.d.ts +18 -0
- package/dist/types/models/api/identity/IIdentityVerifiableCredentialCreateRequest.d.ts +36 -0
- package/dist/types/models/api/identity/IIdentityVerifiableCredentialCreateResponse.d.ts +19 -0
- package/dist/types/models/api/identity/IIdentityVerifiableCredentialRevokeRequest.d.ts +18 -0
- package/dist/types/models/api/identity/IIdentityVerifiableCredentialUnrevokeRequest.d.ts +18 -0
- package/dist/types/models/api/identity/IIdentityVerifiableCredentialVerifyRequest.d.ts +14 -0
- package/dist/types/models/api/identity/IIdentityVerifiableCredentialVerifyResponse.d.ts +19 -0
- package/dist/types/models/api/identity/IIdentityVerifiablePresentationCreateRequest.d.ts +45 -0
- package/dist/types/models/api/identity/IIdentityVerifiablePresentationCreateResponse.d.ts +19 -0
- package/dist/types/models/api/identity/IIdentityVerifiablePresentationVerifyRequest.d.ts +14 -0
- package/dist/types/models/api/identity/IIdentityVerifiablePresentationVerifyResponse.d.ts +23 -0
- package/dist/types/models/api/identity/IIdentityVerificationMethodCreateRequest.d.ts +28 -0
- package/dist/types/models/api/identity/IIdentityVerificationMethodCreateResponse.d.ts +10 -0
- package/dist/types/models/api/identity/IIdentityVerificationMethodRemoveRequest.d.ts +18 -0
- package/dist/types/models/api/{IIdentityProfileListRequest.d.ts → profile/IIdentityProfileListRequest.d.ts} +1 -1
- package/dist/types/models/api/{IIdentityResolveRequest.d.ts → resolver/IIdentityResolveRequest.d.ts} +2 -2
- package/dist/types/utils/documentHelper.d.ts +33 -2
- package/dist/types/utils/verificationHelper.d.ts +29 -0
- package/docs/changelog.md +152 -1
- package/docs/reference/classes/DocumentHelper.md +122 -8
- package/docs/reference/classes/VerificationHelper.md +87 -0
- package/docs/reference/index.md +27 -5
- package/docs/reference/interfaces/IIdentityComponent.md +500 -6
- package/docs/reference/interfaces/IIdentityConnector.md +150 -130
- package/docs/reference/interfaces/IIdentityCreateRequest.md +17 -0
- package/docs/reference/interfaces/IIdentityCreateResponse.md +11 -0
- package/docs/reference/interfaces/IIdentityProfileComponent.md +62 -50
- package/docs/reference/interfaces/IIdentityProfileConnector.md +60 -44
- package/docs/reference/interfaces/IIdentityProfileListRequest.md +1 -1
- package/docs/reference/interfaces/IIdentityProofCreateRequest.md +43 -0
- package/docs/reference/interfaces/IIdentityProofCreateResponse.md +11 -0
- package/docs/reference/interfaces/IIdentityProofVerifyRequest.md +23 -0
- package/docs/reference/interfaces/IIdentityProofVerifyResponse.md +15 -0
- package/docs/reference/interfaces/IIdentityRemoveRequest.md +17 -0
- package/docs/reference/interfaces/IIdentityResolveRequest.md +3 -3
- package/docs/reference/interfaces/IIdentityResolverComponent.md +29 -0
- package/docs/reference/interfaces/IIdentityResolverConnector.md +33 -0
- package/docs/reference/interfaces/IIdentityServiceCreateRequest.md +43 -0
- package/docs/reference/interfaces/IIdentityServiceCreateResponse.md +11 -0
- package/docs/reference/interfaces/IIdentityServiceRemoveRequest.md +23 -0
- package/docs/reference/interfaces/IIdentityVerifiableCredentialCreateRequest.md +49 -0
- package/docs/reference/interfaces/IIdentityVerifiableCredentialCreateResponse.md +23 -0
- package/docs/reference/interfaces/IIdentityVerifiableCredentialRevokeRequest.md +23 -0
- package/docs/reference/interfaces/IIdentityVerifiableCredentialUnrevokeRequest.md +23 -0
- package/docs/reference/interfaces/IIdentityVerifiableCredentialVerifyRequest.md +17 -0
- package/docs/reference/interfaces/IIdentityVerifiableCredentialVerifyResponse.md +23 -0
- package/docs/reference/interfaces/IIdentityVerifiablePresentationCreateRequest.md +61 -0
- package/docs/reference/interfaces/IIdentityVerifiablePresentationCreateResponse.md +23 -0
- package/docs/reference/interfaces/IIdentityVerifiablePresentationVerifyRequest.md +17 -0
- package/docs/reference/interfaces/IIdentityVerifiablePresentationVerifyResponse.md +29 -0
- package/docs/reference/interfaces/IIdentityVerificationMethodCreateRequest.md +37 -0
- package/docs/reference/interfaces/IIdentityVerificationMethodCreateResponse.md +11 -0
- package/docs/reference/interfaces/IIdentityVerificationMethodRemoveRequest.md +23 -0
- package/docs/reference/variables/IdentityResolverConnectorFactory.md +5 -0
- package/locales/en.json +10 -4
- package/package.json +10 -10
- package/dist/types/models/identityRole.d.ts +0 -21
- package/docs/reference/type-aliases/IdentityRole.md +0 -5
- package/docs/reference/variables/IdentityRole.md +0 -25
- /package/dist/types/models/api/{IIdentityProfileCreateRequest.d.ts → profile/IIdentityProfileCreateRequest.d.ts} +0 -0
- /package/dist/types/models/api/{IIdentityProfileGetPublicRequest.d.ts → profile/IIdentityProfileGetPublicRequest.d.ts} +0 -0
- /package/dist/types/models/api/{IIdentityProfileGetPublicResponse.d.ts → profile/IIdentityProfileGetPublicResponse.d.ts} +0 -0
- /package/dist/types/models/api/{IIdentityProfileGetRequest.d.ts → profile/IIdentityProfileGetRequest.d.ts} +0 -0
- /package/dist/types/models/api/{IIdentityProfileGetResponse.d.ts → profile/IIdentityProfileGetResponse.d.ts} +0 -0
- /package/dist/types/models/api/{IIdentityProfileListResponse.d.ts → profile/IIdentityProfileListResponse.d.ts} +0 -0
- /package/dist/types/models/api/{IIdentityProfileUpdateRequest.d.ts → profile/IIdentityProfileUpdateRequest.d.ts} +0 -0
- /package/dist/types/models/api/{IIdentityResolveResponse.d.ts → resolver/IIdentityResolveResponse.d.ts} +0 -0
|
@@ -1,14 +1,45 @@
|
|
|
1
|
+
import { DidVerificationMethodType, type IDidDocumentVerificationMethod, type IDidDocument } from "@twin.org/standards-w3c-did";
|
|
2
|
+
import type { IJwk } from "@twin.org/web";
|
|
1
3
|
/**
|
|
2
4
|
* Helper methods for documents.
|
|
3
5
|
*/
|
|
4
6
|
export declare class DocumentHelper {
|
|
7
|
+
/**
|
|
8
|
+
* Runtime name for the class.
|
|
9
|
+
*/
|
|
10
|
+
static readonly CLASS_NAME: string;
|
|
5
11
|
/**
|
|
6
12
|
* Parse the document id into its parts.
|
|
7
13
|
* @param documentId The full document id.
|
|
8
14
|
* @returns The parsed document id.
|
|
9
15
|
*/
|
|
10
|
-
static
|
|
16
|
+
static parseId(documentId: string): {
|
|
11
17
|
id: string;
|
|
12
|
-
|
|
18
|
+
fragment: string | undefined;
|
|
13
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Join the document id parts.
|
|
22
|
+
* @param documentId The document id.
|
|
23
|
+
* @param fragment The fragment part for the identifier.
|
|
24
|
+
* @returns The full id.
|
|
25
|
+
*/
|
|
26
|
+
static joinId(documentId: string, fragment?: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Get a verification method from a DID document.
|
|
29
|
+
* @param didDocument The DID Document to get the method from.
|
|
30
|
+
* @param methodName The name of the method to get the JWK from.
|
|
31
|
+
* @param methodType The type of the method, defaults to verificationMethod.
|
|
32
|
+
* @returns The verification method if found.
|
|
33
|
+
* @throws Error if the method is not found.
|
|
34
|
+
*/
|
|
35
|
+
static getVerificationMethod(didDocument: IDidDocument, methodName: string, methodType?: DidVerificationMethodType): IDidDocumentVerificationMethod;
|
|
36
|
+
/**
|
|
37
|
+
* Gets a JWK from a DID document verification method.
|
|
38
|
+
* @param didDocument The DID Document to get the method from.
|
|
39
|
+
* @param methodName The name of the method to get the JWK from.
|
|
40
|
+
* @param methodType The type of the method, defaults to verificationMethod.
|
|
41
|
+
* @returns The JWK if found.
|
|
42
|
+
* @throws Error if the method is not found.
|
|
43
|
+
*/
|
|
44
|
+
static getJwk(didDocument: IDidDocument, methodName: string, methodType?: DidVerificationMethodType): IJwk;
|
|
14
45
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
+
import { type IJwtHeader, type IJwtPayload } from "@twin.org/web";
|
|
3
|
+
import type { IIdentityResolverComponent } from "../models/IIdentityResolverComponent";
|
|
4
|
+
/**
|
|
5
|
+
* Helper methods for verification.
|
|
6
|
+
*/
|
|
7
|
+
export declare class VerificationHelper {
|
|
8
|
+
/**
|
|
9
|
+
* Runtime name for the class.
|
|
10
|
+
*/
|
|
11
|
+
static readonly CLASS_NAME: string;
|
|
12
|
+
/**
|
|
13
|
+
* Verified the JWT.
|
|
14
|
+
* @param resolver The resolver to use for finding the document.
|
|
15
|
+
* @param jwt The token to verify.
|
|
16
|
+
* @returns The decoded payload.
|
|
17
|
+
*/
|
|
18
|
+
static verifyJwt<T extends IJwtHeader, U extends IJwtPayload>(resolver: IIdentityResolverComponent, jwt: string): Promise<{
|
|
19
|
+
header: T;
|
|
20
|
+
payload: U;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Verified the proof for the document e.g. verifiable credential.
|
|
24
|
+
* @param resolver The resolver to use for finding the document.
|
|
25
|
+
* @param secureDocument The secure document to verify.
|
|
26
|
+
* @returns True if the verification is successful.
|
|
27
|
+
*/
|
|
28
|
+
static verifyProof(resolver: IIdentityResolverComponent, secureDocument: IJsonLdNodeObject): Promise<boolean>;
|
|
29
|
+
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,156 @@
|
|
|
1
1
|
# @twin.org/identity-service-models - Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.0.1 (2025-07-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* release to production ([8450ad7](https://github.com/twinfoundation/identity/commit/8450ad727e0c4d665f2ce483e41798c2ff5b7d55))
|
|
9
|
+
|
|
10
|
+
## [0.0.1-next.57](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.56...identity-models-v0.0.1-next.57) (2025-07-08)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add identity remove ([eebc13f](https://github.com/twinfoundation/identity/commit/eebc13f4c2cd994d2d9cce4da2128fb346c80ba7))
|
|
16
|
+
|
|
17
|
+
## [0.0.1-next.56](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.55...identity-models-v0.0.1-next.56) (2025-06-30)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Miscellaneous Chores
|
|
21
|
+
|
|
22
|
+
* **identity-models:** Synchronize repo versions
|
|
23
|
+
|
|
24
|
+
## [0.0.1-next.55](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.54...identity-models-v0.0.1-next.55) (2025-06-26)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* identity key separator use slash ([1319d0d](https://github.com/twinfoundation/identity/commit/1319d0d07164a36b3ec279e6421b8835ffefc3d3))
|
|
30
|
+
* use shared store mechanism ([#27](https://github.com/twinfoundation/identity/issues/27)) ([ce41f3f](https://github.com/twinfoundation/identity/commit/ce41f3fc3da1b206ec06da7ea5b2c968f788804d))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* Import path and bump version ([#21](https://github.com/twinfoundation/identity/issues/21)) ([ccea845](https://github.com/twinfoundation/identity/commit/ccea845bf32562267280bc1b3dde1c9af1a00360))
|
|
36
|
+
* Install sdk-wasm ([#20](https://github.com/twinfoundation/identity/issues/20)) ([75ec14e](https://github.com/twinfoundation/identity/commit/75ec14e072f8c219863a1c028a3b0783802086e9))
|
|
37
|
+
* query params force coercion ([d9347d2](https://github.com/twinfoundation/identity/commit/d9347d29d4a9cc58759f30f5d8526de864ea7522))
|
|
38
|
+
* Use resolver component ([#22](https://github.com/twinfoundation/identity/issues/22)) ([d0b3a32](https://github.com/twinfoundation/identity/commit/d0b3a321c7f9f966d397a880d752e9f2c0a98a27))
|
|
39
|
+
|
|
40
|
+
## [0.0.1-next.54](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.53...identity-models-v0.0.1-next.54) (2025-06-26)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Miscellaneous Chores
|
|
44
|
+
|
|
45
|
+
* **identity-models:** Synchronize repo versions
|
|
46
|
+
|
|
47
|
+
## [0.0.1-next.53](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.52...identity-models-v0.0.1-next.53) (2025-06-23)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### Miscellaneous Chores
|
|
51
|
+
|
|
52
|
+
* **identity-models:** Synchronize repo versions
|
|
53
|
+
|
|
54
|
+
## [0.0.1-next.52](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.51...identity-models-v0.0.1-next.52) (2025-06-20)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Bug Fixes
|
|
58
|
+
|
|
59
|
+
* query params force coercion ([d9347d2](https://github.com/twinfoundation/identity/commit/d9347d29d4a9cc58759f30f5d8526de864ea7522))
|
|
60
|
+
|
|
61
|
+
## [0.0.1-next.51](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.50...identity-models-v0.0.1-next.51) (2025-06-19)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### Miscellaneous Chores
|
|
65
|
+
|
|
66
|
+
* **identity-models:** Synchronize repo versions
|
|
67
|
+
|
|
68
|
+
## [0.0.1-next.50](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.49...identity-models-v0.0.1-next.50) (2025-06-19)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### Miscellaneous Chores
|
|
72
|
+
|
|
73
|
+
* **identity-models:** Synchronize repo versions
|
|
74
|
+
|
|
75
|
+
## [0.0.1-next.49](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.48...identity-models-v0.0.1-next.49) (2025-06-18)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### Miscellaneous Chores
|
|
79
|
+
|
|
80
|
+
* **identity-models:** Synchronize repo versions
|
|
81
|
+
|
|
82
|
+
## [0.0.1-next.48](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.47...identity-models-v0.0.1-next.48) (2025-06-17)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
### Miscellaneous Chores
|
|
86
|
+
|
|
87
|
+
* **identity-models:** Synchronize repo versions
|
|
88
|
+
|
|
89
|
+
## [0.0.1-next.47](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.46...identity-models-v0.0.1-next.47) (2025-06-12)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
### Features
|
|
93
|
+
|
|
94
|
+
* identity key separator use slash ([1319d0d](https://github.com/twinfoundation/identity/commit/1319d0d07164a36b3ec279e6421b8835ffefc3d3))
|
|
95
|
+
|
|
96
|
+
## [0.0.1-next.46](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.45...identity-models-v0.0.1-next.46) (2025-05-20)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
### Features
|
|
100
|
+
|
|
101
|
+
* use shared store mechanism ([#27](https://github.com/twinfoundation/identity/issues/27)) ([ce41f3f](https://github.com/twinfoundation/identity/commit/ce41f3fc3da1b206ec06da7ea5b2c968f788804d))
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### Bug Fixes
|
|
105
|
+
|
|
106
|
+
* Import path and bump version ([#21](https://github.com/twinfoundation/identity/issues/21)) ([ccea845](https://github.com/twinfoundation/identity/commit/ccea845bf32562267280bc1b3dde1c9af1a00360))
|
|
107
|
+
* Install sdk-wasm ([#20](https://github.com/twinfoundation/identity/issues/20)) ([75ec14e](https://github.com/twinfoundation/identity/commit/75ec14e072f8c219863a1c028a3b0783802086e9))
|
|
108
|
+
* Use resolver component ([#22](https://github.com/twinfoundation/identity/issues/22)) ([d0b3a32](https://github.com/twinfoundation/identity/commit/d0b3a321c7f9f966d397a880d752e9f2c0a98a27))
|
|
109
|
+
|
|
110
|
+
## [0.0.1-next.45](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.44...identity-models-v0.0.1-next.45) (2025-05-06)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
### Miscellaneous Chores
|
|
114
|
+
|
|
115
|
+
* **identity-models:** Synchronize repo versions
|
|
116
|
+
|
|
117
|
+
## [0.0.1-next.44](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.43...identity-models-v0.0.1-next.44) (2025-04-30)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
### Miscellaneous Chores
|
|
121
|
+
|
|
122
|
+
* **identity-models:** Synchronize repo versions
|
|
123
|
+
|
|
124
|
+
## [0.0.1-next.43](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.42...identity-models-v0.0.1-next.43) (2025-04-25)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### Miscellaneous Chores
|
|
128
|
+
|
|
129
|
+
* **identity-models:** Synchronize repo versions
|
|
130
|
+
|
|
131
|
+
## [0.0.1-next.42](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.41...identity-models-v0.0.1-next.42) (2025-04-17)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
### Features
|
|
135
|
+
|
|
136
|
+
* use shared store mechanism ([#27](https://github.com/twinfoundation/identity/issues/27)) ([ce41f3f](https://github.com/twinfoundation/identity/commit/ce41f3fc3da1b206ec06da7ea5b2c968f788804d))
|
|
137
|
+
|
|
138
|
+
## [0.0.1-next.41](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.40...identity-models-v0.0.1-next.41) (2025-04-09)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
### Miscellaneous Chores
|
|
142
|
+
|
|
143
|
+
* **identity-models:** Synchronize repo versions
|
|
144
|
+
|
|
145
|
+
## [0.0.1-next.40](https://github.com/twinfoundation/identity/compare/identity-models-v0.0.1-next.39...identity-models-v0.0.1-next.40) (2025-03-28)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
### Bug Fixes
|
|
149
|
+
|
|
150
|
+
* Import path and bump version ([#21](https://github.com/twinfoundation/identity/issues/21)) ([ccea845](https://github.com/twinfoundation/identity/commit/ccea845bf32562267280bc1b3dde1c9af1a00360))
|
|
151
|
+
* Install sdk-wasm ([#20](https://github.com/twinfoundation/identity/issues/20)) ([75ec14e](https://github.com/twinfoundation/identity/commit/75ec14e072f8c219863a1c028a3b0783802086e9))
|
|
152
|
+
* Use resolver component ([#22](https://github.com/twinfoundation/identity/issues/22)) ([d0b3a32](https://github.com/twinfoundation/identity/commit/d0b3a321c7f9f966d397a880d752e9f2c0a98a27))
|
|
153
|
+
|
|
154
|
+
## v0.0.1-next.39
|
|
4
155
|
|
|
5
156
|
- Initial Release
|
|
@@ -4,25 +4,35 @@ Helper methods for documents.
|
|
|
4
4
|
|
|
5
5
|
## Constructors
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new DocumentHelper**():
|
|
9
|
+
> **new DocumentHelper**(): `DocumentHelper`
|
|
10
10
|
|
|
11
11
|
#### Returns
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
`DocumentHelper`
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
### CLASS\_NAME
|
|
18
|
+
|
|
19
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
|
+
|
|
21
|
+
Runtime name for the class.
|
|
14
22
|
|
|
15
23
|
## Methods
|
|
16
24
|
|
|
17
|
-
###
|
|
25
|
+
### parseId()
|
|
18
26
|
|
|
19
|
-
> `static` **
|
|
27
|
+
> `static` **parseId**(`documentId`): `object`
|
|
20
28
|
|
|
21
29
|
Parse the document id into its parts.
|
|
22
30
|
|
|
23
31
|
#### Parameters
|
|
24
32
|
|
|
25
|
-
|
|
33
|
+
##### documentId
|
|
34
|
+
|
|
35
|
+
`string`
|
|
26
36
|
|
|
27
37
|
The full document id.
|
|
28
38
|
|
|
@@ -36,6 +46,110 @@ The parsed document id.
|
|
|
36
46
|
|
|
37
47
|
> **id**: `string`
|
|
38
48
|
|
|
39
|
-
#####
|
|
49
|
+
##### fragment
|
|
50
|
+
|
|
51
|
+
> **fragment**: `undefined` \| `string`
|
|
52
|
+
|
|
53
|
+
***
|
|
54
|
+
|
|
55
|
+
### joinId()
|
|
56
|
+
|
|
57
|
+
> `static` **joinId**(`documentId`, `fragment?`): `string`
|
|
58
|
+
|
|
59
|
+
Join the document id parts.
|
|
60
|
+
|
|
61
|
+
#### Parameters
|
|
62
|
+
|
|
63
|
+
##### documentId
|
|
64
|
+
|
|
65
|
+
`string`
|
|
66
|
+
|
|
67
|
+
The document id.
|
|
68
|
+
|
|
69
|
+
##### fragment?
|
|
70
|
+
|
|
71
|
+
`string`
|
|
72
|
+
|
|
73
|
+
The fragment part for the identifier.
|
|
74
|
+
|
|
75
|
+
#### Returns
|
|
76
|
+
|
|
77
|
+
`string`
|
|
78
|
+
|
|
79
|
+
The full id.
|
|
80
|
+
|
|
81
|
+
***
|
|
82
|
+
|
|
83
|
+
### getVerificationMethod()
|
|
84
|
+
|
|
85
|
+
> `static` **getVerificationMethod**(`didDocument`, `methodName`, `methodType?`): `IDidDocumentVerificationMethod`
|
|
86
|
+
|
|
87
|
+
Get a verification method from a DID document.
|
|
88
|
+
|
|
89
|
+
#### Parameters
|
|
90
|
+
|
|
91
|
+
##### didDocument
|
|
92
|
+
|
|
93
|
+
`IDidDocument`
|
|
94
|
+
|
|
95
|
+
The DID Document to get the method from.
|
|
96
|
+
|
|
97
|
+
##### methodName
|
|
98
|
+
|
|
99
|
+
`string`
|
|
100
|
+
|
|
101
|
+
The name of the method to get the JWK from.
|
|
102
|
+
|
|
103
|
+
##### methodType?
|
|
104
|
+
|
|
105
|
+
`DidVerificationMethodType`
|
|
106
|
+
|
|
107
|
+
The type of the method, defaults to verificationMethod.
|
|
108
|
+
|
|
109
|
+
#### Returns
|
|
110
|
+
|
|
111
|
+
`IDidDocumentVerificationMethod`
|
|
112
|
+
|
|
113
|
+
The verification method if found.
|
|
114
|
+
|
|
115
|
+
#### Throws
|
|
116
|
+
|
|
117
|
+
Error if the method is not found.
|
|
118
|
+
|
|
119
|
+
***
|
|
120
|
+
|
|
121
|
+
### getJwk()
|
|
122
|
+
|
|
123
|
+
> `static` **getJwk**(`didDocument`, `methodName`, `methodType?`): `IJwk`
|
|
124
|
+
|
|
125
|
+
Gets a JWK from a DID document verification method.
|
|
126
|
+
|
|
127
|
+
#### Parameters
|
|
128
|
+
|
|
129
|
+
##### didDocument
|
|
130
|
+
|
|
131
|
+
`IDidDocument`
|
|
132
|
+
|
|
133
|
+
The DID Document to get the method from.
|
|
134
|
+
|
|
135
|
+
##### methodName
|
|
136
|
+
|
|
137
|
+
`string`
|
|
138
|
+
|
|
139
|
+
The name of the method to get the JWK from.
|
|
140
|
+
|
|
141
|
+
##### methodType?
|
|
142
|
+
|
|
143
|
+
`DidVerificationMethodType`
|
|
144
|
+
|
|
145
|
+
The type of the method, defaults to verificationMethod.
|
|
146
|
+
|
|
147
|
+
#### Returns
|
|
148
|
+
|
|
149
|
+
`IJwk`
|
|
150
|
+
|
|
151
|
+
The JWK if found.
|
|
152
|
+
|
|
153
|
+
#### Throws
|
|
40
154
|
|
|
41
|
-
|
|
155
|
+
Error if the method is not found.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Class: VerificationHelper
|
|
2
|
+
|
|
3
|
+
Helper methods for verification.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### Constructor
|
|
8
|
+
|
|
9
|
+
> **new VerificationHelper**(): `VerificationHelper`
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
`VerificationHelper`
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
### CLASS\_NAME
|
|
18
|
+
|
|
19
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
|
+
|
|
21
|
+
Runtime name for the class.
|
|
22
|
+
|
|
23
|
+
## Methods
|
|
24
|
+
|
|
25
|
+
### verifyJwt()
|
|
26
|
+
|
|
27
|
+
> `static` **verifyJwt**\<`T`, `U`\>(`resolver`, `jwt`): `Promise`\<\{ `header`: `T`; `payload`: `U`; \}\>
|
|
28
|
+
|
|
29
|
+
Verified the JWT.
|
|
30
|
+
|
|
31
|
+
#### Type Parameters
|
|
32
|
+
|
|
33
|
+
##### T
|
|
34
|
+
|
|
35
|
+
`T` *extends* `IJwtHeader`
|
|
36
|
+
|
|
37
|
+
##### U
|
|
38
|
+
|
|
39
|
+
`U` *extends* `IJwtPayload`
|
|
40
|
+
|
|
41
|
+
#### Parameters
|
|
42
|
+
|
|
43
|
+
##### resolver
|
|
44
|
+
|
|
45
|
+
[`IIdentityResolverComponent`](../interfaces/IIdentityResolverComponent.md)
|
|
46
|
+
|
|
47
|
+
The resolver to use for finding the document.
|
|
48
|
+
|
|
49
|
+
##### jwt
|
|
50
|
+
|
|
51
|
+
`string`
|
|
52
|
+
|
|
53
|
+
The token to verify.
|
|
54
|
+
|
|
55
|
+
#### Returns
|
|
56
|
+
|
|
57
|
+
`Promise`\<\{ `header`: `T`; `payload`: `U`; \}\>
|
|
58
|
+
|
|
59
|
+
The decoded payload.
|
|
60
|
+
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
### verifyProof()
|
|
64
|
+
|
|
65
|
+
> `static` **verifyProof**(`resolver`, `secureDocument`): `Promise`\<`boolean`\>
|
|
66
|
+
|
|
67
|
+
Verified the proof for the document e.g. verifiable credential.
|
|
68
|
+
|
|
69
|
+
#### Parameters
|
|
70
|
+
|
|
71
|
+
##### resolver
|
|
72
|
+
|
|
73
|
+
[`IIdentityResolverComponent`](../interfaces/IIdentityResolverComponent.md)
|
|
74
|
+
|
|
75
|
+
The resolver to use for finding the document.
|
|
76
|
+
|
|
77
|
+
##### secureDocument
|
|
78
|
+
|
|
79
|
+
`IJsonLdNodeObject`
|
|
80
|
+
|
|
81
|
+
The secure document to verify.
|
|
82
|
+
|
|
83
|
+
#### Returns
|
|
84
|
+
|
|
85
|
+
`Promise`\<`boolean`\>
|
|
86
|
+
|
|
87
|
+
True if the verification is successful.
|
package/docs/reference/index.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
## Classes
|
|
4
4
|
|
|
5
5
|
- [DocumentHelper](classes/DocumentHelper.md)
|
|
6
|
+
- [VerificationHelper](classes/VerificationHelper.md)
|
|
6
7
|
|
|
7
8
|
## Interfaces
|
|
8
9
|
|
|
@@ -10,6 +11,31 @@
|
|
|
10
11
|
- [IIdentityConnector](interfaces/IIdentityConnector.md)
|
|
11
12
|
- [IIdentityProfileComponent](interfaces/IIdentityProfileComponent.md)
|
|
12
13
|
- [IIdentityProfileConnector](interfaces/IIdentityProfileConnector.md)
|
|
14
|
+
- [IIdentityResolverComponent](interfaces/IIdentityResolverComponent.md)
|
|
15
|
+
- [IIdentityResolverConnector](interfaces/IIdentityResolverConnector.md)
|
|
16
|
+
- [IIdentityCreateRequest](interfaces/IIdentityCreateRequest.md)
|
|
17
|
+
- [IIdentityCreateResponse](interfaces/IIdentityCreateResponse.md)
|
|
18
|
+
- [IIdentityProofCreateRequest](interfaces/IIdentityProofCreateRequest.md)
|
|
19
|
+
- [IIdentityProofCreateResponse](interfaces/IIdentityProofCreateResponse.md)
|
|
20
|
+
- [IIdentityProofVerifyRequest](interfaces/IIdentityProofVerifyRequest.md)
|
|
21
|
+
- [IIdentityProofVerifyResponse](interfaces/IIdentityProofVerifyResponse.md)
|
|
22
|
+
- [IIdentityRemoveRequest](interfaces/IIdentityRemoveRequest.md)
|
|
23
|
+
- [IIdentityServiceCreateRequest](interfaces/IIdentityServiceCreateRequest.md)
|
|
24
|
+
- [IIdentityServiceCreateResponse](interfaces/IIdentityServiceCreateResponse.md)
|
|
25
|
+
- [IIdentityServiceRemoveRequest](interfaces/IIdentityServiceRemoveRequest.md)
|
|
26
|
+
- [IIdentityVerifiableCredentialCreateRequest](interfaces/IIdentityVerifiableCredentialCreateRequest.md)
|
|
27
|
+
- [IIdentityVerifiableCredentialCreateResponse](interfaces/IIdentityVerifiableCredentialCreateResponse.md)
|
|
28
|
+
- [IIdentityVerifiableCredentialRevokeRequest](interfaces/IIdentityVerifiableCredentialRevokeRequest.md)
|
|
29
|
+
- [IIdentityVerifiableCredentialUnrevokeRequest](interfaces/IIdentityVerifiableCredentialUnrevokeRequest.md)
|
|
30
|
+
- [IIdentityVerifiableCredentialVerifyRequest](interfaces/IIdentityVerifiableCredentialVerifyRequest.md)
|
|
31
|
+
- [IIdentityVerifiableCredentialVerifyResponse](interfaces/IIdentityVerifiableCredentialVerifyResponse.md)
|
|
32
|
+
- [IIdentityVerifiablePresentationCreateRequest](interfaces/IIdentityVerifiablePresentationCreateRequest.md)
|
|
33
|
+
- [IIdentityVerifiablePresentationCreateResponse](interfaces/IIdentityVerifiablePresentationCreateResponse.md)
|
|
34
|
+
- [IIdentityVerifiablePresentationVerifyRequest](interfaces/IIdentityVerifiablePresentationVerifyRequest.md)
|
|
35
|
+
- [IIdentityVerifiablePresentationVerifyResponse](interfaces/IIdentityVerifiablePresentationVerifyResponse.md)
|
|
36
|
+
- [IIdentityVerificationMethodCreateRequest](interfaces/IIdentityVerificationMethodCreateRequest.md)
|
|
37
|
+
- [IIdentityVerificationMethodCreateResponse](interfaces/IIdentityVerificationMethodCreateResponse.md)
|
|
38
|
+
- [IIdentityVerificationMethodRemoveRequest](interfaces/IIdentityVerificationMethodRemoveRequest.md)
|
|
13
39
|
- [IIdentityProfileCreateRequest](interfaces/IIdentityProfileCreateRequest.md)
|
|
14
40
|
- [IIdentityProfileGetPublicRequest](interfaces/IIdentityProfileGetPublicRequest.md)
|
|
15
41
|
- [IIdentityProfileGetPublicResponse](interfaces/IIdentityProfileGetPublicResponse.md)
|
|
@@ -21,12 +47,8 @@
|
|
|
21
47
|
- [IIdentityResolveRequest](interfaces/IIdentityResolveRequest.md)
|
|
22
48
|
- [IIdentityResolveResponse](interfaces/IIdentityResolveResponse.md)
|
|
23
49
|
|
|
24
|
-
## Type Aliases
|
|
25
|
-
|
|
26
|
-
- [IdentityRole](type-aliases/IdentityRole.md)
|
|
27
|
-
|
|
28
50
|
## Variables
|
|
29
51
|
|
|
30
52
|
- [IdentityConnectorFactory](variables/IdentityConnectorFactory.md)
|
|
31
53
|
- [IdentityProfileConnectorFactory](variables/IdentityProfileConnectorFactory.md)
|
|
32
|
-
- [
|
|
54
|
+
- [IdentityResolverConnectorFactory](variables/IdentityResolverConnectorFactory.md)
|