@twin.org/immutable-proof-task 0.0.1-next.25 → 0.0.1-next.27
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/cjs/index.cjs +5 -4
- package/dist/esm/index.mjs +6 -5
- package/dist/types/models/IImmutableProofTaskPayload.d.ts +4 -3
- package/dist/types/models/IImmutableProofTaskResult.d.ts +2 -2
- package/docs/changelog.md +1 -1
- package/docs/reference/interfaces/IImmutableProofTaskPayload.md +5 -5
- package/docs/reference/interfaces/IImmutableProofTaskResult.md +1 -1
- package/package.json +2 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -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.
|
|
21
|
-
core.Guards.
|
|
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.
|
|
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 {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Guards, Is
|
|
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.
|
|
19
|
-
Guards.
|
|
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.
|
|
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
|
-
|
|
21
|
+
verificationMethodId: string;
|
|
21
22
|
/**
|
|
22
|
-
* The
|
|
23
|
+
* The document to create the proof for.
|
|
23
24
|
*/
|
|
24
|
-
|
|
25
|
+
document: IJsonLdNodeObject;
|
|
25
26
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
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:
|
|
13
|
+
proof: IDataIntegrityProof;
|
|
14
14
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -28,16 +28,16 @@ The identity connector type.
|
|
|
28
28
|
|
|
29
29
|
***
|
|
30
30
|
|
|
31
|
-
###
|
|
31
|
+
### verificationMethodId
|
|
32
32
|
|
|
33
|
-
> **
|
|
33
|
+
> **verificationMethodId**: `string`
|
|
34
34
|
|
|
35
35
|
The assertion method id.
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
39
|
-
###
|
|
39
|
+
### document
|
|
40
40
|
|
|
41
|
-
> **
|
|
41
|
+
> **document**: `IJsonLdNodeObject`
|
|
42
42
|
|
|
43
|
-
The
|
|
43
|
+
The document to create the proof for.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/immutable-proof-task",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.27",
|
|
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",
|