@twin.org/immutable-proof-task 0.0.3-next.7 → 0.0.3-next.8
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/es/immutableProofTask.js +3 -4
- package/dist/es/immutableProofTask.js.map +1 -1
- package/dist/es/models/IImmutableProofTaskPayload.js.map +1 -1
- package/dist/es/models/IImmutableProofTaskResult.js.map +1 -1
- package/dist/types/models/IImmutableProofTaskPayload.d.ts +3 -3
- package/dist/types/models/IImmutableProofTaskResult.d.ts +3 -3
- package/docs/changelog.md +7 -0
- package/docs/reference/interfaces/IImmutableProofTaskPayload.md +3 -3
- package/docs/reference/interfaces/IImmutableProofTaskResult.md +3 -3
- package/package.json +2 -1
|
@@ -4,7 +4,6 @@ import { ContextIdStore } from "@twin.org/context";
|
|
|
4
4
|
import { Guards, Is } from "@twin.org/core";
|
|
5
5
|
import { EngineCore } from "@twin.org/engine-core";
|
|
6
6
|
import { IdentityConnectorFactory } from "@twin.org/identity-models";
|
|
7
|
-
import { ProofTypes } from "@twin.org/standards-w3c-did";
|
|
8
7
|
const CLASS_NAME = "ImmutableProofTask";
|
|
9
8
|
/**
|
|
10
9
|
* Process a proof.
|
|
@@ -17,7 +16,7 @@ export async function processProofTask(engineCloneData, payload) {
|
|
|
17
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)) {
|
|
@@ -28,10 +27,10 @@ export async function processProofTask(engineCloneData, payload) {
|
|
|
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 {
|
|
@@ -1 +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;
|
|
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"]}
|
|
@@ -1 +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 {
|
|
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"]}
|
|
@@ -1 +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 {
|
|
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,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
|
*/
|
|
@@ -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,12 @@
|
|
|
1
1
|
# @twin.org/immutable-proof-task - Changelog
|
|
2
2
|
|
|
3
|
+
## [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)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* immutable proof as vc ([#31](https://github.com/twinfoundation/immutable-proof/issues/31)) ([79cdb03](https://github.com/twinfoundation/immutable-proof/commit/79cdb03eb86c4f6d2ab1d5bf235f74ff74e8b877))
|
|
9
|
+
|
|
3
10
|
## [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)
|
|
4
11
|
|
|
5
12
|
|
|
@@ -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-next.
|
|
3
|
+
"version": "0.0.3-next.8",
|
|
4
4
|
"description": "Background task for generating the proof",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"@twin.org/engine-core": "next",
|
|
21
21
|
"@twin.org/engine-models": "next",
|
|
22
22
|
"@twin.org/identity-models": "next",
|
|
23
|
+
"@twin.org/immutable-proof-models": "0.0.3-next.8",
|
|
23
24
|
"@twin.org/nameof": "next",
|
|
24
25
|
"@twin.org/standards-w3c-did": "next"
|
|
25
26
|
},
|