@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.
@@ -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.document", payload.document);
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 proof = await identityConnector.createProof(payload.identity, `${payload.identity}#${payload.verificationMethodId}`, ProofTypes.DataIntegrityProof, payload.document);
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
- proof: proof
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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GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,oBAAoB,EAAE,EACrD,UAAU,CAAC,kBAAkB,EAC7B,OAAO,CAAC,QAAQ,CAChB,CAAC;QAEF,OAAO;YACN,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,KAAK,EAAE,KAA4B;SACnC,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 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 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>(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, 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 proof = await identityConnector.createProof(\n\t\t\tpayload.identity,\n\t\t\t`${payload.identity}#${payload.verificationMethodId}`,\n\t\t\tProofTypes.DataIntegrityProof,\n\t\t\tpayload.document\n\t\t);\n\n\t\treturn {\n\t\t\tproofId: payload.proofId,\n\t\t\tproof: proof as IDataIntegrityProof\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
+ {"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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\"@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 { 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"]}
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 { 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
+ {"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 { IJsonLdNodeObject } from "@twin.org/data-json-ld";
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 document to create the proof for.
23
+ * The subject to create the proof for.
24
24
  */
25
- document: IJsonLdNodeObject;
25
+ credentialSubject: IImmutableProof;
26
26
  }
@@ -1,4 +1,4 @@
1
- import type { IDataIntegrityProof } from "@twin.org/standards-w3c-did";
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
- proof: IDataIntegrityProof;
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
 
@@ -36,8 +36,8 @@ The assertion method id.
36
36
 
37
37
  ***
38
38
 
39
- ### document
39
+ ### credentialSubject
40
40
 
41
- > **document**: `IJsonLdNodeObject`
41
+ > **credentialSubject**: `IImmutableProof`
42
42
 
43
- The document to create the proof for.
43
+ The subject to create the proof for.
@@ -12,8 +12,8 @@ The proof id.
12
12
 
13
13
  ***
14
14
 
15
- ### proof
15
+ ### verifiableCredential
16
16
 
17
- > **proof**: `IDataIntegrityProof`
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.7",
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
  },