@twin.org/identity-models 0.0.3-next.9 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/es/contextIdHandlers/didContextIdHandler.js +3 -3
- package/dist/es/contextIdHandlers/didContextIdHandler.js.map +1 -1
- package/dist/es/index.js +6 -0
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/IIdentityComponent.js.map +1 -1
- package/dist/es/models/IIdentityConnector.js.map +1 -1
- package/dist/es/models/IIdentityProfileComponent.js.map +1 -1
- package/dist/es/models/IIdentityProfileConnector.js.map +1 -1
- package/dist/es/models/api/identity/IIdentityAlsoKnownAsCreateRequest.js +4 -0
- package/dist/es/models/api/identity/IIdentityAlsoKnownAsCreateRequest.js.map +1 -0
- package/dist/es/models/api/identity/IIdentityAlsoKnownAsRemoveRequest.js +4 -0
- package/dist/es/models/api/identity/IIdentityAlsoKnownAsRemoveRequest.js.map +1 -0
- package/dist/es/models/api/identity/IIdentityVerifiableCredentialCreateRequest.js.map +1 -1
- package/dist/es/models/api/identity/IIdentityVerifiableCredentialVerifyDocumentRequest.js +2 -0
- package/dist/es/models/api/identity/IIdentityVerifiableCredentialVerifyDocumentRequest.js.map +1 -0
- package/dist/es/models/api/identity/IIdentityVerifiablePresentationCreateRequest.js.map +1 -1
- package/dist/es/models/api/identity/IIdentityVerifiablePresentationVerifyDocumentRequest.js +2 -0
- package/dist/es/models/api/identity/IIdentityVerifiablePresentationVerifyDocumentRequest.js.map +1 -0
- package/dist/es/models/identityMetricIds.js +49 -0
- package/dist/es/models/identityMetricIds.js.map +1 -0
- package/dist/es/models/identityMetrics.js +61 -0
- package/dist/es/models/identityMetrics.js.map +1 -0
- package/dist/es/types/did.js +3 -3
- package/dist/es/types/did.js.map +1 -1
- package/dist/es/utils/verificationHelper.js +4 -4
- package/dist/es/utils/verificationHelper.js.map +1 -1
- package/dist/types/contextIdHandlers/didContextIdHandler.d.ts +3 -3
- package/dist/types/index.d.ts +6 -0
- package/dist/types/models/IIdentityComponent.d.ts +54 -13
- package/dist/types/models/IIdentityConnector.d.ts +53 -12
- package/dist/types/models/IIdentityProfileComponent.d.ts +3 -3
- package/dist/types/models/IIdentityProfileConnector.d.ts +3 -3
- package/dist/types/models/api/identity/IIdentityAlsoKnownAsCreateRequest.d.ts +23 -0
- package/dist/types/models/api/identity/IIdentityAlsoKnownAsRemoveRequest.d.ts +18 -0
- package/dist/types/models/api/identity/IIdentityVerifiableCredentialCreateRequest.d.ts +12 -0
- package/dist/types/models/api/identity/IIdentityVerifiableCredentialVerifyDocumentRequest.d.ts +10 -0
- package/dist/types/models/api/identity/IIdentityVerifiablePresentationCreateRequest.d.ts +14 -2
- package/dist/types/models/api/identity/IIdentityVerifiablePresentationVerifyDocumentRequest.d.ts +10 -0
- package/dist/types/models/identityMetricIds.d.ts +49 -0
- package/dist/types/models/identityMetrics.d.ts +5 -0
- package/dist/types/types/did.d.ts +3 -3
- package/dist/types/utils/verificationHelper.d.ts +4 -4
- package/docs/changelog.md +409 -99
- package/docs/examples.md +157 -1
- package/docs/reference/classes/Did.md +7 -7
- package/docs/reference/classes/DidContextIdHandler.md +7 -7
- package/docs/reference/classes/DocumentHelper.md +5 -5
- package/docs/reference/classes/VerificationHelper.md +7 -7
- package/docs/reference/index.md +10 -0
- package/docs/reference/interfaces/IIdentityAlsoKnownAsCreateRequest.md +31 -0
- package/docs/reference/interfaces/IIdentityAlsoKnownAsRemoveRequest.md +23 -0
- package/docs/reference/interfaces/IIdentityComponent.md +157 -43
- package/docs/reference/interfaces/IIdentityConnector.md +156 -42
- package/docs/reference/interfaces/IIdentityCreateRequest.md +3 -3
- package/docs/reference/interfaces/IIdentityCreateResponse.md +1 -1
- package/docs/reference/interfaces/IIdentityProfileComponent.md +9 -9
- package/docs/reference/interfaces/IIdentityProfileConnector.md +8 -8
- package/docs/reference/interfaces/IIdentityProfileCreateRequest.md +3 -3
- package/docs/reference/interfaces/IIdentityProfileGetPublicRequest.md +4 -4
- package/docs/reference/interfaces/IIdentityProfileGetPublicResponse.md +2 -2
- package/docs/reference/interfaces/IIdentityProfileGetRequest.md +4 -4
- package/docs/reference/interfaces/IIdentityProfileGetResponse.md +3 -3
- package/docs/reference/interfaces/IIdentityProfileListRequest.md +6 -6
- package/docs/reference/interfaces/IIdentityProfileListResponse.md +2 -2
- package/docs/reference/interfaces/IIdentityProfileUpdateRequest.md +3 -3
- package/docs/reference/interfaces/IIdentityProofCreateRequest.md +2 -2
- package/docs/reference/interfaces/IIdentityProofCreateResponse.md +1 -1
- package/docs/reference/interfaces/IIdentityProofVerifyRequest.md +1 -1
- package/docs/reference/interfaces/IIdentityProofVerifyResponse.md +1 -1
- package/docs/reference/interfaces/IIdentityRemoveRequest.md +1 -1
- package/docs/reference/interfaces/IIdentityResolveRequest.md +1 -1
- package/docs/reference/interfaces/IIdentityResolveResponse.md +1 -1
- package/docs/reference/interfaces/IIdentityResolverComponent.md +1 -1
- package/docs/reference/interfaces/IIdentityResolverConnector.md +1 -1
- package/docs/reference/interfaces/IIdentityServiceCreateRequest.md +2 -2
- package/docs/reference/interfaces/IIdentityServiceCreateResponse.md +1 -1
- package/docs/reference/interfaces/IIdentityServiceRemoveRequest.md +1 -1
- package/docs/reference/interfaces/IIdentityVerifiableCredentialCreateRequest.md +25 -5
- package/docs/reference/interfaces/IIdentityVerifiableCredentialCreateResponse.md +1 -1
- package/docs/reference/interfaces/IIdentityVerifiableCredentialRevokeRequest.md +1 -1
- package/docs/reference/interfaces/IIdentityVerifiableCredentialUnrevokeRequest.md +1 -1
- package/docs/reference/interfaces/IIdentityVerifiableCredentialVerifyDocumentRequest.md +11 -0
- package/docs/reference/interfaces/IIdentityVerifiableCredentialVerifyRequest.md +1 -1
- package/docs/reference/interfaces/IIdentityVerifiableCredentialVerifyResponse.md +2 -2
- package/docs/reference/interfaces/IIdentityVerifiablePresentationCreateRequest.md +28 -8
- package/docs/reference/interfaces/IIdentityVerifiablePresentationCreateResponse.md +1 -1
- package/docs/reference/interfaces/IIdentityVerifiablePresentationVerifyDocumentRequest.md +11 -0
- package/docs/reference/interfaces/IIdentityVerifiablePresentationVerifyRequest.md +1 -1
- package/docs/reference/interfaces/IIdentityVerifiablePresentationVerifyResponse.md +3 -3
- package/docs/reference/interfaces/IIdentityVerificationMethodCreateRequest.md +3 -3
- package/docs/reference/interfaces/IIdentityVerificationMethodCreateResponse.md +1 -1
- package/docs/reference/interfaces/IIdentityVerificationMethodRemoveRequest.md +1 -1
- package/docs/reference/type-aliases/IdentityMetricIds.md +5 -0
- package/docs/reference/variables/IdentityMetricIds.md +67 -0
- package/docs/reference/variables/IdentityMetrics.md +5 -0
- package/package.json +12 -11
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# TWIN Identity
|
|
1
|
+
# TWIN Identity
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The identity-models package provides shared identity models and contracts that establish a consistent structure for identity workflows across the repository. It helps reduce integration friction between services, connectors, and clients by defining a common representation of identity entities and related payloads.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```shell
|
|
8
|
-
npm install @twin.org/identity-
|
|
8
|
+
npm install @twin.org/identity-models
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Examples
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Converter, HexHelper } from "@twin.org/core";
|
|
2
2
|
import { Did } from "../types/did.js";
|
|
3
3
|
/**
|
|
4
|
-
* Context
|
|
4
|
+
* Context ID handler that treats context identifiers as DIDs.
|
|
5
5
|
*/
|
|
6
6
|
export class DidContextIdHandler {
|
|
7
7
|
/**
|
|
@@ -30,9 +30,9 @@ export class DidContextIdHandler {
|
|
|
30
30
|
return parts.id;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* Guard the value ensuring
|
|
33
|
+
* Guard the value ensuring it is a valid DID.
|
|
34
34
|
* @param value The value to guard.
|
|
35
|
-
* @throws GeneralError if the value is
|
|
35
|
+
* @throws GeneralError if the value is not a valid DID.
|
|
36
36
|
*/
|
|
37
37
|
guard(value) {
|
|
38
38
|
Did.guard(DidContextIdHandler.CLASS_NAME, "value", value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"didContextIdHandler.js","sourceRoot":"","sources":["../../../src/contextIdHandlers/didContextIdHandler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAC/B;;OAEG;IACI,MAAM,CAAU,UAAU,yBAAyC;IAE1E;;;OAGG;IACI,SAAS;QACf,OAAO,mBAAmB,CAAC,UAAU,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAa;QACzB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC/B,yEAAyE;QACzE,IAAI,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;YACtE,MAAM,KAAK,GAAG,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC7C,OAAO,SAAS,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,KAAK,CAAC,EAAE,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAa;QACzB,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;IACjE,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IContextIdHandler } from \"@twin.org/context\";\nimport { Converter, HexHelper } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { Did } from \"../types/did.js\";\n\n/**\n * Context
|
|
1
|
+
{"version":3,"file":"didContextIdHandler.js","sourceRoot":"","sources":["../../../src/contextIdHandlers/didContextIdHandler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAC/B;;OAEG;IACI,MAAM,CAAU,UAAU,yBAAyC;IAE1E;;;OAGG;IACI,SAAS;QACf,OAAO,mBAAmB,CAAC,UAAU,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAa;QACzB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC/B,yEAAyE;QACzE,IAAI,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;YACtE,MAAM,KAAK,GAAG,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC7C,OAAO,SAAS,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,KAAK,CAAC,EAAE,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAa;QACzB,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;IACjE,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IContextIdHandler } from \"@twin.org/context\";\nimport { Converter, HexHelper } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { Did } from \"../types/did.js\";\n\n/**\n * Context ID handler that treats context identifiers as DIDs.\n */\nexport class DidContextIdHandler implements IContextIdHandler {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<DidContextIdHandler>();\n\n\t/**\n\t * The class name of the component.\n\t * @returns The class name.\n\t */\n\tpublic className(): string {\n\t\treturn DidContextIdHandler.CLASS_NAME;\n\t}\n\n\t/**\n\t * Get the short form of the DID which is the last part.\n\t * @param value The full context id value.\n\t * @returns Short form string.\n\t */\n\tpublic short(value: string): string {\n\t\tconst parts = Did.parse(value);\n\t\t// If the ID part is hex, convert to base64 for a shorter representation.\n\t\tif (HexHelper.hasPrefix(parts.id) && HexHelper.isHex(parts.id, true)) {\n\t\t\tconst bytes = Converter.hexToBytes(parts.id);\n\t\t\treturn Converter.bytesToBase64Url(bytes);\n\t\t}\n\t\treturn parts.id;\n\t}\n\n\t/**\n\t * Guard the value ensuring it is a valid DID.\n\t * @param value The value to guard.\n\t * @throws GeneralError if the value is not a valid DID.\n\t */\n\tpublic guard(value: string): void {\n\t\tDid.guard(DidContextIdHandler.CLASS_NAME, nameof(value), value);\n\t}\n}\n"]}
|
package/dist/es/index.js
CHANGED
|
@@ -4,6 +4,8 @@ export * from "./contextIdHandlers/didContextIdHandler.js";
|
|
|
4
4
|
export * from "./factories/identityConnectorFactory.js";
|
|
5
5
|
export * from "./factories/identityProfileConnectorFactory.js";
|
|
6
6
|
export * from "./factories/identityResolverConnectorFactory.js";
|
|
7
|
+
export * from "./models/api/identity/IIdentityAlsoKnownAsCreateRequest.js";
|
|
8
|
+
export * from "./models/api/identity/IIdentityAlsoKnownAsRemoveRequest.js";
|
|
7
9
|
export * from "./models/api/identity/IIdentityCreateRequest.js";
|
|
8
10
|
export * from "./models/api/identity/IIdentityCreateResponse.js";
|
|
9
11
|
export * from "./models/api/identity/IIdentityProofCreateRequest.js";
|
|
@@ -18,10 +20,12 @@ export * from "./models/api/identity/IIdentityVerifiableCredentialCreateRequest.
|
|
|
18
20
|
export * from "./models/api/identity/IIdentityVerifiableCredentialCreateResponse.js";
|
|
19
21
|
export * from "./models/api/identity/IIdentityVerifiableCredentialRevokeRequest.js";
|
|
20
22
|
export * from "./models/api/identity/IIdentityVerifiableCredentialUnrevokeRequest.js";
|
|
23
|
+
export * from "./models/api/identity/IIdentityVerifiableCredentialVerifyDocumentRequest.js";
|
|
21
24
|
export * from "./models/api/identity/IIdentityVerifiableCredentialVerifyRequest.js";
|
|
22
25
|
export * from "./models/api/identity/IIdentityVerifiableCredentialVerifyResponse.js";
|
|
23
26
|
export * from "./models/api/identity/IIdentityVerifiablePresentationCreateRequest.js";
|
|
24
27
|
export * from "./models/api/identity/IIdentityVerifiablePresentationCreateResponse.js";
|
|
28
|
+
export * from "./models/api/identity/IIdentityVerifiablePresentationVerifyDocumentRequest.js";
|
|
25
29
|
export * from "./models/api/identity/IIdentityVerifiablePresentationVerifyRequest.js";
|
|
26
30
|
export * from "./models/api/identity/IIdentityVerifiablePresentationVerifyResponse.js";
|
|
27
31
|
export * from "./models/api/identity/IIdentityVerificationMethodCreateRequest.js";
|
|
@@ -43,6 +47,8 @@ export * from "./models/IIdentityProfileComponent.js";
|
|
|
43
47
|
export * from "./models/IIdentityProfileConnector.js";
|
|
44
48
|
export * from "./models/IIdentityResolverComponent.js";
|
|
45
49
|
export * from "./models/IIdentityResolverConnector.js";
|
|
50
|
+
export * from "./models/identityMetricIds.js";
|
|
51
|
+
export * from "./models/identityMetrics.js";
|
|
46
52
|
export * from "./types/did.js";
|
|
47
53
|
export * from "./utils/documentHelper.js";
|
|
48
54
|
export * from "./utils/verificationHelper.js";
|
package/dist/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,yCAAyC,CAAC;AACxD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,iDAAiD,CAAC;AAChE,cAAc,iDAAiD,CAAC;AAChE,cAAc,kDAAkD,CAAC;AACjE,cAAc,sDAAsD,CAAC;AACrE,cAAc,uDAAuD,CAAC;AACtE,cAAc,sDAAsD,CAAC;AACrE,cAAc,uDAAuD,CAAC;AACtE,cAAc,iDAAiD,CAAC;AAChE,cAAc,wDAAwD,CAAC;AACvE,cAAc,yDAAyD,CAAC;AACxE,cAAc,wDAAwD,CAAC;AACvE,cAAc,qEAAqE,CAAC;AACpF,cAAc,sEAAsE,CAAC;AACrF,cAAc,qEAAqE,CAAC;AACpF,cAAc,uEAAuE,CAAC;AACtF,cAAc,qEAAqE,CAAC;AACpF,cAAc,sEAAsE,CAAC;AACrF,cAAc,uEAAuE,CAAC;AACtF,cAAc,wEAAwE,CAAC;AACvF,cAAc,uEAAuE,CAAC;AACtF,cAAc,wEAAwE,CAAC;AACvF,cAAc,mEAAmE,CAAC;AAClF,cAAc,oEAAoE,CAAC;AACnF,cAAc,mEAAmE,CAAC;AAClF,cAAc,uDAAuD,CAAC;AACtE,cAAc,0DAA0D,CAAC;AACzE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AACpE,cAAc,qDAAqD,CAAC;AACpE,cAAc,sDAAsD,CAAC;AACrE,cAAc,uDAAuD,CAAC;AACtE,cAAc,kDAAkD,CAAC;AACjE,cAAc,mDAAmD,CAAC;AAClE,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC;AACvD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./contextIdHandlers/didContextIdHandler.js\";\nexport * from \"./factories/identityConnectorFactory.js\";\nexport * from \"./factories/identityProfileConnectorFactory.js\";\nexport * from \"./factories/identityResolverConnectorFactory.js\";\nexport * from \"./models/api/identity/IIdentityCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityProofCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityProofCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityProofVerifyRequest.js\";\nexport * from \"./models/api/identity/IIdentityProofVerifyResponse.js\";\nexport * from \"./models/api/identity/IIdentityRemoveRequest.js\";\nexport * from \"./models/api/identity/IIdentityServiceCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityServiceCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityServiceRemoveRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialRevokeRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialUnrevokeRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialVerifyRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialVerifyResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationVerifyRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationVerifyResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerificationMethodCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerificationMethodCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerificationMethodRemoveRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileCreateRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileGetPublicRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileGetPublicResponse.js\";\nexport * from \"./models/api/profile/IIdentityProfileGetRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileGetResponse.js\";\nexport * from \"./models/api/profile/IIdentityProfileListRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileListResponse.js\";\nexport * from \"./models/api/profile/IIdentityProfileUpdateRequest.js\";\nexport * from \"./models/api/resolver/IIdentityResolveRequest.js\";\nexport * from \"./models/api/resolver/IIdentityResolveResponse.js\";\nexport * from \"./models/IIdentityComponent.js\";\nexport * from \"./models/IIdentityConnector.js\";\nexport * from \"./models/IIdentityProfileComponent.js\";\nexport * from \"./models/IIdentityProfileConnector.js\";\nexport * from \"./models/IIdentityResolverComponent.js\";\nexport * from \"./models/IIdentityResolverConnector.js\";\nexport * from \"./types/did.js\";\nexport * from \"./utils/documentHelper.js\";\nexport * from \"./utils/verificationHelper.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,yCAAyC,CAAC;AACxD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,iDAAiD,CAAC;AAChE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,iDAAiD,CAAC;AAChE,cAAc,kDAAkD,CAAC;AACjE,cAAc,sDAAsD,CAAC;AACrE,cAAc,uDAAuD,CAAC;AACtE,cAAc,sDAAsD,CAAC;AACrE,cAAc,uDAAuD,CAAC;AACtE,cAAc,iDAAiD,CAAC;AAChE,cAAc,wDAAwD,CAAC;AACvE,cAAc,yDAAyD,CAAC;AACxE,cAAc,wDAAwD,CAAC;AACvE,cAAc,qEAAqE,CAAC;AACpF,cAAc,sEAAsE,CAAC;AACrF,cAAc,qEAAqE,CAAC;AACpF,cAAc,uEAAuE,CAAC;AACtF,cAAc,6EAA6E,CAAC;AAC5F,cAAc,qEAAqE,CAAC;AACpF,cAAc,sEAAsE,CAAC;AACrF,cAAc,uEAAuE,CAAC;AACtF,cAAc,wEAAwE,CAAC;AACvF,cAAc,+EAA+E,CAAC;AAC9F,cAAc,uEAAuE,CAAC;AACtF,cAAc,wEAAwE,CAAC;AACvF,cAAc,mEAAmE,CAAC;AAClF,cAAc,oEAAoE,CAAC;AACnF,cAAc,mEAAmE,CAAC;AAClF,cAAc,uDAAuD,CAAC;AACtE,cAAc,0DAA0D,CAAC;AACzE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AACpE,cAAc,qDAAqD,CAAC;AACpE,cAAc,sDAAsD,CAAC;AACrE,cAAc,uDAAuD,CAAC;AACtE,cAAc,kDAAkD,CAAC;AACjE,cAAc,mDAAmD,CAAC;AAClE,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC;AACvD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./contextIdHandlers/didContextIdHandler.js\";\nexport * from \"./factories/identityConnectorFactory.js\";\nexport * from \"./factories/identityProfileConnectorFactory.js\";\nexport * from \"./factories/identityResolverConnectorFactory.js\";\nexport * from \"./models/api/identity/IIdentityAlsoKnownAsCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityAlsoKnownAsRemoveRequest.js\";\nexport * from \"./models/api/identity/IIdentityCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityProofCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityProofCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityProofVerifyRequest.js\";\nexport * from \"./models/api/identity/IIdentityProofVerifyResponse.js\";\nexport * from \"./models/api/identity/IIdentityRemoveRequest.js\";\nexport * from \"./models/api/identity/IIdentityServiceCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityServiceCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityServiceRemoveRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialRevokeRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialUnrevokeRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialVerifyDocumentRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialVerifyRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialVerifyResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationVerifyDocumentRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationVerifyRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationVerifyResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerificationMethodCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerificationMethodCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerificationMethodRemoveRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileCreateRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileGetPublicRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileGetPublicResponse.js\";\nexport * from \"./models/api/profile/IIdentityProfileGetRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileGetResponse.js\";\nexport * from \"./models/api/profile/IIdentityProfileListRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileListResponse.js\";\nexport * from \"./models/api/profile/IIdentityProfileUpdateRequest.js\";\nexport * from \"./models/api/resolver/IIdentityResolveRequest.js\";\nexport * from \"./models/api/resolver/IIdentityResolveResponse.js\";\nexport * from \"./models/IIdentityComponent.js\";\nexport * from \"./models/IIdentityConnector.js\";\nexport * from \"./models/IIdentityProfileComponent.js\";\nexport * from \"./models/IIdentityProfileConnector.js\";\nexport * from \"./models/IIdentityResolverComponent.js\";\nexport * from \"./models/IIdentityResolverConnector.js\";\nexport * from \"./models/identityMetricIds.js\";\nexport * from \"./models/identityMetrics.js\";\nexport * from \"./types/did.js\";\nexport * from \"./utils/documentHelper.js\";\nexport * from \"./utils/verificationHelper.js\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IIdentityComponent.js","sourceRoot":"","sources":["../../../src/models/IIdentityComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdContextDefinitionRoot, IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type {\n\tDidVerificationMethodType,\n\tIDidDocument,\n\tIDidDocumentVerificationMethod,\n\tIProof,\n\tIDidService,\n\tIDidVerifiableCredential,\n\tIDidVerifiablePresentation,\n\tProofTypes\n} from \"@twin.org/standards-w3c-did\";\n\n/**\n * Interface describing a contract which provides identity operations.\n */\nexport interface IIdentityComponent extends IComponent {\n\t/**\n\t * Create a new identity.\n\t * @param namespace The namespace of the connector to use for the identity, defaults to service configured namespace.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The created identity document.\n\t */\n\tidentityCreate(namespace?: string, controller?: string): Promise<IDidDocument>;\n\n\t/**\n\t * Remove an identity.\n\t * @param identity The id of the document to remove.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns Nothing.\n\t */\n\tidentityRemove(identity: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Add a verification method to the document in JSON Web key Format.\n\t * @param identity The id of the document to add the verification method to.\n\t * @param verificationMethodType The type of the verification method to add.\n\t * @param verificationMethodId The id of the verification method, if undefined uses the kid of the generated JWK.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The verification method.\n\t * @throws NotFoundError if the id can not be resolved.\n\t * @throws NotSupportedError if the platform does not support multiple keys.\n\t */\n\tverificationMethodCreate(\n\t\tidentity: string,\n\t\tverificationMethodType: DidVerificationMethodType,\n\t\tverificationMethodId?: string,\n\t\tcontroller?: string\n\t): Promise<IDidDocumentVerificationMethod>;\n\n\t/**\n\t * Remove a verification method from the document.\n\t * @param verificationMethodId The id of the verification method.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns Nothing.\n\t * @throws NotFoundError if the id can not be resolved.\n\t * @throws NotSupportedError if the platform does not support multiple revocable keys.\n\t */\n\tverificationMethodRemove(verificationMethodId: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Add a service to the document.\n\t * @param identity The id of the document to add the service to.\n\t * @param serviceId The id of the service.\n\t * @param serviceType The type of the service.\n\t * @param serviceEndpoint The endpoint for the service.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The service.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tserviceCreate(\n\t\tidentity: string,\n\t\tserviceId: string,\n\t\tserviceType: string | string[],\n\t\tserviceEndpoint: string | string[],\n\t\tcontroller?: string\n\t): Promise<IDidService>;\n\n\t/**\n\t * Remove a service from the document.\n\t * @param serviceId The id of the service.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns Nothing.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tserviceRemove(serviceId: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Create a verifiable credential for a verification method.\n\t * @param verificationMethodId The verification method id to use.\n\t * @param id The id of the credential.\n\t * @param subject The credential subject to store in the verifiable credential.\n\t * @param options Additional options for creating the verifiable credential.\n\t * @param options.revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.\n\t * @param options.expirationDate The date the verifiable credential is valid until.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The created verifiable credential and its token.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tverifiableCredentialCreate(\n\t\tverificationMethodId: string,\n\t\tid: string | undefined,\n\t\tsubject: IJsonLdNodeObject,\n\t\toptions?: {\n\t\t\trevocationIndex?: number;\n\t\t\texpirationDate?: Date;\n\t\t},\n\t\tcontroller?: string\n\t): Promise<{\n\t\tverifiableCredential: IDidVerifiableCredential;\n\t\tjwt: string;\n\t}>;\n\n\t/**\n\t * Verify a verifiable credential is valid.\n\t * @param credentialJwt The credential to verify.\n\t * @returns The credential stored in the jwt and the revocation status.\n\t */\n\tverifiableCredentialVerify(credentialJwt: string): Promise<{\n\t\trevoked: boolean;\n\t\tverifiableCredential?: IDidVerifiableCredential;\n\t}>;\n\n\t/**\n\t * Revoke verifiable credential.\n\t * @param issuerId The id of the document to update the revocation list for.\n\t * @param credentialIndex The revocation bitmap index revoke.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns Nothing.\n\t */\n\tverifiableCredentialRevoke(\n\t\tissuerId: string,\n\t\tcredentialIndex: number,\n\t\tcontroller?: string\n\t): Promise<void>;\n\n\t/**\n\t * Unrevoke verifiable credential.\n\t * @param issuerId The id of the document to update the revocation list for.\n\t * @param credentialIndex The revocation bitmap index to un revoke.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns Nothing.\n\t */\n\tverifiableCredentialUnrevoke(\n\t\tissuerId: string,\n\t\tcredentialIndex: number,\n\t\tcontroller?: string\n\t): Promise<void>;\n\n\t/**\n\t * Create a verifiable presentation from the supplied verifiable credentials.\n\t * @param verificationMethodId The method to associate with the presentation.\n\t * @param presentationId The id of the presentation.\n\t * @param contexts The contexts for the data stored in the verifiable credential.\n\t * @param types The types for the data stored in the verifiable credential.\n\t * @param verifiableCredentials The credentials to use for creating the presentation in jwt format.\n\t * @param expiresInMinutes The time in minutes for the presentation to expire.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The created verifiable presentation and its token.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tverifiablePresentationCreate(\n\t\tverificationMethodId: string,\n\t\tpresentationId: string | undefined,\n\t\tcontexts: IJsonLdContextDefinitionRoot | undefined,\n\t\ttypes: string | string[] | undefined,\n\t\tverifiableCredentials: (string | IDidVerifiableCredential)[],\n\t\texpiresInMinutes?: number,\n\t\tcontroller?: string\n\t): Promise<{\n\t\tverifiablePresentation: IDidVerifiablePresentation;\n\t\tjwt: string;\n\t}>;\n\n\t/**\n\t * Verify a verifiable presentation is valid.\n\t * @param presentationJwt The presentation to verify.\n\t * @returns The presentation stored in the jwt and the revocation status.\n\t */\n\tverifiablePresentationVerify(presentationJwt: string): Promise<{\n\t\trevoked: boolean;\n\t\tverifiablePresentation?: IDidVerifiablePresentation;\n\t\tissuers?: IDidDocument[];\n\t}>;\n\n\t/**\n\t * Create a proof for a document with the specified verification method.\n\t * @param verificationMethodId The verification method id to use.\n\t * @param proofType The type of proof to create.\n\t * @param unsecureDocument The unsecure document to create the proof for.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The proof.\n\t */\n\tproofCreate(\n\t\tverificationMethodId: string,\n\t\tproofType: ProofTypes,\n\t\tunsecureDocument: IJsonLdNodeObject,\n\t\tcontroller?: string\n\t): Promise<IProof>;\n\n\t/**\n\t * Verify proof for a document with the specified verification method.\n\t * @param document The document to verify.\n\t * @param proof The proof to verify.\n\t * @returns True if the proof is verified.\n\t */\n\tproofVerify(document: IJsonLdNodeObject, proof: IProof): Promise<boolean>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IIdentityComponent.js","sourceRoot":"","sources":["../../../src/models/IIdentityComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdContextDefinitionRoot, IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type {\n\tDidVerificationMethodType,\n\tIDidDocument,\n\tIDidDocumentVerificationMethod,\n\tIProof,\n\tIDidService,\n\tIDidVerifiableCredential,\n\tIDidVerifiablePresentation,\n\tProofTypes\n} from \"@twin.org/standards-w3c-did\";\n\n/**\n * Interface describing a contract which provides identity operations.\n */\nexport interface IIdentityComponent extends IComponent {\n\t/**\n\t * Create a new identity.\n\t * @param namespace The namespace of the connector to use for the identity, defaults to service configured namespace.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The created identity document.\n\t */\n\tidentityCreate(namespace?: string, controller?: string): Promise<IDidDocument>;\n\n\t/**\n\t * Remove an identity.\n\t * @param identity The id of the document to remove.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns A promise that resolves when the identity has been removed.\n\t */\n\tidentityRemove(identity: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Add a verification method to the document in JSON Web key Format.\n\t * @param identity The id of the document to add the verification method to.\n\t * @param verificationMethodType The type of the verification method to add.\n\t * @param verificationMethodId The id of the verification method, if undefined uses the kid of the generated JWK.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The verification method.\n\t * @throws NotFoundError if the id can not be resolved.\n\t * @throws NotSupportedError if the platform does not support multiple keys.\n\t */\n\tverificationMethodCreate(\n\t\tidentity: string,\n\t\tverificationMethodType: DidVerificationMethodType,\n\t\tverificationMethodId?: string,\n\t\tcontroller?: string\n\t): Promise<IDidDocumentVerificationMethod>;\n\n\t/**\n\t * Remove a verification method from the document.\n\t * @param verificationMethodId The id of the verification method.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns A promise that resolves when the verification method has been removed.\n\t * @throws NotFoundError if the id can not be resolved.\n\t * @throws NotSupportedError if the platform does not support multiple revocable keys.\n\t */\n\tverificationMethodRemove(verificationMethodId: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Add a service to the document.\n\t * @param identity The id of the document to add the service to.\n\t * @param serviceId The id of the service.\n\t * @param serviceType The type of the service.\n\t * @param serviceEndpoint The endpoint for the service.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The service.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tserviceCreate(\n\t\tidentity: string,\n\t\tserviceId: string,\n\t\tserviceType: string | string[],\n\t\tserviceEndpoint: string | string[],\n\t\tcontroller?: string\n\t): Promise<IDidService>;\n\n\t/**\n\t * Remove a service from the document.\n\t * @param serviceId The id of the service.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns A promise that resolves when the service has been removed.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tserviceRemove(serviceId: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Add an alias to the alsoKnownAs property on the document.\n\t * If the alias is already present the operation is a no-op.\n\t * @param documentId The id of the document to update.\n\t * @param alias The alias to add. Must be a Url or Urn (typically another DID).\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns A promise that resolves when the alias has been added.\n\t * @throws GeneralError if the alias is not a Url or Urn.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\talsoKnownAsAdd(documentId: string, alias: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Remove an alias from the alsoKnownAs property on the document.\n\t * If the alias is not present the operation is a no-op.\n\t * @param documentId The id of the document to update.\n\t * @param alias The alias to remove. Must be a Url or Urn.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns A promise that resolves when the alias has been removed.\n\t * @throws GeneralError if the alias is not a Url or Urn.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\talsoKnownAsRemove(documentId: string, alias: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Create a verifiable credential for a verification method.\n\t * @param verificationMethodId The verification method id to use.\n\t * @param id The id of the credential.\n\t * @param subject The credential subject to store in the verifiable credential.\n\t * @param options Additional options for creating the verifiable credential.\n\t * @param options.revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.\n\t * @param options.expirationDate The date the verifiable credential is valid until.\n\t * @param options.jwtHeaderFields Additional fields to include in the JWT header when creating the verifiable credential in jwt format.\n\t * @param options.jwtPayloadFields Additional fields to include in the JWT payload when creating the verifiable credential in jwt format.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The created verifiable credential and its token.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tverifiableCredentialCreate(\n\t\tverificationMethodId: string,\n\t\tid: string | undefined,\n\t\tsubject: IJsonLdNodeObject,\n\t\toptions?: {\n\t\t\trevocationIndex?: number;\n\t\t\texpirationDate?: Date;\n\t\t\tjwtHeaderFields?: { [id: string]: string };\n\t\t\tjwtPayloadFields?: { [id: string]: string };\n\t\t},\n\t\tcontroller?: string\n\t): Promise<{\n\t\tverifiableCredential: IDidVerifiableCredential;\n\t\tjwt: string;\n\t}>;\n\n\t/**\n\t * Verify a verifiable credential is valid.\n\t * @param credential The credential to verify.\n\t * @returns The credential stored in the jwt and the revocation status.\n\t */\n\tverifiableCredentialVerify(credential: string | IDidVerifiableCredential): Promise<{\n\t\trevoked: boolean;\n\t\tverifiableCredential?: IDidVerifiableCredential;\n\t}>;\n\n\t/**\n\t * Revoke verifiable credential.\n\t * @param issuerId The id of the document to update the revocation list for.\n\t * @param credentialIndex The revocation bitmap index to revoke.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns A promise that resolves when the credential has been revoked.\n\t */\n\tverifiableCredentialRevoke(\n\t\tissuerId: string,\n\t\tcredentialIndex: number,\n\t\tcontroller?: string\n\t): Promise<void>;\n\n\t/**\n\t * Unrevoke verifiable credential.\n\t * @param issuerId The id of the document to update the revocation list for.\n\t * @param credentialIndex The revocation bitmap index to unrevoke.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns A promise that resolves when the credential has been unrevoked.\n\t */\n\tverifiableCredentialUnrevoke(\n\t\tissuerId: string,\n\t\tcredentialIndex: number,\n\t\tcontroller?: string\n\t): Promise<void>;\n\n\t/**\n\t * Create a verifiable presentation from the supplied verifiable credentials.\n\t * @param verificationMethodId The method to associate with the presentation.\n\t * @param presentationId The id of the presentation.\n\t * @param contexts The contexts for the data stored in the verifiable credential.\n\t * @param types The types for the data stored in the verifiable credential.\n\t * @param verifiableCredentials The credentials to use for creating the presentation in jwt format.\n\t * @param options Additional options for creating the verifiable presentation.\n\t * @param options.expirationDate The date the verifiable presentation is valid until.\n\t * @param options.jwtHeaderFields Additional fields to include in the JWT header when creating the verifiable presentation in jwt format.\n\t * @param options.jwtPayloadFields\tAdditional fields to include in the JWT payload when creating the verifiable presentation in jwt format.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The created verifiable presentation and its token.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tverifiablePresentationCreate(\n\t\tverificationMethodId: string,\n\t\tpresentationId: string | undefined,\n\t\tcontexts: IJsonLdContextDefinitionRoot | undefined,\n\t\ttypes: string | string[] | undefined,\n\t\tverifiableCredentials: (string | IDidVerifiableCredential)[],\n\t\toptions?: {\n\t\t\texpirationDate?: Date;\n\t\t\tjwtHeaderFields?: { [id: string]: string };\n\t\t\tjwtPayloadFields?: { [id: string]: string };\n\t\t},\n\t\tcontroller?: string\n\t): Promise<{\n\t\tverifiablePresentation: IDidVerifiablePresentation;\n\t\tjwt: string;\n\t}>;\n\n\t/**\n\t * Verify a verifiable presentation is valid.\n\t * @param presentation The presentation to verify.\n\t * @returns The presentation stored in the jwt and the revocation status.\n\t */\n\tverifiablePresentationVerify(presentation: string | IDidVerifiablePresentation): Promise<{\n\t\trevoked: boolean;\n\t\tverifiablePresentation?: IDidVerifiablePresentation;\n\t\tissuers?: IDidDocument[];\n\t}>;\n\n\t/**\n\t * Create a proof for a document with the specified verification method.\n\t * @param verificationMethodId The verification method id to use.\n\t * @param proofType The type of proof to create.\n\t * @param unsecureDocument The unsecure document to create the proof for.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The proof.\n\t */\n\tproofCreate(\n\t\tverificationMethodId: string,\n\t\tproofType: ProofTypes,\n\t\tunsecureDocument: IJsonLdNodeObject,\n\t\tcontroller?: string\n\t): Promise<IProof>;\n\n\t/**\n\t * Verify proof for a document with the specified verification method.\n\t * @param document The document to verify.\n\t * @param proof The proof to verify.\n\t * @returns True if the proof is verified.\n\t */\n\tproofVerify(document: IJsonLdNodeObject, proof: IProof): Promise<boolean>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IIdentityConnector.js","sourceRoot":"","sources":["../../../src/models/IIdentityConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdContextDefinitionRoot, IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type {\n\tDidVerificationMethodType,\n\tIDidDocument,\n\tIDidDocumentVerificationMethod,\n\tIProof,\n\tIDidService,\n\tIDidVerifiableCredential,\n\tIDidVerifiablePresentation,\n\tProofTypes\n} from \"@twin.org/standards-w3c-did\";\n\n/**\n * Interface describing an identity connector.\n */\nexport interface IIdentityConnector extends IComponent {\n\t/**\n\t * Create a new document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The created document.\n\t */\n\tcreateDocument(controller: string): Promise<IDidDocument>;\n\n\t/**\n\t * Remove a document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to remove.\n\t * @returns Nothing.\n\t */\n\tremoveDocument(controller: string, documentId: string): Promise<void>;\n\n\t/**\n\t * Add a verification method to the document in JSON Web key Format.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to add the verification method to.\n\t * @param verificationMethodType The type of the verification method to add.\n\t * @param verificationMethodId The id of the verification method, if undefined uses the kid of the generated JWK.\n\t * @returns The verification method.\n\t * @throws NotFoundError if the id can not be resolved.\n\t * @throws NotSupportedError if the platform does not support multiple keys.\n\t */\n\taddVerificationMethod(\n\t\tcontroller: string,\n\t\tdocumentId: string,\n\t\tverificationMethodType: DidVerificationMethodType,\n\t\tverificationMethodId?: string\n\t): Promise<IDidDocumentVerificationMethod>;\n\n\t/**\n\t * Remove a verification method from the document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param verificationMethodId The id of the verification method.\n\t * @returns Nothing.\n\t * @throws NotFoundError if the id can not be resolved.\n\t * @throws NotSupportedError if the platform does not support multiple revocable keys.\n\t */\n\tremoveVerificationMethod(controller: string, verificationMethodId: string): Promise<void>;\n\n\t/**\n\t * Add a service to the document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to add the service to.\n\t * @param serviceId The id of the service.\n\t * @param serviceType The type of the service.\n\t * @param serviceEndpoint The endpoint for the service.\n\t * @returns The service.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\taddService(\n\t\tcontroller: string,\n\t\tdocumentId: string,\n\t\tserviceId: string,\n\t\tserviceType: string | string[],\n\t\tserviceEndpoint: string | string[]\n\t): Promise<IDidService>;\n\n\t/**\n\t * Remove a service from the document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param serviceId The id of the service.\n\t * @returns Nothing.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tremoveService(controller: string, serviceId: string): Promise<void>;\n\n\t/**\n\t * Create a verifiable credential for a verification method.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param verificationMethodId The verification method id to use.\n\t * @param id The id of the credential.\n\t * @param subject The credential subject to store in the verifiable credential.\n\t * @param options Additional options for creating the verifiable credential.\n\t * @param options.revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.\n\t * @param options.expirationDate The date the verifiable credential is valid until.\n\t * @returns The created verifiable credential and its token.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tcreateVerifiableCredential(\n\t\tcontroller: string,\n\t\tverificationMethodId: string,\n\t\tid: string | undefined,\n\t\tsubject: IJsonLdNodeObject,\n\t\toptions?: {\n\t\t\trevocationIndex?: number;\n\t\t\texpirationDate?: Date;\n\t\t}\n\t): Promise<{\n\t\tverifiableCredential: IDidVerifiableCredential;\n\t\tjwt: string;\n\t}>;\n\n\t/**\n\t * Check a verifiable credential is valid.\n\t * @param credentialJwt The credential to verify.\n\t * @returns The credential stored in the jwt and the revocation status.\n\t */\n\tcheckVerifiableCredential(credentialJwt: string): Promise<{\n\t\trevoked: boolean;\n\t\tverifiableCredential?: IDidVerifiableCredential;\n\t}>;\n\n\t/**\n\t * Revoke verifiable credential(s).\n\t * @param controller The controller of the identity who can make changes.\n\t * @param issuerDocumentId The id of the document to update the revocation list for.\n\t * @param credentialIndices The revocation bitmap index or indices to revoke.\n\t * @returns Nothing.\n\t */\n\trevokeVerifiableCredentials(\n\t\tcontroller: string,\n\t\tissuerDocumentId: string,\n\t\tcredentialIndices: number[]\n\t): Promise<void>;\n\n\t/**\n\t * Unrevoke verifiable credential(s).\n\t * @param controller The controller of the identity who can make changes.\n\t * @param issuerDocumentId The id of the document to update the revocation list for.\n\t * @param credentialIndices The revocation bitmap index or indices to un revoke.\n\t * @returns Nothing.\n\t */\n\tunrevokeVerifiableCredentials(\n\t\tcontroller: string,\n\t\tissuerDocumentId: string,\n\t\tcredentialIndices: number[]\n\t): Promise<void>;\n\n\t/**\n\t * Create a verifiable presentation from the supplied verifiable credentials.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param verificationMethodId The method to associate with the presentation.\n\t * @param presentationId The id of the presentation.\n\t * @param contexts The contexts for the data stored in the verifiable credential.\n\t * @param types The types for the data stored in the verifiable credential.\n\t * @param verifiableCredentials The credentials to use for creating the presentation in jwt format.\n\t * @param expiresInMinutes The time in minutes for the presentation to expire.\n\t * @returns The created verifiable presentation and its token.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tcreateVerifiablePresentation(\n\t\tcontroller: string,\n\t\tverificationMethodId: string,\n\t\tpresentationId: string | undefined,\n\t\tcontexts: IJsonLdContextDefinitionRoot | undefined,\n\t\ttypes: string | string[] | undefined,\n\t\tverifiableCredentials: (string | IDidVerifiableCredential)[],\n\t\texpiresInMinutes?: number\n\t): Promise<{\n\t\tverifiablePresentation: IDidVerifiablePresentation;\n\t\tjwt: string;\n\t}>;\n\n\t/**\n\t * Check a verifiable presentation is valid.\n\t * @param presentationJwt The presentation to verify.\n\t * @returns The presentation stored in the jwt and the revocation status.\n\t */\n\tcheckVerifiablePresentation(presentationJwt: string): Promise<{\n\t\trevoked: boolean;\n\t\tverifiablePresentation?: IDidVerifiablePresentation;\n\t\tissuers?: IDidDocument[];\n\t}>;\n\n\t/**\n\t * Create a proof for arbitrary data with the specified verification method.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param verificationMethodId The verification method id to use.\n\t * @param proofType The type of proof to create.\n\t * @param unsecureDocument The unsecure document to create the proof for.\n\t * @returns The proof.\n\t */\n\tcreateProof(\n\t\tcontroller: string,\n\t\tverificationMethodId: string,\n\t\tproofType: ProofTypes,\n\t\tunsecureDocument: IJsonLdNodeObject\n\t): Promise<IProof>;\n\n\t/**\n\t * Verify proof for arbitrary data with the specified verification method.\n\t * @param document The document to verify.\n\t * @param proof The proof to verify.\n\t * @returns True if the proof is verified.\n\t */\n\tverifyProof(document: IJsonLdNodeObject, proof: IProof): Promise<boolean>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IIdentityConnector.js","sourceRoot":"","sources":["../../../src/models/IIdentityConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdContextDefinitionRoot, IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type {\n\tDidVerificationMethodType,\n\tIDidDocument,\n\tIDidDocumentVerificationMethod,\n\tIProof,\n\tIDidService,\n\tIDidVerifiableCredential,\n\tIDidVerifiablePresentation,\n\tProofTypes\n} from \"@twin.org/standards-w3c-did\";\n\n/**\n * Interface describing an identity connector.\n */\nexport interface IIdentityConnector extends IComponent {\n\t/**\n\t * Create a new document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The created document.\n\t */\n\tcreateDocument(controller: string): Promise<IDidDocument>;\n\n\t/**\n\t * Remove a document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to remove.\n\t * @returns A promise that resolves when the document has been removed.\n\t */\n\tremoveDocument(controller: string, documentId: string): Promise<void>;\n\n\t/**\n\t * Add a verification method to the document in JSON Web key Format.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to add the verification method to.\n\t * @param verificationMethodType The type of the verification method to add.\n\t * @param verificationMethodId The id of the verification method, if undefined uses the kid of the generated JWK.\n\t * @returns The verification method.\n\t * @throws NotFoundError if the id can not be resolved.\n\t * @throws NotSupportedError if the platform does not support multiple keys.\n\t */\n\taddVerificationMethod(\n\t\tcontroller: string,\n\t\tdocumentId: string,\n\t\tverificationMethodType: DidVerificationMethodType,\n\t\tverificationMethodId?: string\n\t): Promise<IDidDocumentVerificationMethod>;\n\n\t/**\n\t * Remove a verification method from the document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param verificationMethodId The id of the verification method.\n\t * @returns A promise that resolves when the verification method has been removed.\n\t * @throws NotFoundError if the id can not be resolved.\n\t * @throws NotSupportedError if the platform does not support multiple revocable keys.\n\t */\n\tremoveVerificationMethod(controller: string, verificationMethodId: string): Promise<void>;\n\n\t/**\n\t * Add a service to the document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to add the service to.\n\t * @param serviceId The id of the service.\n\t * @param serviceType The type of the service.\n\t * @param serviceEndpoint The endpoint for the service.\n\t * @returns The service.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\taddService(\n\t\tcontroller: string,\n\t\tdocumentId: string,\n\t\tserviceId: string,\n\t\tserviceType: string | string[],\n\t\tserviceEndpoint: string | string[]\n\t): Promise<IDidService>;\n\n\t/**\n\t * Remove a service from the document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param serviceId The id of the service.\n\t * @returns A promise that resolves when the service has been removed.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tremoveService(controller: string, serviceId: string): Promise<void>;\n\n\t/**\n\t * Add an alias to the alsoKnownAs property on the document.\n\t * If the alias is already present the operation is a no-op.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to update.\n\t * @param alias The alias to add. Must be a Url or Urn (typically another DID).\n\t * @returns A promise that resolves when the alias has been added.\n\t * @throws GeneralError if the alias is not a Url or Urn.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\taddAlsoKnownAs(controller: string, documentId: string, alias: string): Promise<void>;\n\n\t/**\n\t * Remove an alias from the alsoKnownAs property on the document.\n\t * If the alias is not present the operation is a no-op.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to update.\n\t * @param alias The alias to remove. Must be a Url or Urn.\n\t * @returns A promise that resolves when the alias has been removed.\n\t * @throws GeneralError if the alias is not a Url or Urn.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tremoveAlsoKnownAs(controller: string, documentId: string, alias: string): Promise<void>;\n\n\t/**\n\t * Create a verifiable credential for a verification method.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param verificationMethodId The verification method id to use.\n\t * @param id The id of the credential.\n\t * @param subject The credential subject to store in the verifiable credential.\n\t * @param options Additional options for creating the verifiable credential.\n\t * @param options.revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.\n\t * @param options.expirationDate The date the verifiable credential is valid until.\n\t * @param options.jwtHeaderFields Additional fields to include in the JWT header when creating the verifiable credential in jwt format.\n\t * @param options.jwtPayloadFields\tAdditional fields to include in the JWT payload when creating the verifiable credential in jwt format.\n\t * @returns The created verifiable credential and its token.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tcreateVerifiableCredential(\n\t\tcontroller: string,\n\t\tverificationMethodId: string,\n\t\tid: string | undefined,\n\t\tsubject: IJsonLdNodeObject,\n\t\toptions?: {\n\t\t\trevocationIndex?: number;\n\t\t\texpirationDate?: Date;\n\t\t\tjwtHeaderFields?: { [id: string]: string };\n\t\t\tjwtPayloadFields?: { [id: string]: string };\n\t\t}\n\t): Promise<{\n\t\tverifiableCredential: IDidVerifiableCredential;\n\t\tjwt: string;\n\t}>;\n\n\t/**\n\t * Check a verifiable credential is valid.\n\t * @param credential The credential to verify.\n\t * @returns The credential stored in the jwt and the revocation status.\n\t */\n\tcheckVerifiableCredential(credential: string | IDidVerifiableCredential): Promise<{\n\t\trevoked: boolean;\n\t\tverifiableCredential?: IDidVerifiableCredential;\n\t}>;\n\n\t/**\n\t * Revoke verifiable credential(s).\n\t * @param controller The controller of the identity who can make changes.\n\t * @param issuerDocumentId The id of the document to update the revocation list for.\n\t * @param credentialIndices The revocation bitmap index or indices to revoke.\n\t * @returns A promise that resolves when the credentials have been revoked.\n\t */\n\trevokeVerifiableCredentials(\n\t\tcontroller: string,\n\t\tissuerDocumentId: string,\n\t\tcredentialIndices: number[]\n\t): Promise<void>;\n\n\t/**\n\t * Unrevoke verifiable credential(s).\n\t * @param controller The controller of the identity who can make changes.\n\t * @param issuerDocumentId The id of the document to update the revocation list for.\n\t * @param credentialIndices The revocation bitmap index or indices to unrevoke.\n\t * @returns A promise that resolves when the credentials have been unrevoked.\n\t */\n\tunrevokeVerifiableCredentials(\n\t\tcontroller: string,\n\t\tissuerDocumentId: string,\n\t\tcredentialIndices: number[]\n\t): Promise<void>;\n\n\t/**\n\t * Create a verifiable presentation from the supplied verifiable credentials.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param verificationMethodId The method to associate with the presentation.\n\t * @param presentationId The id of the presentation.\n\t * @param contexts The contexts for the data stored in the verifiable credential.\n\t * @param types The types for the data stored in the verifiable credential.\n\t * @param verifiableCredentials The credentials to use for creating the presentation in jwt format.\n\t * @param options Additional options for creating the verifiable presentation.\n\t * @param options.expirationDate The date the verifiable presentation is valid until.\n\t * @param options.jwtHeaderFields Additional fields to include in the JWT header when creating the verifiable presentation in jwt format.\n\t * @param options.jwtPayloadFields Additional fields to include in the JWT payload when creating the verifiable presentation in jwt format.\n\t * @returns The created verifiable presentation and its token.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tcreateVerifiablePresentation(\n\t\tcontroller: string,\n\t\tverificationMethodId: string,\n\t\tpresentationId: string | undefined,\n\t\tcontexts: IJsonLdContextDefinitionRoot | undefined,\n\t\ttypes: string | string[] | undefined,\n\t\tverifiableCredentials: (string | IDidVerifiableCredential)[],\n\t\toptions?: {\n\t\t\texpirationDate?: Date;\n\t\t\tjwtHeaderFields?: { [id: string]: string };\n\t\t\tjwtPayloadFields?: { [id: string]: string };\n\t\t}\n\t): Promise<{\n\t\tverifiablePresentation: IDidVerifiablePresentation;\n\t\tjwt: string;\n\t}>;\n\n\t/**\n\t * Check a verifiable presentation is valid.\n\t * @param presentation The presentation to verify.\n\t * @returns The presentation stored in the jwt and the revocation status.\n\t */\n\tcheckVerifiablePresentation(presentation: string | IDidVerifiablePresentation): Promise<{\n\t\trevoked: boolean;\n\t\tverifiablePresentation?: IDidVerifiablePresentation;\n\t\tissuers?: IDidDocument[];\n\t}>;\n\n\t/**\n\t * Create a proof for arbitrary data with the specified verification method.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param verificationMethodId The verification method id to use.\n\t * @param proofType The type of proof to create.\n\t * @param unsecureDocument The unsecure document to create the proof for.\n\t * @returns The proof.\n\t */\n\tcreateProof(\n\t\tcontroller: string,\n\t\tverificationMethodId: string,\n\t\tproofType: ProofTypes,\n\t\tunsecureDocument: IJsonLdNodeObject\n\t): Promise<IProof>;\n\n\t/**\n\t * Verify proof for arbitrary data with the specified verification method.\n\t * @param document The document to verify.\n\t * @param proof The proof to verify.\n\t * @returns True if the proof is verified.\n\t */\n\tverifyProof(document: IJsonLdNodeObject, proof: IProof): Promise<boolean>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IIdentityProfileComponent.js","sourceRoot":"","sources":["../../../src/models/IIdentityProfileComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdDocument } from \"@twin.org/data-json-ld\";\n\n/**\n * Interface describing a contract which provides profile operations.\n */\nexport interface IIdentityProfileComponent<\n\tT extends IJsonLdDocument = IJsonLdDocument,\n\tU extends IJsonLdDocument = IJsonLdDocument\n> extends IComponent {\n\t/**\n\t * Create the profile properties for an identity.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns
|
|
1
|
+
{"version":3,"file":"IIdentityProfileComponent.js","sourceRoot":"","sources":["../../../src/models/IIdentityProfileComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdDocument } from \"@twin.org/data-json-ld\";\n\n/**\n * Interface describing a contract which provides profile operations.\n */\nexport interface IIdentityProfileComponent<\n\tT extends IJsonLdDocument = IJsonLdDocument,\n\tU extends IJsonLdDocument = IJsonLdDocument\n> extends IComponent {\n\t/**\n\t * Create the profile properties for an identity.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns A promise that resolves when the profile has been created.\n\t */\n\tcreate(publicProfile?: T, privateProfile?: U, identity?: string): Promise<void>;\n\n\t/**\n\t * Get the profile properties for an identity.\n\t * @param publicPropertyNames The public properties to get for the profile, defaults to all.\n\t * @param privatePropertyNames The private properties to get for the profile, defaults to all.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns The items identity and the properties.\n\t */\n\tget(\n\t\tpublicPropertyNames?: (keyof T)[],\n\t\tprivatePropertyNames?: (keyof U)[],\n\t\tidentity?: string\n\t): Promise<{\n\t\tidentity: string;\n\t\tpublicProfile?: Partial<T>;\n\t\tprivateProfile?: Partial<U>;\n\t}>;\n\n\t/**\n\t * Get the public profile properties for an identity.\n\t * @param identity The identity to perform the profile operation on.\n\t * @param propertyNames The public properties to get for the profile, defaults to all.\n\t * @returns The items properties.\n\t */\n\tgetPublic(identity: string, propertyNames?: (keyof T)[]): Promise<Partial<T>>;\n\n\t/**\n\t * Update the profile properties of an identity.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns A promise that resolves when the profile has been updated.\n\t */\n\tupdate(publicProfile?: T, privateProfile?: U, identity?: string): Promise<void>;\n\n\t/**\n\t * Delete the profile for an identity.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns A promise that resolves when the profile has been removed.\n\t */\n\tremove(identity?: string): Promise<void>;\n\n\t/**\n\t * Get a list of the requested identities.\n\t * @param publicFilters The filters to apply to the identities public profiles.\n\t * @param publicPropertyNames The public properties to get for the profile, defaults to all.\n\t * @param cursor The cursor for paged requests.\n\t * @param limit The maximum number of items in a page.\n\t * @returns The list of items and cursor for paging.\n\t */\n\tlist(\n\t\tpublicFilters?: {\n\t\t\tpropertyName: string;\n\t\t\tpropertyValue: unknown;\n\t\t}[],\n\t\tpublicPropertyNames?: (keyof T)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\t/**\n\t\t * The identities.\n\t\t */\n\t\titems: {\n\t\t\tidentity: string;\n\t\t\tpublicProfile?: Partial<T>;\n\t\t}[];\n\t\t/**\n\t\t * An optional cursor, when defined can be used to call find to get more entities.\n\t\t */\n\t\tcursor?: string;\n\t}>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IIdentityProfileConnector.js","sourceRoot":"","sources":["../../../src/models/IIdentityProfileConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdDocument } from \"@twin.org/data-json-ld\";\n\n/**\n * Interface describing a contract which provides profile operations.\n */\nexport interface IIdentityProfileConnector<\n\tT extends IJsonLdDocument = IJsonLdDocument,\n\tU extends IJsonLdDocument = IJsonLdDocument\n> extends IComponent {\n\t/**\n\t * Create the profile properties for an identity.\n\t * @param identity The identity of the profile to create.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @returns
|
|
1
|
+
{"version":3,"file":"IIdentityProfileConnector.js","sourceRoot":"","sources":["../../../src/models/IIdentityProfileConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdDocument } from \"@twin.org/data-json-ld\";\n\n/**\n * Interface describing a contract which provides profile operations.\n */\nexport interface IIdentityProfileConnector<\n\tT extends IJsonLdDocument = IJsonLdDocument,\n\tU extends IJsonLdDocument = IJsonLdDocument\n> extends IComponent {\n\t/**\n\t * Create the profile properties for an identity.\n\t * @param identity The identity of the profile to create.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @returns A promise that resolves when the profile has been created.\n\t */\n\tcreate(identity: string, publicProfile?: T, privateProfile?: U): Promise<void>;\n\n\t/**\n\t * Get the profile properties for an identity.\n\t * @param identity The identity of the item to get.\n\t * @param publicPropertyNames The public properties to get for the profile, defaults to all.\n\t * @param privatePropertyNames The private properties to get for the profile, defaults to all.\n\t * @returns The identity profile, will only return private data if you have correct permissions.\n\t */\n\tget(\n\t\tidentity: string,\n\t\tpublicPropertyNames?: (keyof T)[],\n\t\tprivatePropertyNames?: (keyof U)[]\n\t): Promise<{\n\t\tpublicProfile: Partial<T>;\n\t\tprivateProfile: Partial<U>;\n\t}>;\n\n\t/**\n\t * Update the profile properties of an identity.\n\t * @param identity The identity to update.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @returns A promise that resolves when the profile has been updated.\n\t */\n\tupdate(identity: string, publicProfile?: T, privateProfile?: U): Promise<void>;\n\n\t/**\n\t * Delete the profile for an identity.\n\t * @param identity The identity to delete.\n\t * @returns A promise that resolves when the profile has been removed.\n\t */\n\tremove(identity: string): Promise<void>;\n\n\t/**\n\t * Get a list of the requested identities.\n\t * @param publicFilters The filters to apply to the identities public profiles.\n\t * @param privateFilters The filters to apply to the identities private profiles.\n\t * @param publicPropertyNames The public properties to get for the profile, defaults to all.\n\t * @param privatePropertyNames The private properties to get for the profile, defaults to all.\n\t * @param cursor The cursor for paged requests.\n\t * @param limit The maximum number of items in a page.\n\t * @returns The list of items and cursor for paging.\n\t */\n\tlist(\n\t\tpublicFilters?: {\n\t\t\tpropertyName: string;\n\t\t\tpropertyValue: unknown;\n\t\t}[],\n\t\tprivateFilters?: {\n\t\t\tpropertyName: string;\n\t\t\tpropertyValue: unknown;\n\t\t}[],\n\t\tpublicPropertyNames?: (keyof T)[],\n\t\tprivatePropertyNames?: (keyof U)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\t/**\n\t\t * The identity profiles.\n\t\t */\n\t\titems: {\n\t\t\tidentity: string;\n\t\t\tpublicProfile?: Partial<T>;\n\t\t\tprivateProfile?: Partial<U>;\n\t\t}[];\n\t\t/**\n\t\t * An optional cursor, when defined can be used to call find to get more entities.\n\t\t */\n\t\tcursor?: string;\n\t}>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IIdentityAlsoKnownAsCreateRequest.js","sourceRoot":"","sources":["../../../../../src/models/api/identity/IIdentityAlsoKnownAsCreateRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Request to create an alias for an identity.\n */\nexport interface IIdentityAlsoKnownAsCreateRequest {\n\t/**\n\t * The path parameters.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The identity to create the alias for.\n\t\t */\n\t\tidentity: string;\n\t};\n\n\t/**\n\t * The data for the request.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The alias to create for the identity.\n\t\t */\n\t\talias: string;\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IIdentityAlsoKnownAsRemoveRequest.js","sourceRoot":"","sources":["../../../../../src/models/api/identity/IIdentityAlsoKnownAsRemoveRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Request to remove an alias from an identity.\n */\nexport interface IIdentityAlsoKnownAsRemoveRequest {\n\t/**\n\t * The path parameters.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The identity to remove the alias from.\n\t\t */\n\t\tidentity: string;\n\n\t\t/**\n\t\t * The alias to remove.\n\t\t */\n\t\talias: string;\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IIdentityVerifiableCredentialCreateRequest.js","sourceRoot":"","sources":["../../../../../src/models/api/identity/IIdentityVerifiableCredentialCreateRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\n\n/**\n * Request to create a verifiable credential.\n */\nexport interface IIdentityVerifiableCredentialCreateRequest {\n\t/**\n\t * The path parameters.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The identity to create the verification credential for.\n\t\t */\n\t\tidentity: string;\n\n\t\t/**\n\t\t * The verification method id to use.\n\t\t */\n\t\tverificationMethodId: string;\n\t};\n\n\t/**\n\t * The data for the request.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The id of the credential.\n\t\t */\n\t\tcredentialId?: string;\n\n\t\t/**\n\t\t * The credential subject to store in the verifiable credential.\n\t\t */\n\t\tsubject: IJsonLdNodeObject;\n\n\t\t/**\n\t\t * The bitmap revocation index of the credential, if undefined will not have revocation status.\n\t\t */\n\t\trevocationIndex?: number;\n\n\t\t/**\n\t\t * The date the verifiable credential is valid until.\n\t\t */\n\t\texpirationDate?: string;\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IIdentityVerifiableCredentialCreateRequest.js","sourceRoot":"","sources":["../../../../../src/models/api/identity/IIdentityVerifiableCredentialCreateRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\n\n/**\n * Request to create a verifiable credential.\n */\nexport interface IIdentityVerifiableCredentialCreateRequest {\n\t/**\n\t * The path parameters.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The identity to create the verification credential for.\n\t\t */\n\t\tidentity: string;\n\n\t\t/**\n\t\t * The verification method id to use.\n\t\t */\n\t\tverificationMethodId: string;\n\t};\n\n\t/**\n\t * The data for the request.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The id of the credential.\n\t\t */\n\t\tcredentialId?: string;\n\n\t\t/**\n\t\t * The credential subject to store in the verifiable credential.\n\t\t */\n\t\tsubject: IJsonLdNodeObject;\n\n\t\t/**\n\t\t * The bitmap revocation index of the credential, if undefined will not have revocation status.\n\t\t */\n\t\trevocationIndex?: number;\n\n\t\t/**\n\t\t * The date the verifiable credential is valid until.\n\t\t */\n\t\texpirationDate?: string;\n\n\t\t/**\n\t\t * Additional fields to include in the JWT when creating the verifiable credential in jwt format.\n\t\t */\n\t\tjwtHeaderFields?: { [id: string]: string };\n\n\t\t/**\n\t\t * Additional fields to include in the JWT payload when creating the verifiable credential in jwt format.\n\t\t */\n\t\tjwtPayloadFields?: { [id: string]: string };\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IIdentityVerifiableCredentialVerifyDocumentRequest.js","sourceRoot":"","sources":["../../../../../src/models/api/identity/IIdentityVerifiableCredentialVerifyDocumentRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IDidVerifiableCredential } from \"@twin.org/standards-w3c-did\";\n\n/**\n * Request to verify a verifiable credential.\n */\nexport interface IIdentityVerifiableCredentialVerifyDocumentRequest {\n\t/**\n\t * The body parameters.\n\t */\n\tbody: IDidVerifiableCredential;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IIdentityVerifiablePresentationCreateRequest.js","sourceRoot":"","sources":["../../../../../src/models/api/identity/IIdentityVerifiablePresentationCreateRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdContextDefinitionRoot } from \"@twin.org/data-json-ld\";\nimport type { IDidVerifiableCredential } from \"@twin.org/standards-w3c-did\";\n\n/**\n * Request to create a verifiable presentation.\n */\nexport interface IIdentityVerifiablePresentationCreateRequest {\n\t/**\n\t * The path parameters.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The identity to create the verification presentation for.\n\t\t */\n\t\tidentity: string;\n\n\t\t/**\n\t\t * The verification method id to use.\n\t\t */\n\t\tverificationMethodId: string;\n\t};\n\n\t/**\n\t * The data for the request.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The id of the presentation.\n\t\t */\n\t\tpresentationId?: string;\n\n\t\t/**\n\t\t * The context to use for the presentation.\n\t\t */\n\t\tcontexts?: IJsonLdContextDefinitionRoot;\n\n\t\t/**\n\t\t * The types of the presentation.\n\t\t */\n\t\ttypes?: string | string[];\n\n\t\t/**\n\t\t * The verifiable credentials to include in the presentation.\n\t\t */\n\t\tverifiableCredentials: (string | IDidVerifiableCredential)[];\n\n\t\t/**\n\t\t * The expiration time for the presentation.\n\t\t */\n\t\
|
|
1
|
+
{"version":3,"file":"IIdentityVerifiablePresentationCreateRequest.js","sourceRoot":"","sources":["../../../../../src/models/api/identity/IIdentityVerifiablePresentationCreateRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdContextDefinitionRoot } from \"@twin.org/data-json-ld\";\nimport type { IDidVerifiableCredential } from \"@twin.org/standards-w3c-did\";\n\n/**\n * Request to create a verifiable presentation.\n */\nexport interface IIdentityVerifiablePresentationCreateRequest {\n\t/**\n\t * The path parameters.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The identity to create the verification presentation for.\n\t\t */\n\t\tidentity: string;\n\n\t\t/**\n\t\t * The verification method id to use.\n\t\t */\n\t\tverificationMethodId: string;\n\t};\n\n\t/**\n\t * The data for the request.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The id of the presentation.\n\t\t */\n\t\tpresentationId?: string;\n\n\t\t/**\n\t\t * The context to use for the presentation.\n\t\t */\n\t\tcontexts?: IJsonLdContextDefinitionRoot;\n\n\t\t/**\n\t\t * The types of the presentation.\n\t\t */\n\t\ttypes?: string | string[];\n\n\t\t/**\n\t\t * The verifiable credentials to include in the presentation.\n\t\t */\n\t\tverifiableCredentials: (string | IDidVerifiableCredential)[];\n\n\t\t/**\n\t\t * The expiration date/time for the presentation.\n\t\t */\n\t\texpirationDate?: string;\n\n\t\t/**\n\t\t * Additional fields to include in the JWT header when creating the verifiable presentation in jwt format.\n\t\t */\n\t\tjwtHeaderFields?: { [id: string]: string };\n\n\t\t/**\n\t\t * Additional fields to include in the JWT payload when creating the verifiable presentation in jwt format.\n\t\t */\n\t\tjwtPayloadFields?: { [id: string]: string };\n\t};\n}\n"]}
|
package/dist/es/models/api/identity/IIdentityVerifiablePresentationVerifyDocumentRequest.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IIdentityVerifiablePresentationVerifyDocumentRequest.js","sourceRoot":"","sources":["../../../../../src/models/api/identity/IIdentityVerifiablePresentationVerifyDocumentRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IDidVerifiablePresentation } from \"@twin.org/standards-w3c-did\";\n\n/**\n * Request to verify a verifiable presentation.\n */\nexport interface IIdentityVerifiablePresentationVerifyDocumentRequest {\n\t/**\n\t * The body parameters.\n\t */\n\tbody: IDidVerifiablePresentation;\n}\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Copyright 2026 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
/**
|
|
4
|
+
* Metric IDs for the identity service.
|
|
5
|
+
*/
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
export const IdentityMetricIds = {
|
|
8
|
+
/**
|
|
9
|
+
* Number of DIDs created.
|
|
10
|
+
*/
|
|
11
|
+
DidsCreated: "identity_dids_created",
|
|
12
|
+
/**
|
|
13
|
+
* Number of DIDs removed.
|
|
14
|
+
*/
|
|
15
|
+
DidsRemoved: "identity_dids_removed",
|
|
16
|
+
/**
|
|
17
|
+
* Number of verifiable credentials created.
|
|
18
|
+
*/
|
|
19
|
+
VcsCreated: "identity_vcs_created",
|
|
20
|
+
/**
|
|
21
|
+
* Number of VC verifications succeeded.
|
|
22
|
+
*/
|
|
23
|
+
VcsVerified: "identity_vcs_verified",
|
|
24
|
+
/**
|
|
25
|
+
* Number of VC verifications failed.
|
|
26
|
+
*/
|
|
27
|
+
VcsVerificationFailed: "identity_vcs_verification_failed",
|
|
28
|
+
/**
|
|
29
|
+
* Number of VCs revoked.
|
|
30
|
+
*/
|
|
31
|
+
VcsRevoked: "identity_vcs_revoked",
|
|
32
|
+
/**
|
|
33
|
+
* Number of VCs unrevoked.
|
|
34
|
+
*/
|
|
35
|
+
VcsUnrevoked: "identity_vcs_unrevoked",
|
|
36
|
+
/**
|
|
37
|
+
* Number of verifiable presentations created.
|
|
38
|
+
*/
|
|
39
|
+
VpsCreated: "identity_vps_created",
|
|
40
|
+
/**
|
|
41
|
+
* Number of VP verifications succeeded.
|
|
42
|
+
*/
|
|
43
|
+
VpsVerified: "identity_vps_verified",
|
|
44
|
+
/**
|
|
45
|
+
* Number of VP verifications failed.
|
|
46
|
+
*/
|
|
47
|
+
VpsVerificationFailed: "identity_vps_verification_failed"
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=identityMetricIds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identityMetricIds.js","sourceRoot":"","sources":["../../../src/models/identityMetricIds.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC;;OAEG;IACH,WAAW,EAAE,uBAAuB;IAEpC;;OAEG;IACH,WAAW,EAAE,uBAAuB;IAEpC;;OAEG;IACH,UAAU,EAAE,sBAAsB;IAElC;;OAEG;IACH,WAAW,EAAE,uBAAuB;IAEpC;;OAEG;IACH,qBAAqB,EAAE,kCAAkC;IAEzD;;OAEG;IACH,UAAU,EAAE,sBAAsB;IAElC;;OAEG;IACH,YAAY,EAAE,wBAAwB;IAEtC;;OAEG;IACH,UAAU,EAAE,sBAAsB;IAElC;;OAEG;IACH,WAAW,EAAE,uBAAuB;IAEpC;;OAEG;IACH,qBAAqB,EAAE,kCAAkC;CAChD,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Metric IDs for the identity service.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const IdentityMetricIds = {\n\t/**\n\t * Number of DIDs created.\n\t */\n\tDidsCreated: \"identity_dids_created\",\n\n\t/**\n\t * Number of DIDs removed.\n\t */\n\tDidsRemoved: \"identity_dids_removed\",\n\n\t/**\n\t * Number of verifiable credentials created.\n\t */\n\tVcsCreated: \"identity_vcs_created\",\n\n\t/**\n\t * Number of VC verifications succeeded.\n\t */\n\tVcsVerified: \"identity_vcs_verified\",\n\n\t/**\n\t * Number of VC verifications failed.\n\t */\n\tVcsVerificationFailed: \"identity_vcs_verification_failed\",\n\n\t/**\n\t * Number of VCs revoked.\n\t */\n\tVcsRevoked: \"identity_vcs_revoked\",\n\n\t/**\n\t * Number of VCs unrevoked.\n\t */\n\tVcsUnrevoked: \"identity_vcs_unrevoked\",\n\n\t/**\n\t * Number of verifiable presentations created.\n\t */\n\tVpsCreated: \"identity_vps_created\",\n\n\t/**\n\t * Number of VP verifications succeeded.\n\t */\n\tVpsVerified: \"identity_vps_verified\",\n\n\t/**\n\t * Number of VP verifications failed.\n\t */\n\tVpsVerificationFailed: \"identity_vps_verification_failed\"\n} as const;\n\n/**\n * Union type of all identity service metric ID string values.\n */\nexport type IdentityMetricIds = (typeof IdentityMetricIds)[keyof typeof IdentityMetricIds];\n"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Copyright 2026 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { MetricType } from "@twin.org/telemetry-models";
|
|
4
|
+
import { IdentityMetricIds } from "./identityMetricIds.js";
|
|
5
|
+
/**
|
|
6
|
+
* Metrics registered by the identity service.
|
|
7
|
+
*/
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
9
|
+
export const IdentityMetrics = [
|
|
10
|
+
{
|
|
11
|
+
id: IdentityMetricIds.DidsCreated,
|
|
12
|
+
label: "DIDs created",
|
|
13
|
+
type: MetricType.Counter
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: IdentityMetricIds.DidsRemoved,
|
|
17
|
+
label: "DIDs removed",
|
|
18
|
+
type: MetricType.Counter
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: IdentityMetricIds.VcsCreated,
|
|
22
|
+
label: "VCs created",
|
|
23
|
+
type: MetricType.Counter
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: IdentityMetricIds.VcsVerified,
|
|
27
|
+
label: "VC verifications succeeded",
|
|
28
|
+
type: MetricType.Counter
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: IdentityMetricIds.VcsVerificationFailed,
|
|
32
|
+
label: "VC verifications failed",
|
|
33
|
+
type: MetricType.Counter
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: IdentityMetricIds.VcsRevoked,
|
|
37
|
+
label: "VCs revoked",
|
|
38
|
+
type: MetricType.Counter
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: IdentityMetricIds.VcsUnrevoked,
|
|
42
|
+
label: "VCs unrevoked",
|
|
43
|
+
type: MetricType.Counter
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: IdentityMetricIds.VpsCreated,
|
|
47
|
+
label: "VPs created",
|
|
48
|
+
type: MetricType.Counter
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: IdentityMetricIds.VpsVerified,
|
|
52
|
+
label: "VP verifications succeeded",
|
|
53
|
+
type: MetricType.Counter
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: IdentityMetricIds.VpsVerificationFailed,
|
|
57
|
+
label: "VP verifications failed",
|
|
58
|
+
type: MetricType.Counter
|
|
59
|
+
}
|
|
60
|
+
];
|
|
61
|
+
//# sourceMappingURL=identityMetrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identityMetrics.js","sourceRoot":"","sources":["../../../src/models/identityMetrics.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAyB,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,eAAe,GAAuB;IAClD;QACC,EAAE,EAAE,iBAAiB,CAAC,WAAW;QACjC,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,UAAU,CAAC,OAAO;KACxB;IACD;QACC,EAAE,EAAE,iBAAiB,CAAC,WAAW;QACjC,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,UAAU,CAAC,OAAO;KACxB;IACD;QACC,EAAE,EAAE,iBAAiB,CAAC,UAAU;QAChC,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,UAAU,CAAC,OAAO;KACxB;IACD;QACC,EAAE,EAAE,iBAAiB,CAAC,WAAW;QACjC,KAAK,EAAE,4BAA4B;QACnC,IAAI,EAAE,UAAU,CAAC,OAAO;KACxB;IACD;QACC,EAAE,EAAE,iBAAiB,CAAC,qBAAqB;QAC3C,KAAK,EAAE,yBAAyB;QAChC,IAAI,EAAE,UAAU,CAAC,OAAO;KACxB;IACD;QACC,EAAE,EAAE,iBAAiB,CAAC,UAAU;QAChC,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,UAAU,CAAC,OAAO;KACxB;IACD;QACC,EAAE,EAAE,iBAAiB,CAAC,YAAY;QAClC,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,UAAU,CAAC,OAAO;KACxB;IACD;QACC,EAAE,EAAE,iBAAiB,CAAC,UAAU;QAChC,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,UAAU,CAAC,OAAO;KACxB;IACD;QACC,EAAE,EAAE,iBAAiB,CAAC,WAAW;QACjC,KAAK,EAAE,4BAA4B;QACnC,IAAI,EAAE,UAAU,CAAC,OAAO;KACxB;IACD;QACC,EAAE,EAAE,iBAAiB,CAAC,qBAAqB;QAC3C,KAAK,EAAE,yBAAyB;QAChC,IAAI,EAAE,UAAU,CAAC,OAAO;KACxB;CACD,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { type ITelemetryMetric, MetricType } from \"@twin.org/telemetry-models\";\nimport { IdentityMetricIds } from \"./identityMetricIds.js\";\n\n/**\n * Metrics registered by the identity service.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const IdentityMetrics: ITelemetryMetric[] = [\n\t{\n\t\tid: IdentityMetricIds.DidsCreated,\n\t\tlabel: \"DIDs created\",\n\t\ttype: MetricType.Counter\n\t},\n\t{\n\t\tid: IdentityMetricIds.DidsRemoved,\n\t\tlabel: \"DIDs removed\",\n\t\ttype: MetricType.Counter\n\t},\n\t{\n\t\tid: IdentityMetricIds.VcsCreated,\n\t\tlabel: \"VCs created\",\n\t\ttype: MetricType.Counter\n\t},\n\t{\n\t\tid: IdentityMetricIds.VcsVerified,\n\t\tlabel: \"VC verifications succeeded\",\n\t\ttype: MetricType.Counter\n\t},\n\t{\n\t\tid: IdentityMetricIds.VcsVerificationFailed,\n\t\tlabel: \"VC verifications failed\",\n\t\ttype: MetricType.Counter\n\t},\n\t{\n\t\tid: IdentityMetricIds.VcsRevoked,\n\t\tlabel: \"VCs revoked\",\n\t\ttype: MetricType.Counter\n\t},\n\t{\n\t\tid: IdentityMetricIds.VcsUnrevoked,\n\t\tlabel: \"VCs unrevoked\",\n\t\ttype: MetricType.Counter\n\t},\n\t{\n\t\tid: IdentityMetricIds.VpsCreated,\n\t\tlabel: \"VPs created\",\n\t\ttype: MetricType.Counter\n\t},\n\t{\n\t\tid: IdentityMetricIds.VpsVerified,\n\t\tlabel: \"VP verifications succeeded\",\n\t\ttype: MetricType.Counter\n\t},\n\t{\n\t\tid: IdentityMetricIds.VpsVerificationFailed,\n\t\tlabel: \"VP verifications failed\",\n\t\ttype: MetricType.Counter\n\t}\n];\n"]}
|
package/dist/es/types/did.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
3
|
import { GuardError, Urn } from "@twin.org/core";
|
|
4
4
|
/**
|
|
5
|
-
* Helper methods for
|
|
5
|
+
* Helper methods for parsing and validating DID identifiers.
|
|
6
6
|
*/
|
|
7
7
|
export class Did {
|
|
8
8
|
/**
|
|
@@ -10,7 +10,7 @@ export class Did {
|
|
|
10
10
|
*/
|
|
11
11
|
static CLASS_NAME = "Did";
|
|
12
12
|
/**
|
|
13
|
-
* Parse
|
|
13
|
+
* Parse an id into its constituent parts.
|
|
14
14
|
* @param id The id to parse.
|
|
15
15
|
* @returns The parsed id.
|
|
16
16
|
* @throws GeneralError if the id is not valid.
|
|
@@ -35,7 +35,7 @@ export class Did {
|
|
|
35
35
|
* Guard a string as a DID.
|
|
36
36
|
* @param source The source of the error.
|
|
37
37
|
* @param property The name of the property.
|
|
38
|
-
* @param value The
|
|
38
|
+
* @param value The value to assert as a valid DID.
|
|
39
39
|
* @throws GuardError If the value does not match the assertion.
|
|
40
40
|
*/
|
|
41
41
|
static guard(source, property, value) {
|
package/dist/es/types/did.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"did.js","sourceRoot":"","sources":["../../../src/types/did.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAGjD;;GAEG;AACH,MAAM,OAAO,GAAG;IACf;;OAEG;IACI,MAAM,CAAU,UAAU,SAAyB;IAE1D;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,EAAU;QAK7B,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,QAAc,EAAE,CAAC,CAAC;QAE1C,MAAM,MAAM,GAAG,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;QAEhC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO;gBACN,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;gBACnB,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;aACf,CAAC;QACH,CAAC;QACD,OAAO;YACN,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;YACnB,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;YACpB,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;SACjC,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,MAAc,EAAE,QAAgB,EAAE,KAAc;QACnE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QAChD,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC;QAE1B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,sBAAsB,WAAiB,KAAK,CAAC,CAAC;QACpF,CAAC;QAED,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC;YACxB,MAAM,IAAI,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,uBAAuB,WAAiB,KAAK,CAAC,CAAC;QACrF,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { GuardError, Urn } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Helper methods for
|
|
1
|
+
{"version":3,"file":"did.js","sourceRoot":"","sources":["../../../src/types/did.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAGjD;;GAEG;AACH,MAAM,OAAO,GAAG;IACf;;OAEG;IACI,MAAM,CAAU,UAAU,SAAyB;IAE1D;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,EAAU;QAK7B,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,QAAc,EAAE,CAAC,CAAC;QAE1C,MAAM,MAAM,GAAG,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;QAEhC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO;gBACN,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;gBACnB,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;aACf,CAAC;QACH,CAAC;QACD,OAAO;YACN,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;YACnB,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;YACpB,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;SACjC,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,MAAc,EAAE,QAAgB,EAAE,KAAc;QACnE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QAChD,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC;QAE1B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,sBAAsB,WAAiB,KAAK,CAAC,CAAC;QACpF,CAAC;QAED,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC;YACxB,MAAM,IAAI,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,uBAAuB,WAAiB,KAAK,CAAC,CAAC;QACrF,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { GuardError, Urn } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Helper methods for parsing and validating DID identifiers.\n */\nexport class Did {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<Did>();\n\n\t/**\n\t * Parse an id into its constituent parts.\n\t * @param id The id to parse.\n\t * @returns The parsed id.\n\t * @throws GeneralError if the id is not valid.\n\t */\n\tpublic static parse(id: string): {\n\t\tmethod: string;\n\t\tnetwork?: string | undefined;\n\t\tid: string;\n\t} {\n\t\tDid.guard(Did.CLASS_NAME, nameof(id), id);\n\n\t\tconst didUrn = Urn.fromValidString(id);\n\t\tconst didParts = didUrn.parts();\n\n\t\tif (didParts.length === 3) {\n\t\t\treturn {\n\t\t\t\tmethod: didParts[1],\n\t\t\t\tid: didParts[2]\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tmethod: didParts[1],\n\t\t\tnetwork: didParts[2],\n\t\t\tid: didParts[didParts.length - 1]\n\t\t};\n\t}\n\n\t/**\n\t * Guard a string as a DID.\n\t * @param source The source of the error.\n\t * @param property The name of the property.\n\t * @param value The value to assert as a valid DID.\n\t * @throws GuardError If the value does not match the assertion.\n\t */\n\tpublic static guard(source: string, property: string, value: unknown): asserts value is string {\n\t\tUrn.guard(Did.CLASS_NAME, nameof(value), value);\n\t\tconst urn = Urn.fromValidString(value);\n\t\tconst parts = urn.parts();\n\n\t\tif (parts.length < 3) {\n\t\t\tthrow new GuardError(Did.CLASS_NAME, \"guard.didPartsTooFew\", nameof(value), value);\n\t\t}\n\n\t\tif (parts[0] !== \"did\") {\n\t\t\tthrow new GuardError(Did.CLASS_NAME, \"guard.didInvalidStart\", nameof(value), value);\n\t\t}\n\t}\n}\n"]}
|
|
@@ -13,10 +13,10 @@ export class VerificationHelper {
|
|
|
13
13
|
*/
|
|
14
14
|
static CLASS_NAME = "VerificationHelper";
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Verify the JWT and return the decoded header and payload.
|
|
17
17
|
* @param resolver The resolver to use for finding the document.
|
|
18
18
|
* @param jwt The token to verify.
|
|
19
|
-
* @returns The decoded payload.
|
|
19
|
+
* @returns The decoded header and payload.
|
|
20
20
|
*/
|
|
21
21
|
static async verifyJwt(resolver, jwt) {
|
|
22
22
|
Guards.object(VerificationHelper.CLASS_NAME, "resolver", resolver);
|
|
@@ -38,10 +38,10 @@ export class VerificationHelper {
|
|
|
38
38
|
return Jwt.verify(jwt, publicKey);
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* Verify the proof for the document.
|
|
42
42
|
* @param resolver The resolver to use for finding the document.
|
|
43
43
|
* @param secureDocument The secure document to verify.
|
|
44
|
-
* @returns True if the
|
|
44
|
+
* @returns True if all proofs in the document are verified successfully.
|
|
45
45
|
*/
|
|
46
46
|
static async verifyProof(resolver, secureDocument) {
|
|
47
47
|
Guards.object(VerificationHelper.CLASS_NAME, "resolver", resolver);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verificationHelper.js","sourceRoot":"","sources":["../../../src/utils/verificationHelper.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { GeneralError, Guards, Is } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { ProofHelper, type IDidDocument, type IProof } from \"@twin.org/standards-w3c-did\";\nimport { Jwk, Jwt, type IJwtHeader, type IJwtPayload } from \"@twin.org/web\";\nimport { DocumentHelper } from \"./documentHelper.js\";\nimport type { IIdentityResolverComponent } from \"../models/IIdentityResolverComponent.js\";\n\n/**\n * Helper methods for verification.\n */\nexport class VerificationHelper {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<VerificationHelper>();\n\n\t/**\n\t *
|
|
1
|
+
{"version":3,"file":"verificationHelper.js","sourceRoot":"","sources":["../../../src/utils/verificationHelper.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { GeneralError, Guards, Is } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { ProofHelper, type IDidDocument, type IProof } from \"@twin.org/standards-w3c-did\";\nimport { Jwk, Jwt, type IJwtHeader, type IJwtPayload } from \"@twin.org/web\";\nimport { DocumentHelper } from \"./documentHelper.js\";\nimport type { IIdentityResolverComponent } from \"../models/IIdentityResolverComponent.js\";\n\n/**\n * Helper methods for verification.\n */\nexport class VerificationHelper {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<VerificationHelper>();\n\n\t/**\n\t * Verify the JWT and return the decoded header and payload.\n\t * @param resolver The resolver to use for finding the document.\n\t * @param jwt The token to verify.\n\t * @returns The decoded header and payload.\n\t */\n\tpublic static async verifyJwt<T extends IJwtHeader, U extends IJwtPayload>(\n\t\tresolver: IIdentityResolverComponent,\n\t\tjwt: string\n\t): Promise<{\n\t\theader: T;\n\t\tpayload: U;\n\t}> {\n\t\tGuards.object<IIdentityResolverComponent>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(resolver),\n\t\t\tresolver\n\t\t);\n\t\tGuards.string(VerificationHelper.CLASS_NAME, nameof(jwt), jwt);\n\n\t\tconst jwtDecoded = await Jwt.decode<T, U>(jwt);\n\n\t\tconst jwtHeader = jwtDecoded.header;\n\t\tconst jwtPayload = jwtDecoded.payload;\n\t\tconst jwtSignature = jwtDecoded.signature;\n\n\t\tif (!Is.object(jwtHeader) || !Is.object(jwtPayload) || !Is.uint8Array(jwtSignature)) {\n\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"jwtDecodeFailed\");\n\t\t}\n\n\t\tconst iss = jwtHeader?.iss;\n\t\tconst kid = jwtHeader?.kid;\n\n\t\tGuards.stringValue(VerificationHelper.CLASS_NAME, nameof(iss), iss);\n\t\tGuards.stringValue(VerificationHelper.CLASS_NAME, nameof(kid), kid);\n\n\t\tconst didDocument = await resolver.identityResolve(iss);\n\n\t\tconst jwk = DocumentHelper.getJwk(didDocument, kid);\n\n\t\tconst publicKey = await Jwk.toCryptoKey(jwk);\n\n\t\treturn Jwt.verify(jwt, publicKey);\n\t}\n\n\t/**\n\t * Verify the proof for the document.\n\t * @param resolver The resolver to use for finding the document.\n\t * @param secureDocument The secure document to verify.\n\t * @returns True if all proofs in the document are verified successfully.\n\t */\n\tpublic static async verifyProof(\n\t\tresolver: IIdentityResolverComponent,\n\t\tsecureDocument: IJsonLdNodeObject\n\t): Promise<boolean> {\n\t\tGuards.object<IIdentityResolverComponent>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(resolver),\n\t\t\tresolver\n\t\t);\n\t\tGuards.object<IJsonLdNodeObject>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(secureDocument),\n\t\t\tsecureDocument\n\t\t);\n\t\tGuards.object<IJsonLdNodeObject>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(secureDocument.proof),\n\t\t\tsecureDocument.proof\n\t\t);\n\n\t\tconst proofList = Is.array<IProof>(secureDocument.proof)\n\t\t\t? secureDocument.proof\n\t\t\t: [secureDocument.proof];\n\n\t\tconst documentCache: { [key: string]: IDidDocument } = {};\n\n\t\tfor (const proof of proofList as IProof[]) {\n\t\t\tif (!Is.stringValue(proof?.verificationMethod)) {\n\t\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"proofMissingVerificationMethod\");\n\t\t\t}\n\n\t\t\tconst proofVerificationMethod = DocumentHelper.parseId(proof.verificationMethod);\n\t\t\tif (!Is.stringValue(proofVerificationMethod.fragment)) {\n\t\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"proofMissingVerificationMethod\");\n\t\t\t}\n\n\t\t\tlet document: IDidDocument;\n\n\t\t\tif (documentCache[proofVerificationMethod.id]) {\n\t\t\t\tdocument = documentCache[proofVerificationMethod.id];\n\t\t\t} else {\n\t\t\t\tdocument = await resolver.identityResolve(proofVerificationMethod.id);\n\t\t\t\tdocumentCache[proofVerificationMethod.id] = document;\n\t\t\t}\n\n\t\t\tconst verificationJwk = DocumentHelper.getJwk(document, proofVerificationMethod.id);\n\n\t\t\tconst verified = await ProofHelper.verifyProof(secureDocument, proof, verificationJwk);\n\n\t\t\tif (!verified) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IContextIdHandler } from "@twin.org/context";
|
|
2
2
|
/**
|
|
3
|
-
* Context
|
|
3
|
+
* Context ID handler that treats context identifiers as DIDs.
|
|
4
4
|
*/
|
|
5
5
|
export declare class DidContextIdHandler implements IContextIdHandler {
|
|
6
6
|
/**
|
|
@@ -19,9 +19,9 @@ export declare class DidContextIdHandler implements IContextIdHandler {
|
|
|
19
19
|
*/
|
|
20
20
|
short(value: string): string;
|
|
21
21
|
/**
|
|
22
|
-
* Guard the value ensuring
|
|
22
|
+
* Guard the value ensuring it is a valid DID.
|
|
23
23
|
* @param value The value to guard.
|
|
24
|
-
* @throws GeneralError if the value is
|
|
24
|
+
* @throws GeneralError if the value is not a valid DID.
|
|
25
25
|
*/
|
|
26
26
|
guard(value: string): void;
|
|
27
27
|
}
|