@twin.org/immutable-proof-task 0.0.2-next.2 → 0.0.3-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{esm/index.mjs → es/immutableProofTask.js} +18 -15
- package/dist/es/immutableProofTask.js.map +1 -0
- package/dist/es/index.js +6 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IImmutableProofTaskPayload.js +2 -0
- package/dist/es/models/IImmutableProofTaskPayload.js.map +1 -0
- package/dist/es/models/IImmutableProofTaskResult.js +2 -0
- package/dist/es/models/IImmutableProofTaskResult.js.map +1 -0
- package/dist/types/immutableProofTask.d.ts +5 -3
- package/dist/types/index.d.ts +3 -3
- package/dist/types/models/IImmutableProofTaskPayload.d.ts +2 -2
- package/docs/changelog.md +21 -0
- package/docs/reference/functions/processProofTask.md +7 -1
- package/docs/reference/interfaces/IImmutableProofTaskPayload.md +3 -3
- package/package.json +19 -8
- package/dist/cjs/index.cjs +0 -46
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { Guards, Is } from '@twin.org/core';
|
|
2
|
-
import { EngineCore } from '@twin.org/engine-core';
|
|
3
|
-
import { IdentityConnectorFactory } from '@twin.org/identity-models';
|
|
4
|
-
import { ProofTypes } from '@twin.org/standards-w3c-did';
|
|
5
|
-
|
|
6
1
|
// Copyright 2024 IOTA Stiftung.
|
|
7
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { ContextIdStore } from "@twin.org/context";
|
|
4
|
+
import { Guards, Is } from "@twin.org/core";
|
|
5
|
+
import { EngineCore } from "@twin.org/engine-core";
|
|
6
|
+
import { IdentityConnectorFactory } from "@twin.org/identity-models";
|
|
7
|
+
import { ProofTypes } from "@twin.org/standards-w3c-did";
|
|
8
8
|
const CLASS_NAME = "ImmutableProofTask";
|
|
9
9
|
/**
|
|
10
10
|
* Process a proof.
|
|
11
11
|
* @param engineCloneData The engine clone data.
|
|
12
|
+
* @param contextIds The context IDs.
|
|
12
13
|
* @param payload The payload to process.
|
|
13
14
|
* @returns The proof.
|
|
14
15
|
*/
|
|
15
|
-
async function processProofTask(engineCloneData, payload) {
|
|
16
|
+
export async function processProofTask(engineCloneData, contextIds, payload) {
|
|
16
17
|
Guards.objectValue(CLASS_NAME, "payload", payload);
|
|
17
|
-
Guards.stringValue(CLASS_NAME, "payload.
|
|
18
|
+
Guards.stringValue(CLASS_NAME, "payload.identity", payload.identity);
|
|
18
19
|
Guards.stringValue(CLASS_NAME, "payload.identityConnectorType", payload.identityConnectorType);
|
|
19
20
|
Guards.stringValue(CLASS_NAME, "payload.verificationMethodId", payload.verificationMethodId);
|
|
20
21
|
Guards.object(CLASS_NAME, "payload.document", payload.document);
|
|
@@ -27,12 +28,15 @@ async function processProofTask(engineCloneData, payload) {
|
|
|
27
28
|
engine.populateClone(engineCloneData, true);
|
|
28
29
|
await engine.start();
|
|
29
30
|
}
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
const result = await ContextIdStore.run(contextIds, async () => {
|
|
32
|
+
const identityConnector = IdentityConnectorFactory.get(payload.identityConnectorType);
|
|
33
|
+
const proof = await identityConnector.createProof(payload.identity, `${payload.identity}#${payload.verificationMethodId}`, ProofTypes.DataIntegrityProof, payload.document);
|
|
34
|
+
return {
|
|
35
|
+
proofId: payload.proofId,
|
|
36
|
+
proof: proof
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
return result;
|
|
36
40
|
}
|
|
37
41
|
finally {
|
|
38
42
|
if (!Is.empty(engine)) {
|
|
@@ -40,5 +44,4 @@ async function processProofTask(engineCloneData, payload) {
|
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
|
-
|
|
44
|
-
export { processProofTask };
|
|
47
|
+
//# sourceMappingURL=immutableProofTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"immutableProofTask.js","sourceRoot":"","sources":["../../src/immutableProofTask.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAoB,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAA4B,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAInF,MAAM,UAAU,GAAG,oBAAoB,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,eAAiC,EACjC,UAAuB,EACvB,OAAmC;IAEnC,MAAM,CAAC,WAAW,CAA6B,UAAU,aAAmB,OAAO,CAAC,CAAC;IACrF,MAAM,CAAC,WAAW,CAAC,UAAU,sBAA4B,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3E,MAAM,CAAC,WAAW,CACjB,UAAU,mCAEV,OAAO,CAAC,qBAAqB,CAC7B,CAAC;IACF,MAAM,CAAC,WAAW,CACjB,UAAU,kCAEV,OAAO,CAAC,oBAAoB,CAC5B,CAAC;IACF,MAAM,CAAC,MAAM,CAAoB,UAAU,sBAA4B,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEzF,IAAI,MAA+B,CAAC;IACpC,IAAI,CAAC;QACJ,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC;YAChC,uFAAuF;YACvF,2DAA2D;YAC3D,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;YAC1B,MAAM,CAAC,aAAa,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;YAC5C,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,IAAI,EAAE;YAC9D,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,GAAG,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;YAEtF,MAAM,KAAK,GAAG,MAAM,iBAAiB,CAAC,WAAW,CAChD,OAAO,CAAC,QAAQ,EAChB,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,oBAAoB,EAAE,EACrD,UAAU,CAAC,kBAAkB,EAC7B,OAAO,CAAC,QAAQ,CAChB,CAAC;YAEF,OAAO;gBACN,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,KAAK,EAAE,KAA4B;aACnC,CAAC;QACH,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IACf,CAAC;YAAS,CAAC;QACV,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YACvB,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ContextIdStore, type IContextIds } from \"@twin.org/context\";\nimport { Guards, Is } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport { EngineCore } from \"@twin.org/engine-core\";\nimport type { IEngineCore, IEngineCoreClone } from \"@twin.org/engine-models\";\nimport { IdentityConnectorFactory } from \"@twin.org/identity-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { type IDataIntegrityProof, ProofTypes } from \"@twin.org/standards-w3c-did\";\nimport type { IImmutableProofTaskPayload } from \"./models/IImmutableProofTaskPayload.js\";\nimport type { IImmutableProofTaskResult } from \"./models/IImmutableProofTaskResult.js\";\n\nconst CLASS_NAME = \"ImmutableProofTask\";\n\n/**\n * Process a proof.\n * @param engineCloneData The engine clone data.\n * @param contextIds The context IDs.\n * @param payload The payload to process.\n * @returns The proof.\n */\nexport async function processProofTask(\n\tengineCloneData: IEngineCoreClone,\n\tcontextIds: IContextIds,\n\tpayload: IImmutableProofTaskPayload\n): Promise<IImmutableProofTaskResult> {\n\tGuards.objectValue<IImmutableProofTaskPayload>(CLASS_NAME, nameof(payload), payload);\n\tGuards.stringValue(CLASS_NAME, nameof(payload.identity), payload.identity);\n\tGuards.stringValue(\n\t\tCLASS_NAME,\n\t\tnameof(payload.identityConnectorType),\n\t\tpayload.identityConnectorType\n\t);\n\tGuards.stringValue(\n\t\tCLASS_NAME,\n\t\tnameof(payload.verificationMethodId),\n\t\tpayload.verificationMethodId\n\t);\n\tGuards.object<IJsonLdNodeObject>(CLASS_NAME, nameof(payload.document), payload.document);\n\n\tlet engine: IEngineCore | undefined;\n\ttry {\n\t\tif (!Is.empty(engineCloneData)) {\n\t\t\t// If the clone data is not empty we use it to create a new engine as it's a new thread\n\t\t\t// otherwise we assume the factories are already populated.\n\t\t\tengine = new EngineCore();\n\t\t\tengine.populateClone(engineCloneData, true);\n\t\t\tawait engine.start();\n\t\t}\n\n\t\tconst result = await ContextIdStore.run(contextIds, async () => {\n\t\t\tconst identityConnector = IdentityConnectorFactory.get(payload.identityConnectorType);\n\n\t\t\tconst proof = await identityConnector.createProof(\n\t\t\t\tpayload.identity,\n\t\t\t\t`${payload.identity}#${payload.verificationMethodId}`,\n\t\t\t\tProofTypes.DataIntegrityProof,\n\t\t\t\tpayload.document\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tproofId: payload.proofId,\n\t\t\t\tproof: proof as IDataIntegrityProof\n\t\t\t};\n\t\t});\n\t\treturn result;\n\t} finally {\n\t\tif (!Is.empty(engine)) {\n\t\t\tawait engine.stop();\n\t\t}\n\t}\n}\n"]}
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wCAAwC,CAAC;AACvD,cAAc,uCAAuC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./immutableProofTask.js\";\nexport * from \"./models/IImmutableProofTaskPayload.js\";\nexport * from \"./models/IImmutableProofTaskResult.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IImmutableProofTaskPayload.js","sourceRoot":"","sources":["../../../src/models/IImmutableProofTaskPayload.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 * The payload for the immutable proof task.\n */\nexport interface IImmutableProofTaskPayload {\n\t/**\n\t * The proof id.\n\t */\n\tproofId: string;\n\n\t/**\n\t * The identity to create the proof for.\n\t */\n\tidentity: string;\n\n\t/**\n\t * The identity connector type.\n\t */\n\tidentityConnectorType: string;\n\n\t/**\n\t * The assertion method id.\n\t */\n\tverificationMethodId: string;\n\n\t/**\n\t * The document to create the proof for.\n\t */\n\tdocument: IJsonLdNodeObject;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IImmutableProofTaskResult.js","sourceRoot":"","sources":["../../../src/models/IImmutableProofTaskResult.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IDataIntegrityProof } from \"@twin.org/standards-w3c-did\";\n\n/**\n * The result for the immutable proof task.\n */\nexport interface IImmutableProofTaskResult {\n\t/**\n\t * The proof id.\n\t */\n\tproofId: string;\n\n\t/**\n\t * The proof.\n\t */\n\tproof: IDataIntegrityProof;\n}\n"]}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { type IContextIds } from "@twin.org/context";
|
|
1
2
|
import type { IEngineCoreClone } from "@twin.org/engine-models";
|
|
2
|
-
import type { IImmutableProofTaskPayload } from "./models/IImmutableProofTaskPayload";
|
|
3
|
-
import type { IImmutableProofTaskResult } from "./models/IImmutableProofTaskResult";
|
|
3
|
+
import type { IImmutableProofTaskPayload } from "./models/IImmutableProofTaskPayload.js";
|
|
4
|
+
import type { IImmutableProofTaskResult } from "./models/IImmutableProofTaskResult.js";
|
|
4
5
|
/**
|
|
5
6
|
* Process a proof.
|
|
6
7
|
* @param engineCloneData The engine clone data.
|
|
8
|
+
* @param contextIds The context IDs.
|
|
7
9
|
* @param payload The payload to process.
|
|
8
10
|
* @returns The proof.
|
|
9
11
|
*/
|
|
10
|
-
export declare function processProofTask(engineCloneData: IEngineCoreClone, payload: IImmutableProofTaskPayload): Promise<IImmutableProofTaskResult>;
|
|
12
|
+
export declare function processProofTask(engineCloneData: IEngineCoreClone, contextIds: IContextIds, payload: IImmutableProofTaskPayload): Promise<IImmutableProofTaskResult>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./immutableProofTask";
|
|
2
|
-
export * from "./models/IImmutableProofTaskPayload";
|
|
3
|
-
export * from "./models/IImmutableProofTaskResult";
|
|
1
|
+
export * from "./immutableProofTask.js";
|
|
2
|
+
export * from "./models/IImmutableProofTaskPayload.js";
|
|
3
|
+
export * from "./models/IImmutableProofTaskResult.js";
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @twin.org/immutable-proof-task - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.1](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-task-v0.0.3-next.0...immutable-proof-task-v0.0.3-next.1) (2025-11-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add context id features ([#14](https://github.com/twinfoundation/immutable-proof/issues/14)) ([ed5a594](https://github.com/twinfoundation/immutable-proof/commit/ed5a594eaa7d50f74b1c09a7a560d48b33a4ecd1))
|
|
9
|
+
* add validate-locales ([d6a7c07](https://github.com/twinfoundation/immutable-proof/commit/d6a7c0794a1922981a42f56cc24724d7cee727f6))
|
|
10
|
+
* eslint migration to flat config ([9e63e42](https://github.com/twinfoundation/immutable-proof/commit/9e63e420ba686db78dca806d111f646c057083d6))
|
|
11
|
+
* eslint migration to flat config ([c8536f2](https://github.com/twinfoundation/immutable-proof/commit/c8536f219c7709c6c08b9266e537831f9054dda9))
|
|
12
|
+
* update dependencies ([7d6b321](https://github.com/twinfoundation/immutable-proof/commit/7d6b321928ca0434ee530816b1440f1687b94a6e))
|
|
13
|
+
* update framework core ([e708d4d](https://github.com/twinfoundation/immutable-proof/commit/e708d4dd3febcfbcd64663d5be004eab1d26c0fb))
|
|
14
|
+
* use shared store mechanism ([#3](https://github.com/twinfoundation/immutable-proof/issues/3)) ([7042a40](https://github.com/twinfoundation/immutable-proof/commit/7042a40f0ef8b01463f07aeb1efae4f417162fa1))
|
|
15
|
+
|
|
16
|
+
## [0.0.2-next.3](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-task-v0.0.2-next.2...immutable-proof-task-v0.0.2-next.3) (2025-10-09)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* add validate-locales ([d6a7c07](https://github.com/twinfoundation/immutable-proof/commit/d6a7c0794a1922981a42f56cc24724d7cee727f6))
|
|
22
|
+
* eslint migration to flat config ([9e63e42](https://github.com/twinfoundation/immutable-proof/commit/9e63e420ba686db78dca806d111f646c057083d6))
|
|
23
|
+
|
|
3
24
|
## [0.0.2-next.2](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-task-v0.0.2-next.1...immutable-proof-task-v0.0.2-next.2) (2025-08-29)
|
|
4
25
|
|
|
5
26
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Function: processProofTask()
|
|
2
2
|
|
|
3
|
-
> **processProofTask**(`engineCloneData`, `payload`): `Promise`\<[`IImmutableProofTaskResult`](../interfaces/IImmutableProofTaskResult.md)\>
|
|
3
|
+
> **processProofTask**(`engineCloneData`, `contextIds`, `payload`): `Promise`\<[`IImmutableProofTaskResult`](../interfaces/IImmutableProofTaskResult.md)\>
|
|
4
4
|
|
|
5
5
|
Process a proof.
|
|
6
6
|
|
|
@@ -12,6 +12,12 @@ Process a proof.
|
|
|
12
12
|
|
|
13
13
|
The engine clone data.
|
|
14
14
|
|
|
15
|
+
### contextIds
|
|
16
|
+
|
|
17
|
+
`IContextIds`
|
|
18
|
+
|
|
19
|
+
The context IDs.
|
|
20
|
+
|
|
15
21
|
### payload
|
|
16
22
|
|
|
17
23
|
[`IImmutableProofTaskPayload`](../interfaces/IImmutableProofTaskPayload.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/immutable-proof-task",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3-next.1",
|
|
4
4
|
"description": "Background task for generating the proof",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
+
"@twin.org/context": "next",
|
|
17
18
|
"@twin.org/core": "next",
|
|
18
19
|
"@twin.org/data-json-ld": "next",
|
|
19
20
|
"@twin.org/engine-core": "next",
|
|
@@ -22,22 +23,32 @@
|
|
|
22
23
|
"@twin.org/nameof": "next",
|
|
23
24
|
"@twin.org/standards-w3c-did": "next"
|
|
24
25
|
},
|
|
25
|
-
"main": "./dist/
|
|
26
|
-
"module": "./dist/esm/index.mjs",
|
|
26
|
+
"main": "./dist/es/index.js",
|
|
27
27
|
"types": "./dist/types/index.d.ts",
|
|
28
28
|
"exports": {
|
|
29
29
|
".": {
|
|
30
30
|
"types": "./dist/types/index.d.ts",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
31
|
+
"import": "./dist/es/index.js",
|
|
32
|
+
"default": "./dist/es/index.js"
|
|
33
33
|
},
|
|
34
34
|
"./locales/*.json": "./locales/*.json"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
|
-
"dist/
|
|
38
|
-
"dist/esm",
|
|
37
|
+
"dist/es",
|
|
39
38
|
"dist/types",
|
|
40
39
|
"locales",
|
|
41
40
|
"docs"
|
|
42
|
-
]
|
|
41
|
+
],
|
|
42
|
+
"keywords": [
|
|
43
|
+
"twin",
|
|
44
|
+
"trade",
|
|
45
|
+
"iota",
|
|
46
|
+
"framework",
|
|
47
|
+
"blockchain",
|
|
48
|
+
"immutable-proof"
|
|
49
|
+
],
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "git+https://github.com/twinfoundation/immutable-proof/issues"
|
|
52
|
+
},
|
|
53
|
+
"homepage": "https://twindev.org"
|
|
43
54
|
}
|
package/dist/cjs/index.cjs
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core = require('@twin.org/core');
|
|
4
|
-
var engineCore = require('@twin.org/engine-core');
|
|
5
|
-
var identityModels = require('@twin.org/identity-models');
|
|
6
|
-
var standardsW3cDid = require('@twin.org/standards-w3c-did');
|
|
7
|
-
|
|
8
|
-
// Copyright 2024 IOTA Stiftung.
|
|
9
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
10
|
-
const CLASS_NAME = "ImmutableProofTask";
|
|
11
|
-
/**
|
|
12
|
-
* Process a proof.
|
|
13
|
-
* @param engineCloneData The engine clone data.
|
|
14
|
-
* @param payload The payload to process.
|
|
15
|
-
* @returns The proof.
|
|
16
|
-
*/
|
|
17
|
-
async function processProofTask(engineCloneData, payload) {
|
|
18
|
-
core.Guards.objectValue(CLASS_NAME, "payload", payload);
|
|
19
|
-
core.Guards.stringValue(CLASS_NAME, "payload.nodeIdentity", payload.nodeIdentity);
|
|
20
|
-
core.Guards.stringValue(CLASS_NAME, "payload.identityConnectorType", payload.identityConnectorType);
|
|
21
|
-
core.Guards.stringValue(CLASS_NAME, "payload.verificationMethodId", payload.verificationMethodId);
|
|
22
|
-
core.Guards.object(CLASS_NAME, "payload.document", payload.document);
|
|
23
|
-
let engine;
|
|
24
|
-
try {
|
|
25
|
-
if (!core.Is.empty(engineCloneData)) {
|
|
26
|
-
// If the clone data is not empty we use it to create a new engine as it's a new thread
|
|
27
|
-
// otherwise we assume the factories are already populated.
|
|
28
|
-
engine = new engineCore.EngineCore();
|
|
29
|
-
engine.populateClone(engineCloneData, true);
|
|
30
|
-
await engine.start();
|
|
31
|
-
}
|
|
32
|
-
const identityConnector = identityModels.IdentityConnectorFactory.get(payload.identityConnectorType);
|
|
33
|
-
const proof = await identityConnector.createProof(payload.nodeIdentity, `${payload.nodeIdentity}#${payload.verificationMethodId}`, standardsW3cDid.ProofTypes.DataIntegrityProof, payload.document);
|
|
34
|
-
return {
|
|
35
|
-
proofId: payload.proofId,
|
|
36
|
-
proof: proof
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
finally {
|
|
40
|
-
if (!core.Is.empty(engine)) {
|
|
41
|
-
await engine.stop();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
exports.processProofTask = processProofTask;
|