@twin.org/immutable-proof-models 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 +25 -10
- package/dist/esm/index.mjs +25 -11
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/IImmutableProof.d.ts +9 -4
- package/dist/types/models/IImmutableProofComponent.d.ts +6 -6
- package/dist/types/models/IImmutableProofVerification.d.ts +2 -1
- package/dist/types/models/api/IImmutableProofCreateRequest.d.ts +2 -2
- package/dist/types/models/immutableProofContexts.d.ts +17 -0
- package/dist/types/models/immutableProofFailure.d.ts +1 -1
- package/dist/types/models/immutableProofTypes.d.ts +0 -8
- package/docs/changelog.md +1 -1
- package/docs/reference/index.md +2 -0
- package/docs/reference/interfaces/IImmutableProof.md +9 -1
- package/docs/reference/interfaces/IImmutableProofComponent.md +7 -7
- package/docs/reference/interfaces/IImmutableProofCreateRequest.md +3 -3
- package/docs/reference/type-aliases/ImmutableProofContexts.md +5 -0
- package/docs/reference/variables/ImmutableProofContexts.md +19 -0
- package/docs/reference/variables/ImmutableProofFailure.md +1 -1
- package/docs/reference/variables/ImmutableProofTypes.md +0 -12
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -9,14 +9,6 @@ var dataCore = require('@twin.org/data-core');
|
|
|
9
9
|
*/
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11
11
|
const ImmutableProofTypes = {
|
|
12
|
-
/**
|
|
13
|
-
* The context root for the immutable proof types.
|
|
14
|
-
*/
|
|
15
|
-
ContextRoot: "https://schema.twindev.org/immutable-proof/",
|
|
16
|
-
/**
|
|
17
|
-
* The context root for the common types.
|
|
18
|
-
*/
|
|
19
|
-
ContextRootCommon: "https://schema.twindev.org/common/",
|
|
20
12
|
/**
|
|
21
13
|
* Represents Immutable Proof.
|
|
22
14
|
*/
|
|
@@ -56,6 +48,10 @@ var properties = {
|
|
|
56
48
|
type: "string",
|
|
57
49
|
description: "The id of the proof."
|
|
58
50
|
},
|
|
51
|
+
nodeIdentity: {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "The id of the node who created the proof."
|
|
54
|
+
},
|
|
59
55
|
userIdentity: {
|
|
60
56
|
type: "string",
|
|
61
57
|
description: "The id of the user who created the proof."
|
|
@@ -69,7 +65,7 @@ var properties = {
|
|
|
69
65
|
description: "The hash of the object associated with the proof."
|
|
70
66
|
},
|
|
71
67
|
proof: {
|
|
72
|
-
$ref: "https://schema.twindev.org/did/
|
|
68
|
+
$ref: "https://schema.twindev.org/did/DataIntegrityProof",
|
|
73
69
|
description: "The proof which can be undefined if it has not yet been issued."
|
|
74
70
|
},
|
|
75
71
|
immutableReceipt: {
|
|
@@ -81,6 +77,7 @@ var required = [
|
|
|
81
77
|
"@context",
|
|
82
78
|
"type",
|
|
83
79
|
"id",
|
|
80
|
+
"nodeIdentity",
|
|
84
81
|
"userIdentity",
|
|
85
82
|
"proofObjectHash"
|
|
86
83
|
];
|
|
@@ -112,6 +109,23 @@ class ImmutableProofDataTypes {
|
|
|
112
109
|
}
|
|
113
110
|
}
|
|
114
111
|
|
|
112
|
+
// Copyright 2024 IOTA Stiftung.
|
|
113
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
114
|
+
/**
|
|
115
|
+
* The contexts of immutable proof data.
|
|
116
|
+
*/
|
|
117
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
118
|
+
const ImmutableProofContexts = {
|
|
119
|
+
/**
|
|
120
|
+
* The context root for the immutable proof types.
|
|
121
|
+
*/
|
|
122
|
+
ContextRoot: "https://schema.twindev.org/immutable-proof/",
|
|
123
|
+
/**
|
|
124
|
+
* The context root for the common types.
|
|
125
|
+
*/
|
|
126
|
+
ContextRootCommon: "https://schema.twindev.org/common/"
|
|
127
|
+
};
|
|
128
|
+
|
|
115
129
|
// Copyright 2024 IOTA Stiftung.
|
|
116
130
|
// SPDX-License-Identifier: Apache-2.0.
|
|
117
131
|
/**
|
|
@@ -120,7 +134,7 @@ class ImmutableProofDataTypes {
|
|
|
120
134
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
121
135
|
const ImmutableProofFailure = {
|
|
122
136
|
/**
|
|
123
|
-
* Proof not
|
|
137
|
+
* Proof not yet issued.
|
|
124
138
|
*/
|
|
125
139
|
NotIssued: "notIssued",
|
|
126
140
|
/**
|
|
@@ -154,6 +168,7 @@ const ImmutableProofTopics = {
|
|
|
154
168
|
ProofCreated: "immutable-proof:proof-created"
|
|
155
169
|
};
|
|
156
170
|
|
|
171
|
+
exports.ImmutableProofContexts = ImmutableProofContexts;
|
|
157
172
|
exports.ImmutableProofDataTypes = ImmutableProofDataTypes;
|
|
158
173
|
exports.ImmutableProofFailure = ImmutableProofFailure;
|
|
159
174
|
exports.ImmutableProofTopics = ImmutableProofTopics;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -7,14 +7,6 @@ import { DataTypeHandlerFactory } from '@twin.org/data-core';
|
|
|
7
7
|
*/
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
9
9
|
const ImmutableProofTypes = {
|
|
10
|
-
/**
|
|
11
|
-
* The context root for the immutable proof types.
|
|
12
|
-
*/
|
|
13
|
-
ContextRoot: "https://schema.twindev.org/immutable-proof/",
|
|
14
|
-
/**
|
|
15
|
-
* The context root for the common types.
|
|
16
|
-
*/
|
|
17
|
-
ContextRootCommon: "https://schema.twindev.org/common/",
|
|
18
10
|
/**
|
|
19
11
|
* Represents Immutable Proof.
|
|
20
12
|
*/
|
|
@@ -54,6 +46,10 @@ var properties = {
|
|
|
54
46
|
type: "string",
|
|
55
47
|
description: "The id of the proof."
|
|
56
48
|
},
|
|
49
|
+
nodeIdentity: {
|
|
50
|
+
type: "string",
|
|
51
|
+
description: "The id of the node who created the proof."
|
|
52
|
+
},
|
|
57
53
|
userIdentity: {
|
|
58
54
|
type: "string",
|
|
59
55
|
description: "The id of the user who created the proof."
|
|
@@ -67,7 +63,7 @@ var properties = {
|
|
|
67
63
|
description: "The hash of the object associated with the proof."
|
|
68
64
|
},
|
|
69
65
|
proof: {
|
|
70
|
-
$ref: "https://schema.twindev.org/did/
|
|
66
|
+
$ref: "https://schema.twindev.org/did/DataIntegrityProof",
|
|
71
67
|
description: "The proof which can be undefined if it has not yet been issued."
|
|
72
68
|
},
|
|
73
69
|
immutableReceipt: {
|
|
@@ -79,6 +75,7 @@ var required = [
|
|
|
79
75
|
"@context",
|
|
80
76
|
"type",
|
|
81
77
|
"id",
|
|
78
|
+
"nodeIdentity",
|
|
82
79
|
"userIdentity",
|
|
83
80
|
"proofObjectHash"
|
|
84
81
|
];
|
|
@@ -110,6 +107,23 @@ class ImmutableProofDataTypes {
|
|
|
110
107
|
}
|
|
111
108
|
}
|
|
112
109
|
|
|
110
|
+
// Copyright 2024 IOTA Stiftung.
|
|
111
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
112
|
+
/**
|
|
113
|
+
* The contexts of immutable proof data.
|
|
114
|
+
*/
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
116
|
+
const ImmutableProofContexts = {
|
|
117
|
+
/**
|
|
118
|
+
* The context root for the immutable proof types.
|
|
119
|
+
*/
|
|
120
|
+
ContextRoot: "https://schema.twindev.org/immutable-proof/",
|
|
121
|
+
/**
|
|
122
|
+
* The context root for the common types.
|
|
123
|
+
*/
|
|
124
|
+
ContextRootCommon: "https://schema.twindev.org/common/"
|
|
125
|
+
};
|
|
126
|
+
|
|
113
127
|
// Copyright 2024 IOTA Stiftung.
|
|
114
128
|
// SPDX-License-Identifier: Apache-2.0.
|
|
115
129
|
/**
|
|
@@ -118,7 +132,7 @@ class ImmutableProofDataTypes {
|
|
|
118
132
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
119
133
|
const ImmutableProofFailure = {
|
|
120
134
|
/**
|
|
121
|
-
* Proof not
|
|
135
|
+
* Proof not yet issued.
|
|
122
136
|
*/
|
|
123
137
|
NotIssued: "notIssued",
|
|
124
138
|
/**
|
|
@@ -152,4 +166,4 @@ const ImmutableProofTopics = {
|
|
|
152
166
|
ProofCreated: "immutable-proof:proof-created"
|
|
153
167
|
};
|
|
154
168
|
|
|
155
|
-
export { ImmutableProofDataTypes, ImmutableProofFailure, ImmutableProofTopics, ImmutableProofTypes };
|
|
169
|
+
export { ImmutableProofContexts, ImmutableProofDataTypes, ImmutableProofFailure, ImmutableProofTopics, ImmutableProofTypes };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./models/eventBus/IImmutableProofEventBusProofCreated";
|
|
|
8
8
|
export * from "./models/IImmutableProof";
|
|
9
9
|
export * from "./models/IImmutableProofComponent";
|
|
10
10
|
export * from "./models/IImmutableProofVerification";
|
|
11
|
+
export * from "./models/immutableProofContexts";
|
|
11
12
|
export * from "./models/immutableProofFailure";
|
|
12
13
|
export * from "./models/immutableProofTopics";
|
|
13
14
|
export * from "./models/immutableProofTypes";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IJsonLdContextDefinitionElement, IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
-
import type {
|
|
2
|
+
import type { IDataIntegrityProof } from "@twin.org/standards-w3c-did";
|
|
3
|
+
import type { ImmutableProofContexts } from "./immutableProofContexts";
|
|
3
4
|
import type { ImmutableProofTypes } from "./immutableProofTypes";
|
|
4
5
|
/**
|
|
5
6
|
* Interface describing an immutable proof state.
|
|
@@ -9,8 +10,8 @@ export interface IImmutableProof {
|
|
|
9
10
|
* JSON-LD Context.
|
|
10
11
|
*/
|
|
11
12
|
"@context": [
|
|
12
|
-
typeof
|
|
13
|
-
typeof
|
|
13
|
+
typeof ImmutableProofContexts.ContextRoot,
|
|
14
|
+
typeof ImmutableProofContexts.ContextRootCommon,
|
|
14
15
|
...IJsonLdContextDefinitionElement[]
|
|
15
16
|
];
|
|
16
17
|
/**
|
|
@@ -21,6 +22,10 @@ export interface IImmutableProof {
|
|
|
21
22
|
* The id of the proof.
|
|
22
23
|
*/
|
|
23
24
|
id: string;
|
|
25
|
+
/**
|
|
26
|
+
* The id of the node who created the proof.
|
|
27
|
+
*/
|
|
28
|
+
nodeIdentity: string;
|
|
24
29
|
/**
|
|
25
30
|
* The id of the user who created the proof.
|
|
26
31
|
*/
|
|
@@ -36,7 +41,7 @@ export interface IImmutableProof {
|
|
|
36
41
|
/**
|
|
37
42
|
* The proof which can be undefined if it has not yet been issued.
|
|
38
43
|
*/
|
|
39
|
-
proof?:
|
|
44
|
+
proof?: IDataIntegrityProof;
|
|
40
45
|
/**
|
|
41
46
|
* The immutable receipt detail for where the proof is stored.
|
|
42
47
|
*/
|
|
@@ -7,22 +7,22 @@ import type { IImmutableProofVerification } from "./IImmutableProofVerification"
|
|
|
7
7
|
*/
|
|
8
8
|
export interface IImmutableProofComponent extends IComponent {
|
|
9
9
|
/**
|
|
10
|
-
* Create a new
|
|
11
|
-
* @param
|
|
10
|
+
* Create a new proof.
|
|
11
|
+
* @param document The document to create the proof for.
|
|
12
12
|
* @param userIdentity The identity to create the immutable proof operation with.
|
|
13
13
|
* @param nodeIdentity The node identity to use for vault operations.
|
|
14
|
-
* @returns The id of the new
|
|
14
|
+
* @returns The id of the new proof.
|
|
15
15
|
*/
|
|
16
|
-
create(
|
|
16
|
+
create(document: IJsonLdNodeObject, userIdentity?: string, nodeIdentity?: string): Promise<string>;
|
|
17
17
|
/**
|
|
18
|
-
* Get
|
|
18
|
+
* Get a proof.
|
|
19
19
|
* @param id The id of the proof to get.
|
|
20
20
|
* @returns The proof.
|
|
21
21
|
* @throws NotFoundError if the proof is not found.
|
|
22
22
|
*/
|
|
23
23
|
get(id: string): Promise<IImmutableProof>;
|
|
24
24
|
/**
|
|
25
|
-
* Verify
|
|
25
|
+
* Verify a proof.
|
|
26
26
|
* @param id The id of the proof to verify.
|
|
27
27
|
* @returns The result of the verification and any failures.
|
|
28
28
|
* @throws NotFoundError if the proof is not found.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ImmutableProofContexts } from "./immutableProofContexts";
|
|
1
2
|
import type { ImmutableProofFailure } from "./immutableProofFailure";
|
|
2
3
|
import type { ImmutableProofTypes } from "./immutableProofTypes";
|
|
3
4
|
/**
|
|
@@ -7,7 +8,7 @@ export interface IImmutableProofVerification {
|
|
|
7
8
|
/**
|
|
8
9
|
* JSON-LD Context.
|
|
9
10
|
*/
|
|
10
|
-
"@context": typeof
|
|
11
|
+
"@context": typeof ImmutableProofContexts.ContextRoot;
|
|
11
12
|
/**
|
|
12
13
|
* JSON-LD Type.
|
|
13
14
|
*/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The contexts of immutable proof data.
|
|
3
|
+
*/
|
|
4
|
+
export declare const ImmutableProofContexts: {
|
|
5
|
+
/**
|
|
6
|
+
* The context root for the immutable proof types.
|
|
7
|
+
*/
|
|
8
|
+
readonly ContextRoot: "https://schema.twindev.org/immutable-proof/";
|
|
9
|
+
/**
|
|
10
|
+
* The context root for the common types.
|
|
11
|
+
*/
|
|
12
|
+
readonly ContextRootCommon: "https://schema.twindev.org/common/";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The contexts of immutable proof data.
|
|
16
|
+
*/
|
|
17
|
+
export type ImmutableProofContexts = (typeof ImmutableProofContexts)[keyof typeof ImmutableProofContexts];
|
|
@@ -2,14 +2,6 @@
|
|
|
2
2
|
* The types of immutable proof data.
|
|
3
3
|
*/
|
|
4
4
|
export declare const ImmutableProofTypes: {
|
|
5
|
-
/**
|
|
6
|
-
* The context root for the immutable proof types.
|
|
7
|
-
*/
|
|
8
|
-
readonly ContextRoot: "https://schema.twindev.org/immutable-proof/";
|
|
9
|
-
/**
|
|
10
|
-
* The context root for the common types.
|
|
11
|
-
*/
|
|
12
|
-
readonly ContextRootCommon: "https://schema.twindev.org/common/";
|
|
13
5
|
/**
|
|
14
6
|
* Represents Immutable Proof.
|
|
15
7
|
*/
|
package/docs/changelog.md
CHANGED
package/docs/reference/index.md
CHANGED
|
@@ -18,12 +18,14 @@
|
|
|
18
18
|
|
|
19
19
|
## Type Aliases
|
|
20
20
|
|
|
21
|
+
- [ImmutableProofContexts](type-aliases/ImmutableProofContexts.md)
|
|
21
22
|
- [ImmutableProofFailure](type-aliases/ImmutableProofFailure.md)
|
|
22
23
|
- [ImmutableProofTopics](type-aliases/ImmutableProofTopics.md)
|
|
23
24
|
- [ImmutableProofTypes](type-aliases/ImmutableProofTypes.md)
|
|
24
25
|
|
|
25
26
|
## Variables
|
|
26
27
|
|
|
28
|
+
- [ImmutableProofContexts](variables/ImmutableProofContexts.md)
|
|
27
29
|
- [ImmutableProofFailure](variables/ImmutableProofFailure.md)
|
|
28
30
|
- [ImmutableProofTopics](variables/ImmutableProofTopics.md)
|
|
29
31
|
- [ImmutableProofTypes](variables/ImmutableProofTypes.md)
|
|
@@ -28,6 +28,14 @@ The id of the proof.
|
|
|
28
28
|
|
|
29
29
|
***
|
|
30
30
|
|
|
31
|
+
### nodeIdentity
|
|
32
|
+
|
|
33
|
+
> **nodeIdentity**: `string`
|
|
34
|
+
|
|
35
|
+
The id of the node who created the proof.
|
|
36
|
+
|
|
37
|
+
***
|
|
38
|
+
|
|
31
39
|
### userIdentity
|
|
32
40
|
|
|
33
41
|
> **userIdentity**: `string`
|
|
@@ -54,7 +62,7 @@ The hash of the object associated with the proof.
|
|
|
54
62
|
|
|
55
63
|
### proof?
|
|
56
64
|
|
|
57
|
-
> `optional` **proof**: `
|
|
65
|
+
> `optional` **proof**: `IDataIntegrityProof`
|
|
58
66
|
|
|
59
67
|
The proof which can be undefined if it has not yet been issued.
|
|
60
68
|
|
|
@@ -10,17 +10,17 @@ Interface describing an immutable proof contract.
|
|
|
10
10
|
|
|
11
11
|
### create()
|
|
12
12
|
|
|
13
|
-
> **create**(`
|
|
13
|
+
> **create**(`document`, `userIdentity`?, `nodeIdentity`?): `Promise`\<`string`\>
|
|
14
14
|
|
|
15
|
-
Create a new
|
|
15
|
+
Create a new proof.
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
-
#####
|
|
19
|
+
##### document
|
|
20
20
|
|
|
21
21
|
`IJsonLdNodeObject`
|
|
22
22
|
|
|
23
|
-
The
|
|
23
|
+
The document to create the proof for.
|
|
24
24
|
|
|
25
25
|
##### userIdentity?
|
|
26
26
|
|
|
@@ -38,7 +38,7 @@ The node identity to use for vault operations.
|
|
|
38
38
|
|
|
39
39
|
`Promise`\<`string`\>
|
|
40
40
|
|
|
41
|
-
The id of the new
|
|
41
|
+
The id of the new proof.
|
|
42
42
|
|
|
43
43
|
***
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ The id of the new authentication proof.
|
|
|
46
46
|
|
|
47
47
|
> **get**(`id`): `Promise`\<[`IImmutableProof`](IImmutableProof.md)\>
|
|
48
48
|
|
|
49
|
-
Get
|
|
49
|
+
Get a proof.
|
|
50
50
|
|
|
51
51
|
#### Parameters
|
|
52
52
|
|
|
@@ -72,7 +72,7 @@ NotFoundError if the proof is not found.
|
|
|
72
72
|
|
|
73
73
|
> **verify**(`id`): `Promise`\<[`IImmutableProofVerification`](IImmutableProofVerification.md)\>
|
|
74
74
|
|
|
75
|
-
Verify
|
|
75
|
+
Verify a proof.
|
|
76
76
|
|
|
77
77
|
#### Parameters
|
|
78
78
|
|
|
@@ -10,8 +10,8 @@ Create a proof.
|
|
|
10
10
|
|
|
11
11
|
The parameters from the body.
|
|
12
12
|
|
|
13
|
-
####
|
|
13
|
+
#### document
|
|
14
14
|
|
|
15
|
-
> **
|
|
15
|
+
> **document**: `IJsonLdNodeObject`
|
|
16
16
|
|
|
17
|
-
The
|
|
17
|
+
The document to create the proof for.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Type Alias: ImmutableProofContexts
|
|
2
|
+
|
|
3
|
+
> **ImmutableProofContexts**: *typeof* [`ImmutableProofContexts`](../variables/ImmutableProofContexts.md)\[keyof *typeof* [`ImmutableProofContexts`](../variables/ImmutableProofContexts.md)\]
|
|
4
|
+
|
|
5
|
+
The contexts of immutable proof data.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Variable: ImmutableProofContexts
|
|
2
|
+
|
|
3
|
+
> `const` **ImmutableProofContexts**: `object`
|
|
4
|
+
|
|
5
|
+
The contexts of immutable proof data.
|
|
6
|
+
|
|
7
|
+
## Type declaration
|
|
8
|
+
|
|
9
|
+
### ContextRoot
|
|
10
|
+
|
|
11
|
+
> `readonly` **ContextRoot**: `"https://schema.twindev.org/immutable-proof/"` = `"https://schema.twindev.org/immutable-proof/"`
|
|
12
|
+
|
|
13
|
+
The context root for the immutable proof types.
|
|
14
|
+
|
|
15
|
+
### ContextRootCommon
|
|
16
|
+
|
|
17
|
+
> `readonly` **ContextRootCommon**: `"https://schema.twindev.org/common/"` = `"https://schema.twindev.org/common/"`
|
|
18
|
+
|
|
19
|
+
The context root for the common types.
|
|
@@ -6,18 +6,6 @@ The types of immutable proof data.
|
|
|
6
6
|
|
|
7
7
|
## Type declaration
|
|
8
8
|
|
|
9
|
-
### ContextRoot
|
|
10
|
-
|
|
11
|
-
> `readonly` **ContextRoot**: `"https://schema.twindev.org/immutable-proof/"` = `"https://schema.twindev.org/immutable-proof/"`
|
|
12
|
-
|
|
13
|
-
The context root for the immutable proof types.
|
|
14
|
-
|
|
15
|
-
### ContextRootCommon
|
|
16
|
-
|
|
17
|
-
> `readonly` **ContextRootCommon**: `"https://schema.twindev.org/common/"` = `"https://schema.twindev.org/common/"`
|
|
18
|
-
|
|
19
|
-
The context root for the common types.
|
|
20
|
-
|
|
21
9
|
### ImmutableProof
|
|
22
10
|
|
|
23
11
|
> `readonly` **ImmutableProof**: `"ImmutableProof"` = `"ImmutableProof"`
|
package/package.json
CHANGED