@twin.org/immutable-proof-task 0.0.2-next.3 → 0.0.3-next.10
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} +11 -13
- 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 +2 -2
- package/dist/types/index.d.ts +3 -3
- package/dist/types/models/IImmutableProofTaskPayload.d.ts +5 -5
- package/dist/types/models/IImmutableProofTaskResult.d.ts +3 -3
- package/docs/changelog.md +90 -0
- package/docs/reference/interfaces/IImmutableProofTaskPayload.md +6 -6
- package/docs/reference/interfaces/IImmutableProofTaskResult.md +3 -3
- package/package.json +7 -7
- package/dist/cjs/index.cjs +0 -46
|
@@ -1,10 +1,9 @@
|
|
|
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";
|
|
8
7
|
const CLASS_NAME = "ImmutableProofTask";
|
|
9
8
|
/**
|
|
10
9
|
* Process a proof.
|
|
@@ -12,26 +11,26 @@ const CLASS_NAME = "ImmutableProofTask";
|
|
|
12
11
|
* @param payload The payload to process.
|
|
13
12
|
* @returns The proof.
|
|
14
13
|
*/
|
|
15
|
-
async function processProofTask(engineCloneData, payload) {
|
|
14
|
+
export async function processProofTask(engineCloneData, payload) {
|
|
16
15
|
Guards.objectValue(CLASS_NAME, "payload", payload);
|
|
17
|
-
Guards.stringValue(CLASS_NAME, "payload.
|
|
16
|
+
Guards.stringValue(CLASS_NAME, "payload.identity", payload.identity);
|
|
18
17
|
Guards.stringValue(CLASS_NAME, "payload.identityConnectorType", payload.identityConnectorType);
|
|
19
18
|
Guards.stringValue(CLASS_NAME, "payload.verificationMethodId", payload.verificationMethodId);
|
|
20
|
-
Guards.object(CLASS_NAME, "payload.
|
|
19
|
+
Guards.object(CLASS_NAME, "payload.credentialSubject", payload.credentialSubject);
|
|
21
20
|
let engine;
|
|
22
21
|
try {
|
|
23
22
|
if (!Is.empty(engineCloneData)) {
|
|
24
23
|
// If the clone data is not empty we use it to create a new engine as it's a new thread
|
|
25
24
|
// otherwise we assume the factories are already populated.
|
|
26
25
|
engine = new EngineCore();
|
|
27
|
-
engine.populateClone(engineCloneData, true);
|
|
26
|
+
engine.populateClone(engineCloneData, await ContextIdStore.getContextIds(), true);
|
|
28
27
|
await engine.start();
|
|
29
28
|
}
|
|
30
29
|
const identityConnector = IdentityConnectorFactory.get(payload.identityConnectorType);
|
|
31
|
-
const
|
|
30
|
+
const result = await identityConnector.createVerifiableCredential(payload.identity, `${payload.identity}#${payload.verificationMethodId}`, payload.proofId, payload.credentialSubject);
|
|
32
31
|
return {
|
|
33
32
|
proofId: payload.proofId,
|
|
34
|
-
|
|
33
|
+
verifiableCredential: result.verifiableCredential
|
|
35
34
|
};
|
|
36
35
|
}
|
|
37
36
|
finally {
|
|
@@ -40,5 +39,4 @@ async function processProofTask(engineCloneData, payload) {
|
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
|
-
|
|
44
|
-
export { processProofTask };
|
|
42
|
+
//# 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,EAAE,MAAM,mBAAmB,CAAC;AACnD,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;AAKrE,MAAM,UAAU,GAAG,oBAAoB,CAAC;AAExC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,eAAiC,EACjC,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,CACZ,UAAU,+BAEV,OAAO,CAAC,iBAAiB,CACzB,CAAC;IAEF,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,MAAM,cAAc,CAAC,aAAa,EAAE,EAAE,IAAI,CAAC,CAAC;YAClF,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC;QAED,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,GAAG,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;QAEtF,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,0BAA0B,CAChE,OAAO,CAAC,QAAQ,EAChB,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,oBAAoB,EAAE,EACrD,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,iBAAiB,CACzB,CAAC;QAEF,OAAO;YACN,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,oBAAoB,EAAE,MAAM,CAAC,oBAAoB;SACjD,CAAC;IACH,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 } 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 { 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 payload The payload to process.\n * @returns The proof.\n */\nexport async function processProofTask(\n\tengineCloneData: IEngineCoreClone,\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>(\n\t\tCLASS_NAME,\n\t\tnameof(payload.credentialSubject),\n\t\tpayload.credentialSubject\n\t);\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, await ContextIdStore.getContextIds(), true);\n\t\t\tawait engine.start();\n\t\t}\n\n\t\tconst identityConnector = IdentityConnectorFactory.get(payload.identityConnectorType);\n\n\t\tconst result = await identityConnector.createVerifiableCredential(\n\t\t\tpayload.identity,\n\t\t\t`${payload.identity}#${payload.verificationMethodId}`,\n\t\t\tpayload.proofId,\n\t\t\tpayload.credentialSubject\n\t\t);\n\n\t\treturn {\n\t\t\tproofId: payload.proofId,\n\t\t\tverifiableCredential: result.verifiableCredential\n\t\t};\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 { IImmutableProof } from \"@twin.org/immutable-proof-models\";\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 subject to create the proof for.\n\t */\n\tcredentialSubject: IImmutableProof;\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 { IDidVerifiableCredential } 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, we only generate a single proof, so restrict to a single proof.\n\t */\n\tverifiableCredential: IDidVerifiableCredential;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IEngineCoreClone } from "@twin.org/engine-models";
|
|
2
|
-
import type { IImmutableProofTaskPayload } from "./models/IImmutableProofTaskPayload";
|
|
3
|
-
import type { IImmutableProofTaskResult } from "./models/IImmutableProofTaskResult";
|
|
2
|
+
import type { IImmutableProofTaskPayload } from "./models/IImmutableProofTaskPayload.js";
|
|
3
|
+
import type { IImmutableProofTaskResult } from "./models/IImmutableProofTaskResult.js";
|
|
4
4
|
/**
|
|
5
5
|
* Process a proof.
|
|
6
6
|
* @param engineCloneData The engine clone data.
|
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";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IImmutableProof } from "@twin.org/immutable-proof-models";
|
|
2
2
|
/**
|
|
3
3
|
* The payload for the immutable proof task.
|
|
4
4
|
*/
|
|
@@ -8,9 +8,9 @@ export interface IImmutableProofTaskPayload {
|
|
|
8
8
|
*/
|
|
9
9
|
proofId: string;
|
|
10
10
|
/**
|
|
11
|
-
* The
|
|
11
|
+
* The identity to create the proof for.
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
identity: string;
|
|
14
14
|
/**
|
|
15
15
|
* The identity connector type.
|
|
16
16
|
*/
|
|
@@ -20,7 +20,7 @@ export interface IImmutableProofTaskPayload {
|
|
|
20
20
|
*/
|
|
21
21
|
verificationMethodId: string;
|
|
22
22
|
/**
|
|
23
|
-
* The
|
|
23
|
+
* The subject to create the proof for.
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
credentialSubject: IImmutableProof;
|
|
26
26
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IDidVerifiableCredential } from "@twin.org/standards-w3c-did";
|
|
2
2
|
/**
|
|
3
3
|
* The result for the immutable proof task.
|
|
4
4
|
*/
|
|
@@ -8,7 +8,7 @@ export interface IImmutableProofTaskResult {
|
|
|
8
8
|
*/
|
|
9
9
|
proofId: string;
|
|
10
10
|
/**
|
|
11
|
-
* The proof.
|
|
11
|
+
* The proof, we only generate a single proof, so restrict to a single proof.
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
verifiableCredential: IDidVerifiableCredential;
|
|
14
14
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,95 @@
|
|
|
1
1
|
# @twin.org/immutable-proof-task - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.10](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-task-v0.0.3-next.9...immutable-proof-task-v0.0.3-next.10) (2026-02-25)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **immutable-proof-task:** Synchronize repo versions
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/immutable-proof-models bumped from 0.0.3-next.9 to 0.0.3-next.10
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.9](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-task-v0.0.3-next.8...immutable-proof-task-v0.0.3-next.9) (2026-02-13)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* package dependencies ([4514e66](https://github.com/twinfoundation/immutable-proof/commit/4514e6632f40a91659e3dc92c474459fc146130c))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/immutable-proof-models bumped from 0.0.3-next.8 to 0.0.3-next.9
|
|
30
|
+
|
|
31
|
+
## [0.0.3-next.8](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-task-v0.0.3-next.7...immutable-proof-task-v0.0.3-next.8) (2026-02-10)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* immutable proof as vc ([#31](https://github.com/twinfoundation/immutable-proof/issues/31)) ([79cdb03](https://github.com/twinfoundation/immutable-proof/commit/79cdb03eb86c4f6d2ab1d5bf235f74ff74e8b877))
|
|
37
|
+
|
|
38
|
+
## [0.0.3-next.7](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-task-v0.0.3-next.6...immutable-proof-task-v0.0.3-next.7) (2026-02-05)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
* pass context ids to populateClone ([#24](https://github.com/twinfoundation/immutable-proof/issues/24)) ([f360e71](https://github.com/twinfoundation/immutable-proof/commit/f360e71d6895d9abbc85e1f5ffb2579e9d9666ac))
|
|
44
|
+
|
|
45
|
+
## [0.0.3-next.6](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-task-v0.0.3-next.5...immutable-proof-task-v0.0.3-next.6) (2026-01-21)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Miscellaneous Chores
|
|
49
|
+
|
|
50
|
+
* **immutable-proof-task:** Synchronize repo versions
|
|
51
|
+
|
|
52
|
+
## [0.0.3-next.5](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-task-v0.0.3-next.4...immutable-proof-task-v0.0.3-next.5) (2026-01-14)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Miscellaneous Chores
|
|
56
|
+
|
|
57
|
+
* **immutable-proof-task:** Synchronize repo versions
|
|
58
|
+
|
|
59
|
+
## [0.0.3-next.4](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-task-v0.0.3-next.3...immutable-proof-task-v0.0.3-next.4) (2026-01-07)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Miscellaneous Chores
|
|
63
|
+
|
|
64
|
+
* **immutable-proof-task:** Synchronize repo versions
|
|
65
|
+
|
|
66
|
+
## [0.0.3-next.3](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-task-v0.0.3-next.2...immutable-proof-task-v0.0.3-next.3) (2025-11-28)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### Miscellaneous Chores
|
|
70
|
+
|
|
71
|
+
* **immutable-proof-task:** Synchronize repo versions
|
|
72
|
+
|
|
73
|
+
## [0.0.3-next.2](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-task-v0.0.3-next.1...immutable-proof-task-v0.0.3-next.2) (2025-11-28)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Features
|
|
77
|
+
|
|
78
|
+
* update background tasks ([f25741c](https://github.com/twinfoundation/immutable-proof/commit/f25741c704e2c8311bc98bc69d4d926c523c781e))
|
|
79
|
+
|
|
80
|
+
## [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)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### Features
|
|
84
|
+
|
|
85
|
+
* add context id features ([#14](https://github.com/twinfoundation/immutable-proof/issues/14)) ([ed5a594](https://github.com/twinfoundation/immutable-proof/commit/ed5a594eaa7d50f74b1c09a7a560d48b33a4ecd1))
|
|
86
|
+
* add validate-locales ([d6a7c07](https://github.com/twinfoundation/immutable-proof/commit/d6a7c0794a1922981a42f56cc24724d7cee727f6))
|
|
87
|
+
* eslint migration to flat config ([9e63e42](https://github.com/twinfoundation/immutable-proof/commit/9e63e420ba686db78dca806d111f646c057083d6))
|
|
88
|
+
* eslint migration to flat config ([c8536f2](https://github.com/twinfoundation/immutable-proof/commit/c8536f219c7709c6c08b9266e537831f9054dda9))
|
|
89
|
+
* update dependencies ([7d6b321](https://github.com/twinfoundation/immutable-proof/commit/7d6b321928ca0434ee530816b1440f1687b94a6e))
|
|
90
|
+
* update framework core ([e708d4d](https://github.com/twinfoundation/immutable-proof/commit/e708d4dd3febcfbcd64663d5be004eab1d26c0fb))
|
|
91
|
+
* use shared store mechanism ([#3](https://github.com/twinfoundation/immutable-proof/issues/3)) ([7042a40](https://github.com/twinfoundation/immutable-proof/commit/7042a40f0ef8b01463f07aeb1efae4f417162fa1))
|
|
92
|
+
|
|
3
93
|
## [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)
|
|
4
94
|
|
|
5
95
|
|
|
@@ -12,11 +12,11 @@ The proof id.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
###
|
|
15
|
+
### identity
|
|
16
16
|
|
|
17
|
-
> **
|
|
17
|
+
> **identity**: `string`
|
|
18
18
|
|
|
19
|
-
The
|
|
19
|
+
The identity to create the proof for.
|
|
20
20
|
|
|
21
21
|
***
|
|
22
22
|
|
|
@@ -36,8 +36,8 @@ The assertion method id.
|
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
39
|
-
###
|
|
39
|
+
### credentialSubject
|
|
40
40
|
|
|
41
|
-
> **
|
|
41
|
+
> **credentialSubject**: `IImmutableProof`
|
|
42
42
|
|
|
43
|
-
The
|
|
43
|
+
The subject to create the proof for.
|
|
@@ -12,8 +12,8 @@ The proof id.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
###
|
|
15
|
+
### verifiableCredential
|
|
16
16
|
|
|
17
|
-
> **
|
|
17
|
+
> **verifiableCredential**: `IDidVerifiableCredential`
|
|
18
18
|
|
|
19
|
-
The proof.
|
|
19
|
+
The proof, we only generate a single proof, so restrict to a single proof.
|
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.10",
|
|
4
4
|
"description": "Background task for generating the proof",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,28 +14,28 @@
|
|
|
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",
|
|
20
21
|
"@twin.org/engine-models": "next",
|
|
21
22
|
"@twin.org/identity-models": "next",
|
|
23
|
+
"@twin.org/immutable-proof-models": "0.0.3-next.10",
|
|
22
24
|
"@twin.org/nameof": "next",
|
|
23
25
|
"@twin.org/standards-w3c-did": "next"
|
|
24
26
|
},
|
|
25
|
-
"main": "./dist/
|
|
26
|
-
"module": "./dist/esm/index.mjs",
|
|
27
|
+
"main": "./dist/es/index.js",
|
|
27
28
|
"types": "./dist/types/index.d.ts",
|
|
28
29
|
"exports": {
|
|
29
30
|
".": {
|
|
30
31
|
"types": "./dist/types/index.d.ts",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
32
|
+
"import": "./dist/es/index.js",
|
|
33
|
+
"default": "./dist/es/index.js"
|
|
33
34
|
},
|
|
34
35
|
"./locales/*.json": "./locales/*.json"
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
37
|
-
"dist/
|
|
38
|
-
"dist/esm",
|
|
38
|
+
"dist/es",
|
|
39
39
|
"dist/types",
|
|
40
40
|
"locales",
|
|
41
41
|
"docs"
|
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;
|