@twin.org/immutable-proof-task 0.0.1-next.25 → 0.0.1-next.26

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.
@@ -3,6 +3,7 @@
3
3
  var core = require('@twin.org/core');
4
4
  var engineCore = require('@twin.org/engine-core');
5
5
  var identityModels = require('@twin.org/identity-models');
6
+ var standardsW3cDid = require('@twin.org/standards-w3c-did');
6
7
 
7
8
  // Copyright 2024 IOTA Stiftung.
8
9
  // SPDX-License-Identifier: Apache-2.0.
@@ -17,8 +18,8 @@ async function processProofTask(engineCloneData, payload) {
17
18
  core.Guards.objectValue(CLASS_NAME, "payload", payload);
18
19
  core.Guards.stringValue(CLASS_NAME, "payload.nodeIdentity", payload.nodeIdentity);
19
20
  core.Guards.stringValue(CLASS_NAME, "payload.identityConnectorType", payload.identityConnectorType);
20
- core.Guards.stringHex(CLASS_NAME, "payload.hashData", payload.hashData);
21
- core.Guards.stringValue(CLASS_NAME, "payload.assertionMethodId", payload.assertionMethodId);
21
+ core.Guards.stringValue(CLASS_NAME, "payload.verificationMethodId", payload.verificationMethodId);
22
+ core.Guards.object(CLASS_NAME, "payload.document", payload.document);
22
23
  let engine;
23
24
  try {
24
25
  if (!core.Is.empty(engineCloneData)) {
@@ -29,10 +30,10 @@ async function processProofTask(engineCloneData, payload) {
29
30
  await engine.start();
30
31
  }
31
32
  const identityConnector = identityModels.IdentityConnectorFactory.get(payload.identityConnectorType);
32
- const proof = await identityConnector.createProof(payload.nodeIdentity, `${payload.nodeIdentity}#${payload.assertionMethodId}`, core.Converter.hexToBytes(payload.hashData));
33
+ const proof = await identityConnector.createProof(payload.nodeIdentity, `${payload.nodeIdentity}#${payload.verificationMethodId}`, standardsW3cDid.ProofTypes.DataIntegrityProof, payload.document);
33
34
  return {
34
35
  proofId: payload.proofId,
35
- proof
36
+ proof: proof
36
37
  };
37
38
  }
38
39
  finally {
@@ -1,6 +1,7 @@
1
- import { Guards, Is, Converter } from '@twin.org/core';
1
+ import { Guards, Is } from '@twin.org/core';
2
2
  import { EngineCore } from '@twin.org/engine-core';
3
3
  import { IdentityConnectorFactory } from '@twin.org/identity-models';
4
+ import { ProofTypes } from '@twin.org/standards-w3c-did';
4
5
 
5
6
  // Copyright 2024 IOTA Stiftung.
6
7
  // SPDX-License-Identifier: Apache-2.0.
@@ -15,8 +16,8 @@ async function processProofTask(engineCloneData, payload) {
15
16
  Guards.objectValue(CLASS_NAME, "payload", payload);
16
17
  Guards.stringValue(CLASS_NAME, "payload.nodeIdentity", payload.nodeIdentity);
17
18
  Guards.stringValue(CLASS_NAME, "payload.identityConnectorType", payload.identityConnectorType);
18
- Guards.stringHex(CLASS_NAME, "payload.hashData", payload.hashData);
19
- Guards.stringValue(CLASS_NAME, "payload.assertionMethodId", payload.assertionMethodId);
19
+ Guards.stringValue(CLASS_NAME, "payload.verificationMethodId", payload.verificationMethodId);
20
+ Guards.object(CLASS_NAME, "payload.document", payload.document);
20
21
  let engine;
21
22
  try {
22
23
  if (!Is.empty(engineCloneData)) {
@@ -27,10 +28,10 @@ async function processProofTask(engineCloneData, payload) {
27
28
  await engine.start();
28
29
  }
29
30
  const identityConnector = IdentityConnectorFactory.get(payload.identityConnectorType);
30
- const proof = await identityConnector.createProof(payload.nodeIdentity, `${payload.nodeIdentity}#${payload.assertionMethodId}`, Converter.hexToBytes(payload.hashData));
31
+ const proof = await identityConnector.createProof(payload.nodeIdentity, `${payload.nodeIdentity}#${payload.verificationMethodId}`, ProofTypes.DataIntegrityProof, payload.document);
31
32
  return {
32
33
  proofId: payload.proofId,
33
- proof
34
+ proof: proof
34
35
  };
35
36
  }
36
37
  finally {
@@ -1,3 +1,4 @@
1
+ import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
1
2
  /**
2
3
  * The payload for the immutable proof task.
3
4
  */
@@ -17,9 +18,9 @@ export interface IImmutableProofTaskPayload {
17
18
  /**
18
19
  * The assertion method id.
19
20
  */
20
- assertionMethodId: string;
21
+ verificationMethodId: string;
21
22
  /**
22
- * The hash data.
23
+ * The document to create the proof for.
23
24
  */
24
- hashData: string;
25
+ document: IJsonLdNodeObject;
25
26
  }
@@ -1,4 +1,4 @@
1
- import type { IDidProof } from "@twin.org/standards-w3c-did";
1
+ import type { IDataIntegrityProof } from "@twin.org/standards-w3c-did";
2
2
  /**
3
3
  * The result for the immutable proof task.
4
4
  */
@@ -10,5 +10,5 @@ export interface IImmutableProofTaskResult {
10
10
  /**
11
11
  * The proof.
12
12
  */
13
- proof: IDidProof;
13
+ proof: IDataIntegrityProof;
14
14
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/immutable-proof-task - Changelog
2
2
 
3
- ## v0.0.1-next.25
3
+ ## v0.0.1-next.26
4
4
 
5
5
  - Initial Release
@@ -28,16 +28,16 @@ The identity connector type.
28
28
 
29
29
  ***
30
30
 
31
- ### assertionMethodId
31
+ ### verificationMethodId
32
32
 
33
- > **assertionMethodId**: `string`
33
+ > **verificationMethodId**: `string`
34
34
 
35
35
  The assertion method id.
36
36
 
37
37
  ***
38
38
 
39
- ### hashData
39
+ ### document
40
40
 
41
- > **hashData**: `string`
41
+ > **document**: `IJsonLdNodeObject`
42
42
 
43
- The hash data.
43
+ The document to create the proof for.
@@ -14,6 +14,6 @@ The proof id.
14
14
 
15
15
  ### proof
16
16
 
17
- > **proof**: `IDidProof`
17
+ > **proof**: `IDataIntegrityProof`
18
18
 
19
19
  The proof.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/immutable-proof-task",
3
- "version": "0.0.1-next.25",
3
+ "version": "0.0.1-next.26",
4
4
  "description": "Background task for generating the proof",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,6 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@twin.org/core": "next",
18
+ "@twin.org/data-json-ld": "next",
18
19
  "@twin.org/engine-core": "next",
19
20
  "@twin.org/engine-models": "next",
20
21
  "@twin.org/identity-models": "next",