@twin.org/immutable-proof-models 0.0.1-next.2 → 0.0.1-next.21

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.
@@ -13,6 +13,10 @@ const ImmutableProofTypes = {
13
13
  * The context root for the immutable proof types.
14
14
  */
15
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/",
16
20
  /**
17
21
  * Represents Immutable Proof.
18
22
  */
@@ -26,25 +30,21 @@ const ImmutableProofTypes = {
26
30
  var type = "object";
27
31
  var properties = {
28
32
  "@context": {
29
- anyOf: [
33
+ type: "array",
34
+ minItems: 2,
35
+ items: [
30
36
  {
31
37
  type: "string",
32
38
  "const": "https://schema.twindev.org/immutable-proof/"
33
39
  },
34
40
  {
35
- type: "array",
36
- minItems: 1,
37
- items: [
38
- {
39
- type: "string",
40
- "const": "https://schema.twindev.org/immutable-proof/"
41
- }
42
- ],
43
- additionalItems: {
44
- type: "string"
45
- }
41
+ type: "string",
42
+ "const": "https://schema.twindev.org/common/"
46
43
  }
47
44
  ],
45
+ additionalItems: {
46
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
47
+ },
48
48
  description: "JSON-LD Context."
49
49
  },
50
50
  type: {
@@ -71,6 +71,10 @@ var properties = {
71
71
  proof: {
72
72
  $ref: "https://schema.twindev.org/did/DidProof",
73
73
  description: "The proof which can be undefined if it has not yet been issued."
74
+ },
75
+ immutableReceipt: {
76
+ $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
77
+ description: "The immutable receipt detail for where the proof is stored."
74
78
  }
75
79
  };
76
80
  var required = [
@@ -137,6 +141,20 @@ const ImmutableProofFailure = {
137
141
  SignatureMismatch: "signatureMismatch"
138
142
  };
139
143
 
144
+ // Copyright 2024 IOTA Stiftung.
145
+ // SPDX-License-Identifier: Apache-2.0.
146
+ /**
147
+ * The topics for immutable proof event bus notifications.
148
+ */
149
+ // eslint-disable-next-line @typescript-eslint/naming-convention
150
+ const ImmutableProofTopics = {
151
+ /**
152
+ * A proof was created.
153
+ */
154
+ ProofCreated: "immutable-proof:proof-created"
155
+ };
156
+
140
157
  exports.ImmutableProofDataTypes = ImmutableProofDataTypes;
141
158
  exports.ImmutableProofFailure = ImmutableProofFailure;
159
+ exports.ImmutableProofTopics = ImmutableProofTopics;
142
160
  exports.ImmutableProofTypes = ImmutableProofTypes;
@@ -11,6 +11,10 @@ const ImmutableProofTypes = {
11
11
  * The context root for the immutable proof types.
12
12
  */
13
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/",
14
18
  /**
15
19
  * Represents Immutable Proof.
16
20
  */
@@ -24,25 +28,21 @@ const ImmutableProofTypes = {
24
28
  var type = "object";
25
29
  var properties = {
26
30
  "@context": {
27
- anyOf: [
31
+ type: "array",
32
+ minItems: 2,
33
+ items: [
28
34
  {
29
35
  type: "string",
30
36
  "const": "https://schema.twindev.org/immutable-proof/"
31
37
  },
32
38
  {
33
- type: "array",
34
- minItems: 1,
35
- items: [
36
- {
37
- type: "string",
38
- "const": "https://schema.twindev.org/immutable-proof/"
39
- }
40
- ],
41
- additionalItems: {
42
- type: "string"
43
- }
39
+ type: "string",
40
+ "const": "https://schema.twindev.org/common/"
44
41
  }
45
42
  ],
43
+ additionalItems: {
44
+ $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
45
+ },
46
46
  description: "JSON-LD Context."
47
47
  },
48
48
  type: {
@@ -69,6 +69,10 @@ var properties = {
69
69
  proof: {
70
70
  $ref: "https://schema.twindev.org/did/DidProof",
71
71
  description: "The proof which can be undefined if it has not yet been issued."
72
+ },
73
+ immutableReceipt: {
74
+ $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
75
+ description: "The immutable receipt detail for where the proof is stored."
72
76
  }
73
77
  };
74
78
  var required = [
@@ -135,4 +139,17 @@ const ImmutableProofFailure = {
135
139
  SignatureMismatch: "signatureMismatch"
136
140
  };
137
141
 
138
- export { ImmutableProofDataTypes, ImmutableProofFailure, ImmutableProofTypes };
142
+ // Copyright 2024 IOTA Stiftung.
143
+ // SPDX-License-Identifier: Apache-2.0.
144
+ /**
145
+ * The topics for immutable proof event bus notifications.
146
+ */
147
+ // eslint-disable-next-line @typescript-eslint/naming-convention
148
+ const ImmutableProofTopics = {
149
+ /**
150
+ * A proof was created.
151
+ */
152
+ ProofCreated: "immutable-proof:proof-created"
153
+ };
154
+
155
+ export { ImmutableProofDataTypes, ImmutableProofFailure, ImmutableProofTopics, ImmutableProofTypes };
@@ -4,8 +4,10 @@ export * from "./models/api/IImmutableProofGetRequest";
4
4
  export * from "./models/api/IImmutableProofGetResponse";
5
5
  export * from "./models/api/IImmutableProofVerifyRequest";
6
6
  export * from "./models/api/IImmutableProofVerifyResponse";
7
+ export * from "./models/eventBus/IImmutableProofEventBusProofCreated";
7
8
  export * from "./models/IImmutableProof";
8
- export * from "./models/IImmutableProofVerification";
9
9
  export * from "./models/IImmutableProofComponent";
10
+ export * from "./models/IImmutableProofVerification";
10
11
  export * from "./models/immutableProofFailure";
12
+ export * from "./models/immutableProofTopics";
11
13
  export * from "./models/immutableProofTypes";
@@ -1,3 +1,4 @@
1
+ import type { IJsonLdContextDefinitionElement, IJsonLdNodeObject } from "@twin.org/data-json-ld";
1
2
  import type { IDidProof } from "@twin.org/standards-w3c-did";
2
3
  import type { ImmutableProofTypes } from "./immutableProofTypes";
3
4
  /**
@@ -7,7 +8,11 @@ export interface IImmutableProof {
7
8
  /**
8
9
  * JSON-LD Context.
9
10
  */
10
- "@context": typeof ImmutableProofTypes.ContextRoot | [typeof ImmutableProofTypes.ContextRoot, ...string[]];
11
+ "@context": [
12
+ typeof ImmutableProofTypes.ContextRoot,
13
+ typeof ImmutableProofTypes.ContextRootCommon,
14
+ ...IJsonLdContextDefinitionElement[]
15
+ ];
11
16
  /**
12
17
  * JSON-LD Type.
13
18
  */
@@ -32,4 +37,8 @@ export interface IImmutableProof {
32
37
  * The proof which can be undefined if it has not yet been issued.
33
38
  */
34
39
  proof?: IDidProof;
40
+ /**
41
+ * The immutable receipt detail for where the proof is stored.
42
+ */
43
+ immutableReceipt?: IJsonLdNodeObject;
35
44
  }
@@ -24,11 +24,10 @@ export interface IImmutableProofComponent extends IComponent {
24
24
  /**
25
25
  * Verify an authentication proof.
26
26
  * @param id The id of the proof to verify.
27
- * @param proofObject The object to verify as JSON-LD.
28
27
  * @returns The result of the verification and any failures.
29
28
  * @throws NotFoundError if the proof is not found.
30
29
  */
31
- verify(id: string, proofObject: IJsonLdNodeObject): Promise<IImmutableProofVerification>;
30
+ verify(id: string): Promise<IImmutableProofVerification>;
32
31
  /**
33
32
  * Remove the immutable storage for the proof.
34
33
  * @param id The id of the proof to remove the storage from.
@@ -1,4 +1,3 @@
1
- import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
1
  import type { HeaderTypes, MimeTypes } from "@twin.org/web";
3
2
  /**
4
3
  * Verify a proof.
@@ -19,13 +18,4 @@ export interface IImmutableProofVerifyRequest {
19
18
  */
20
19
  id: string;
21
20
  };
22
- /**
23
- * The parameters from the body.
24
- */
25
- body: {
26
- /**
27
- * The proof object to verify.
28
- */
29
- proofObject: IJsonLdNodeObject;
30
- };
31
21
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Event bus payload for proof created.
3
+ */
4
+ export interface IImmutableProofEventBusProofCreated {
5
+ /**
6
+ * The id of the proof created.
7
+ */
8
+ id: string;
9
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The topics for immutable proof event bus notifications.
3
+ */
4
+ export declare const ImmutableProofTopics: {
5
+ /**
6
+ * A proof was created.
7
+ */
8
+ readonly ProofCreated: "immutable-proof:proof-created";
9
+ };
10
+ /**
11
+ * The topics for immutable proof event bus notifications.
12
+ */
13
+ export type ImmutableProofTopics = (typeof ImmutableProofTopics)[keyof typeof ImmutableProofTopics];
@@ -6,6 +6,10 @@ export declare const ImmutableProofTypes: {
6
6
  * The context root for the immutable proof types.
7
7
  */
8
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/";
9
13
  /**
10
14
  * Represents Immutable Proof.
11
15
  */
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/immutable-proof-models - Changelog
2
2
 
3
- ## v0.0.1-next.2
3
+ ## v0.0.1-next.21
4
4
 
5
5
  - Initial Release
@@ -14,13 +14,16 @@
14
14
  - [IImmutableProofGetResponse](interfaces/IImmutableProofGetResponse.md)
15
15
  - [IImmutableProofVerifyRequest](interfaces/IImmutableProofVerifyRequest.md)
16
16
  - [IImmutableProofVerifyResponse](interfaces/IImmutableProofVerifyResponse.md)
17
+ - [IImmutableProofEventBusProofCreated](interfaces/IImmutableProofEventBusProofCreated.md)
17
18
 
18
19
  ## Type Aliases
19
20
 
20
21
  - [ImmutableProofFailure](type-aliases/ImmutableProofFailure.md)
22
+ - [ImmutableProofTopics](type-aliases/ImmutableProofTopics.md)
21
23
  - [ImmutableProofTypes](type-aliases/ImmutableProofTypes.md)
22
24
 
23
25
  ## Variables
24
26
 
25
27
  - [ImmutableProofFailure](variables/ImmutableProofFailure.md)
28
+ - [ImmutableProofTopics](variables/ImmutableProofTopics.md)
26
29
  - [ImmutableProofTypes](variables/ImmutableProofTypes.md)
@@ -6,7 +6,7 @@ Interface describing an immutable proof state.
6
6
 
7
7
  ### @context
8
8
 
9
- > **@context**: `"https://schema.twindev.org/immutable-proof/"` \| [`"https://schema.twindev.org/immutable-proof/"`, `...string[]`]
9
+ > **@context**: \[`"https://schema.twindev.org/immutable-proof/"`, `"https://schema.twindev.org/common/"`, `...IJsonLdContextDefinitionElement[]`\]
10
10
 
11
11
  JSON-LD Context.
12
12
 
@@ -57,3 +57,11 @@ The hash of the object associated with the proof.
57
57
  > `optional` **proof**: `IDidProof`
58
58
 
59
59
  The proof which can be undefined if it has not yet been issued.
60
+
61
+ ***
62
+
63
+ ### immutableReceipt?
64
+
65
+ > `optional` **immutableReceipt**: `IJsonLdNodeObject`
66
+
67
+ The immutable receipt detail for where the proof is stored.
@@ -16,15 +16,21 @@ Create a new authentication proof.
16
16
 
17
17
  #### Parameters
18
18
 
19
- **proofObject**: `IJsonLdNodeObject`
19
+ ##### proofObject
20
+
21
+ `IJsonLdNodeObject`
20
22
 
21
23
  The object for the proof as JSON-LD.
22
24
 
23
- **userIdentity?**: `string`
25
+ ##### userIdentity?
26
+
27
+ `string`
24
28
 
25
29
  The identity to create the immutable proof operation with.
26
30
 
27
- **nodeIdentity?**: `string`
31
+ ##### nodeIdentity?
32
+
33
+ `string`
28
34
 
29
35
  The node identity to use for vault operations.
30
36
 
@@ -44,7 +50,9 @@ Get an authentication proof.
44
50
 
45
51
  #### Parameters
46
52
 
47
- **id**: `string`
53
+ ##### id
54
+
55
+ `string`
48
56
 
49
57
  The id of the proof to get.
50
58
 
@@ -62,19 +70,17 @@ NotFoundError if the proof is not found.
62
70
 
63
71
  ### verify()
64
72
 
65
- > **verify**(`id`, `proofObject`): `Promise`\<[`IImmutableProofVerification`](IImmutableProofVerification.md)\>
73
+ > **verify**(`id`): `Promise`\<[`IImmutableProofVerification`](IImmutableProofVerification.md)\>
66
74
 
67
75
  Verify an authentication proof.
68
76
 
69
77
  #### Parameters
70
78
 
71
- **id**: `string`
79
+ ##### id
72
80
 
73
- The id of the proof to verify.
81
+ `string`
74
82
 
75
- **proofObject**: `IJsonLdNodeObject`
76
-
77
- The object to verify as JSON-LD.
83
+ The id of the proof to verify.
78
84
 
79
85
  #### Returns
80
86
 
@@ -96,11 +102,15 @@ Remove the immutable storage for the proof.
96
102
 
97
103
  #### Parameters
98
104
 
99
- **id**: `string`
105
+ ##### id
106
+
107
+ `string`
100
108
 
101
109
  The id of the proof to remove the storage from.
102
110
 
103
- **nodeIdentity?**: `string`
111
+ ##### nodeIdentity?
112
+
113
+ `string`
104
114
 
105
115
  The node identity to use for vault operations.
106
116
 
@@ -0,0 +1,11 @@
1
+ # Interface: IImmutableProofEventBusProofCreated
2
+
3
+ Event bus payload for proof created.
4
+
5
+ ## Properties
6
+
7
+ ### id
8
+
9
+ > **id**: `string`
10
+
11
+ The id of the proof created.
@@ -27,17 +27,3 @@ The parameters from the path.
27
27
  > **id**: `string`
28
28
 
29
29
  The id of the immutable proof to verify.
30
-
31
- ***
32
-
33
- ### body
34
-
35
- > **body**: `object`
36
-
37
- The parameters from the body.
38
-
39
- #### proofObject
40
-
41
- > **proofObject**: `IJsonLdNodeObject`
42
-
43
- The proof object to verify.
@@ -0,0 +1,5 @@
1
+ # Type Alias: ImmutableProofTopics
2
+
3
+ > **ImmutableProofTopics**: *typeof* [`ImmutableProofTopics`](../variables/ImmutableProofTopics.md)\[keyof *typeof* [`ImmutableProofTopics`](../variables/ImmutableProofTopics.md)\]
4
+
5
+ The topics for immutable proof event bus notifications.
@@ -0,0 +1,13 @@
1
+ # Variable: ImmutableProofTopics
2
+
3
+ > `const` **ImmutableProofTopics**: `object`
4
+
5
+ The topics for immutable proof event bus notifications.
6
+
7
+ ## Type declaration
8
+
9
+ ### ProofCreated
10
+
11
+ > `readonly` **ProofCreated**: `"immutable-proof:proof-created"` = `"immutable-proof:proof-created"`
12
+
13
+ A proof was created.
@@ -12,6 +12,12 @@ The types of immutable proof data.
12
12
 
13
13
  The context root for the immutable proof types.
14
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
+
15
21
  ### ImmutableProof
16
22
 
17
23
  > `readonly` **ImmutableProof**: `"ImmutableProof"` = `"ImmutableProof"`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/immutable-proof-models",
3
- "version": "0.0.1-next.2",
3
+ "version": "0.0.1-next.21",
4
4
  "description": "Models which define the structure of the immutable proof connectors and services",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,11 +27,11 @@
27
27
  "types": "./dist/types/index.d.ts",
28
28
  "exports": {
29
29
  ".": {
30
+ "types": "./dist/types/index.d.ts",
30
31
  "require": "./dist/cjs/index.cjs",
31
- "import": "./dist/esm/index.mjs",
32
- "types": "./dist/types/index.d.ts"
32
+ "import": "./dist/esm/index.mjs"
33
33
  },
34
- "./locales": "./locales"
34
+ "./locales/*.json": "./locales/*.json"
35
35
  },
36
36
  "files": [
37
37
  "dist/cjs",