@twin.org/synchronised-storage-rest-client 0.0.1-next.8 → 0.0.3-next.1

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.
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export * from "./synchronisedStorageRestClient.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,oCAAoC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./synchronisedStorageRestClient.js\";\n"]}
@@ -0,0 +1,64 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import { BaseRestClient } from "@twin.org/api-core";
4
+ import { ContextIdKeys } from "@twin.org/context";
5
+ import { Guards } from "@twin.org/core";
6
+ /**
7
+ * Client for performing synchronised storage through to REST endpoints.
8
+ */
9
+ export class SynchronisedStorageRestClient extends BaseRestClient {
10
+ /**
11
+ * Runtime name for the class.
12
+ */
13
+ static CLASS_NAME = "SynchronisedStorageRestClient";
14
+ /**
15
+ * Create a new instance of SynchronisedStorageRestClient.
16
+ * @param config The configuration for the client.
17
+ */
18
+ constructor(config) {
19
+ super(SynchronisedStorageRestClient.CLASS_NAME, config, "synchronised-storage");
20
+ }
21
+ /**
22
+ * Returns the class name of the component.
23
+ * @returns The class name of the component.
24
+ */
25
+ className() {
26
+ return SynchronisedStorageRestClient.CLASS_NAME;
27
+ }
28
+ /**
29
+ * Get the decryption key for the synchronised storage.
30
+ * This is used to decrypt the data stored in the synchronised storage.
31
+ * @param actionRequest The action request used in the verifiable credential.
32
+ * @returns The decryption key.
33
+ */
34
+ async getDecryptionKey(actionRequest) {
35
+ Guards.object(SynchronisedStorageRestClient.CLASS_NAME, "actionRequest", actionRequest);
36
+ const response = await this.fetch("/decryption-key", "GET", undefined, {
37
+ authenticationGeneratorType: "verifiable-credential",
38
+ authenticationData: {
39
+ contextId: ContextIdKeys.Organization,
40
+ subject: actionRequest
41
+ }
42
+ });
43
+ return response.body.decryptionKey;
44
+ }
45
+ /**
46
+ * Synchronise a set of changes from an untrusted node, assumes this is a trusted node.
47
+ * @param syncChangeSet The change set to synchronise.
48
+ * @param actionRequest The action request used in the verifiable credential.
49
+ * @returns Nothing.
50
+ */
51
+ async syncChangeSet(syncChangeSet, actionRequest) {
52
+ Guards.object(SynchronisedStorageRestClient.CLASS_NAME, "syncChangeSet", syncChangeSet);
53
+ await this.fetch("/sync-changeset", "POST", {
54
+ body: syncChangeSet
55
+ }, {
56
+ authenticationGeneratorType: "verifiable-credential",
57
+ authenticationData: {
58
+ contextId: ContextIdKeys.Organization,
59
+ subject: actionRequest
60
+ }
61
+ });
62
+ }
63
+ }
64
+ //# sourceMappingURL=synchronisedStorageRestClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"synchronisedStorageRestClient.js","sourceRoot":"","sources":["../../src/synchronisedStorageRestClient.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAWxC;;GAEG;AACH,MAAM,OAAO,6BACZ,SAAQ,cAAc;IAGtB;;OAEG;IACI,MAAM,CAAU,UAAU,mCAAmD;IAEpF;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,CAAC,6BAA6B,CAAC,UAAU,EAAE,MAAM,EAAE,sBAAsB,CAAC,CAAC;IACjF,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,6BAA6B,CAAC,UAAU,CAAC;IACjD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,gBAAgB,CAC5B,aAAmD;QAEnD,MAAM,CAAC,MAAM,CACZ,6BAA6B,CAAC,UAAU,mBAExC,aAAa,CACb,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,iBAAiB,EACjB,KAAK,EACL,SAAS,EACT;YACC,2BAA2B,EAAE,uBAAuB;YACpD,kBAAkB,EAAE;gBACnB,SAAS,EAAE,aAAa,CAAC,YAAY;gBACrC,OAAO,EAAE,aAAa;aACtB;SACD,CACD,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC;IACpC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,aAAa,CACzB,aAA6B,EAC7B,aAAmD;QAEnD,MAAM,CAAC,MAAM,CACZ,6BAA6B,CAAC,UAAU,mBAExC,aAAa,CACb,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CACf,iBAAiB,EACjB,MAAM,EACN;YACC,IAAI,EAAE,aAAa;SACnB,EACD;YACC,2BAA2B,EAAE,uBAAuB;YACpD,kBAAkB,EAAE;gBACnB,SAAS,EAAE,aAAa,CAAC,YAAY;gBACrC,OAAO,EAAE,aAAa;aACtB;SACD,CACD,CAAC;IACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport type { IBaseRestClientConfig, INoContentResponse } from \"@twin.org/api-models\";\nimport { ContextIdKeys } from \"@twin.org/context\";\nimport { Guards } from \"@twin.org/core\";\nimport type { IIdentityAuthenticationActionRequest } from \"@twin.org/identity-authentication\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type {\n\tISyncChangeSet,\n\tISyncChangeSetRequest,\n\tISyncDecryptionKeyRequest,\n\tISyncDecryptionKeyResponse,\n\tISynchronisedStorageComponent\n} from \"@twin.org/synchronised-storage-models\";\n\n/**\n * Client for performing synchronised storage through to REST endpoints.\n */\nexport class SynchronisedStorageRestClient\n\textends BaseRestClient\n\timplements ISynchronisedStorageComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<SynchronisedStorageRestClient>();\n\n\t/**\n\t * Create a new instance of SynchronisedStorageRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(SynchronisedStorageRestClient.CLASS_NAME, config, \"synchronised-storage\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn SynchronisedStorageRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Get the decryption key for the synchronised storage.\n\t * This is used to decrypt the data stored in the synchronised storage.\n\t * @param actionRequest The action request used in the verifiable credential.\n\t * @returns The decryption key.\n\t */\n\tpublic async getDecryptionKey(\n\t\tactionRequest: IIdentityAuthenticationActionRequest\n\t): Promise<string> {\n\t\tGuards.object<IIdentityAuthenticationActionRequest>(\n\t\t\tSynchronisedStorageRestClient.CLASS_NAME,\n\t\t\tnameof(actionRequest),\n\t\t\tactionRequest\n\t\t);\n\n\t\tconst response = await this.fetch<ISyncDecryptionKeyRequest, ISyncDecryptionKeyResponse>(\n\t\t\t\"/decryption-key\",\n\t\t\t\"GET\",\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tauthenticationGeneratorType: \"verifiable-credential\",\n\t\t\t\tauthenticationData: {\n\t\t\t\t\tcontextId: ContextIdKeys.Organization,\n\t\t\t\t\tsubject: actionRequest\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body.decryptionKey;\n\t}\n\n\t/**\n\t * Synchronise a set of changes from an untrusted node, assumes this is a trusted node.\n\t * @param syncChangeSet The change set to synchronise.\n\t * @param actionRequest The action request used in the verifiable credential.\n\t * @returns Nothing.\n\t */\n\tpublic async syncChangeSet(\n\t\tsyncChangeSet: ISyncChangeSet,\n\t\tactionRequest: IIdentityAuthenticationActionRequest\n\t): Promise<void> {\n\t\tGuards.object<ISyncChangeSet>(\n\t\t\tSynchronisedStorageRestClient.CLASS_NAME,\n\t\t\tnameof(syncChangeSet),\n\t\t\tsyncChangeSet\n\t\t);\n\n\t\tawait this.fetch<ISyncChangeSetRequest, INoContentResponse>(\n\t\t\t\"/sync-changeset\",\n\t\t\t\"POST\",\n\t\t\t{\n\t\t\t\tbody: syncChangeSet\n\t\t\t},\n\t\t\t{\n\t\t\t\tauthenticationGeneratorType: \"verifiable-credential\",\n\t\t\t\tauthenticationData: {\n\t\t\t\t\tcontextId: ContextIdKeys.Organization,\n\t\t\t\t\tsubject: actionRequest\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- export * from "./synchronisedStorageClient";
1
+ export * from "./synchronisedStorageRestClient.js";
@@ -1,32 +1,37 @@
1
1
  import { BaseRestClient } from "@twin.org/api-core";
2
2
  import type { IBaseRestClientConfig } from "@twin.org/api-models";
3
- import type { IProof } from "@twin.org/standards-w3c-did";
3
+ import type { IIdentityAuthenticationActionRequest } from "@twin.org/identity-authentication";
4
4
  import type { ISyncChangeSet, ISynchronisedStorageComponent } from "@twin.org/synchronised-storage-models";
5
5
  /**
6
6
  * Client for performing synchronised storage through to REST endpoints.
7
7
  */
8
- export declare class SynchronisedStorageClient extends BaseRestClient implements ISynchronisedStorageComponent {
8
+ export declare class SynchronisedStorageRestClient extends BaseRestClient implements ISynchronisedStorageComponent {
9
9
  /**
10
10
  * Runtime name for the class.
11
11
  */
12
- readonly CLASS_NAME: string;
12
+ static readonly CLASS_NAME: string;
13
13
  /**
14
- * Create a new instance of SynchronisedStorageClient.
14
+ * Create a new instance of SynchronisedStorageRestClient.
15
15
  * @param config The configuration for the client.
16
16
  */
17
17
  constructor(config: IBaseRestClientConfig);
18
+ /**
19
+ * Returns the class name of the component.
20
+ * @returns The class name of the component.
21
+ */
22
+ className(): string;
18
23
  /**
19
24
  * Get the decryption key for the synchronised storage.
20
25
  * This is used to decrypt the data stored in the synchronised storage.
21
- * @param nodeIdentity The identity of the node requesting the decryption key.
22
- * @param proof The proof of the request so we know the request is from the specified node.
26
+ * @param actionRequest The action request used in the verifiable credential.
23
27
  * @returns The decryption key.
24
28
  */
25
- getDecryptionKey(nodeIdentity: string, proof: IProof): Promise<string>;
29
+ getDecryptionKey(actionRequest: IIdentityAuthenticationActionRequest): Promise<string>;
26
30
  /**
27
31
  * Synchronise a set of changes from an untrusted node, assumes this is a trusted node.
28
32
  * @param syncChangeSet The change set to synchronise.
33
+ * @param actionRequest The action request used in the verifiable credential.
29
34
  * @returns Nothing.
30
35
  */
31
- syncChangeSet(syncChangeSet: ISyncChangeSet): Promise<void>;
36
+ syncChangeSet(syncChangeSet: ISyncChangeSet, actionRequest: IIdentityAuthenticationActionRequest): Promise<void>;
32
37
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,138 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.1](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.3-next.0...synchronised-storage-rest-client-v0.0.3-next.1) (2025-11-12)
4
+
5
+
6
+ ### Features
7
+
8
+ * add context id features ([#24](https://github.com/twinfoundation/synchronised-storage/issues/24)) ([5266b18](https://github.com/twinfoundation/synchronised-storage/commit/5266b18088317c7dc274a209a79102a6fc88a8e4))
9
+ * add rights management integration ([d003d33](https://github.com/twinfoundation/synchronised-storage/commit/d003d33d2d2b4a4aa1379071eed71a707ebcb4de))
10
+ * add validate-locales ([e3d7b98](https://github.com/twinfoundation/synchronised-storage/commit/e3d7b98839e9ca624855717c8957d572c4e09abf))
11
+ * blob storage connector instead of component ([#7](https://github.com/twinfoundation/synchronised-storage/issues/7)) ([ea27241](https://github.com/twinfoundation/synchronised-storage/commit/ea27241cf0810b52ab7a6be7346809d127b7109a))
12
+ * eslint migration to flat config ([f601c14](https://github.com/twinfoundation/synchronised-storage/commit/f601c14f6adef3290554dc7df6e6b3528aa0dc2b))
13
+ * initial commit ([16949b8](https://github.com/twinfoundation/synchronised-storage/commit/16949b8e5bdb190f053c52af352290e3fd964f9a))
14
+ * update framework core ([99f09cc](https://github.com/twinfoundation/synchronised-storage/commit/99f09cc94cfb9fff6b3a345775eeae2ab3192ed2))
15
+ * update to in built vc auth mechanism ([411a371](https://github.com/twinfoundation/synchronised-storage/commit/411a3716830195ebf54755a1633b05d5c3f96754))
16
+
17
+
18
+ ### Dependencies
19
+
20
+ * The following workspace dependencies were updated
21
+ * dependencies
22
+ * @twin.org/synchronised-storage-models bumped from 0.0.3-next.0 to 0.0.3-next.1
23
+
24
+ ## [0.0.1-next.16](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.1-next.15...synchronised-storage-rest-client-v0.0.1-next.16) (2025-10-09)
25
+
26
+
27
+ ### Features
28
+
29
+ * add validate-locales ([e3d7b98](https://github.com/twinfoundation/synchronised-storage/commit/e3d7b98839e9ca624855717c8957d572c4e09abf))
30
+
31
+
32
+ ### Dependencies
33
+
34
+ * The following workspace dependencies were updated
35
+ * dependencies
36
+ * @twin.org/synchronised-storage-models bumped from 0.0.1-next.15 to 0.0.1-next.16
37
+
38
+ ## [0.0.1-next.15](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.1-next.14...synchronised-storage-rest-client-v0.0.1-next.15) (2025-09-23)
39
+
40
+
41
+ ### Features
42
+
43
+ * update to in built vc auth mechanism ([411a371](https://github.com/twinfoundation/synchronised-storage/commit/411a3716830195ebf54755a1633b05d5c3f96754))
44
+
45
+
46
+ ### Dependencies
47
+
48
+ * The following workspace dependencies were updated
49
+ * dependencies
50
+ * @twin.org/synchronised-storage-models bumped from 0.0.1-next.14 to 0.0.1-next.15
51
+
52
+ ## [0.0.1-next.14](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.1-next.13...synchronised-storage-rest-client-v0.0.1-next.14) (2025-09-22)
53
+
54
+
55
+ ### Features
56
+
57
+ * add rights management integration ([d003d33](https://github.com/twinfoundation/synchronised-storage/commit/d003d33d2d2b4a4aa1379071eed71a707ebcb4de))
58
+
59
+
60
+ ### Dependencies
61
+
62
+ * The following workspace dependencies were updated
63
+ * dependencies
64
+ * @twin.org/synchronised-storage-models bumped from 0.0.1-next.13 to 0.0.1-next.14
65
+
66
+ ## [0.0.1-next.13](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.1-next.12...synchronised-storage-rest-client-v0.0.1-next.13) (2025-08-29)
67
+
68
+
69
+ ### Features
70
+
71
+ * eslint migration to flat config ([f601c14](https://github.com/twinfoundation/synchronised-storage/commit/f601c14f6adef3290554dc7df6e6b3528aa0dc2b))
72
+
73
+
74
+ ### Dependencies
75
+
76
+ * The following workspace dependencies were updated
77
+ * dependencies
78
+ * @twin.org/synchronised-storage-models bumped from 0.0.1-next.12 to 0.0.1-next.13
79
+
80
+ ## [0.0.1-next.12](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.1-next.11...synchronised-storage-rest-client-v0.0.1-next.12) (2025-08-21)
81
+
82
+
83
+ ### Features
84
+
85
+ * update framework core ([99f09cc](https://github.com/twinfoundation/synchronised-storage/commit/99f09cc94cfb9fff6b3a345775eeae2ab3192ed2))
86
+
87
+
88
+ ### Dependencies
89
+
90
+ * The following workspace dependencies were updated
91
+ * dependencies
92
+ * @twin.org/synchronised-storage-models bumped from 0.0.1-next.11 to 0.0.1-next.12
93
+
94
+ ## [0.0.1-next.11](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.1-next.10...synchronised-storage-rest-client-v0.0.1-next.11) (2025-08-15)
95
+
96
+
97
+ ### Miscellaneous Chores
98
+
99
+ * **synchronised-storage-rest-client:** Synchronize repo versions
100
+
101
+
102
+ ### Dependencies
103
+
104
+ * The following workspace dependencies were updated
105
+ * dependencies
106
+ * @twin.org/synchronised-storage-models bumped from 0.0.1-next.10 to 0.0.1-next.11
107
+
108
+ ## [0.0.1-next.10](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.1-next.9...synchronised-storage-rest-client-v0.0.1-next.10) (2025-08-15)
109
+
110
+
111
+ ### Miscellaneous Chores
112
+
113
+ * **synchronised-storage-rest-client:** Synchronize repo versions
114
+
115
+
116
+ ### Dependencies
117
+
118
+ * The following workspace dependencies were updated
119
+ * dependencies
120
+ * @twin.org/synchronised-storage-models bumped from 0.0.1-next.9 to 0.0.1-next.10
121
+
122
+ ## [0.0.1-next.9](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.1-next.8...synchronised-storage-rest-client-v0.0.1-next.9) (2025-08-13)
123
+
124
+
125
+ ### Miscellaneous Chores
126
+
127
+ * **synchronised-storage-rest-client:** Synchronize repo versions
128
+
129
+
130
+ ### Dependencies
131
+
132
+ * The following workspace dependencies were updated
133
+ * dependencies
134
+ * @twin.org/synchronised-storage-models bumped from 0.0.1-next.8 to 0.0.1-next.9
135
+
3
136
  ## [0.0.1-next.8](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.1-next.7...synchronised-storage-rest-client-v0.0.1-next.8) (2025-08-13)
4
137
 
5
138
 
@@ -1,4 +1,4 @@
1
- # Class: SynchronisedStorageClient
1
+ # Class: SynchronisedStorageRestClient
2
2
 
3
3
  Client for performing synchronised storage through to REST endpoints.
4
4
 
@@ -14,9 +14,9 @@ Client for performing synchronised storage through to REST endpoints.
14
14
 
15
15
  ### Constructor
16
16
 
17
- > **new SynchronisedStorageClient**(`config`): `SynchronisedStorageClient`
17
+ > **new SynchronisedStorageRestClient**(`config`): `SynchronisedStorageRestClient`
18
18
 
19
- Create a new instance of SynchronisedStorageClient.
19
+ Create a new instance of SynchronisedStorageRestClient.
20
20
 
21
21
  #### Parameters
22
22
 
@@ -28,7 +28,7 @@ The configuration for the client.
28
28
 
29
29
  #### Returns
30
30
 
31
- `SynchronisedStorageClient`
31
+ `SynchronisedStorageRestClient`
32
32
 
33
33
  #### Overrides
34
34
 
@@ -38,36 +38,44 @@ The configuration for the client.
38
38
 
39
39
  ### CLASS\_NAME
40
40
 
41
- > `readonly` **CLASS\_NAME**: `string` = `SynchronisedStorageClient._CLASS_NAME`
41
+ > `readonly` `static` **CLASS\_NAME**: `string`
42
42
 
43
43
  Runtime name for the class.
44
44
 
45
+ ## Methods
46
+
47
+ ### className()
48
+
49
+ > **className**(): `string`
50
+
51
+ Returns the class name of the component.
52
+
53
+ #### Returns
54
+
55
+ `string`
56
+
57
+ The class name of the component.
58
+
45
59
  #### Implementation of
46
60
 
47
- `ISynchronisedStorageComponent.CLASS_NAME`
61
+ `ISynchronisedStorageComponent.className`
48
62
 
49
- ## Methods
63
+ ***
50
64
 
51
65
  ### getDecryptionKey()
52
66
 
53
- > **getDecryptionKey**(`nodeIdentity`, `proof`): `Promise`\<`string`\>
67
+ > **getDecryptionKey**(`actionRequest`): `Promise`\<`string`\>
54
68
 
55
69
  Get the decryption key for the synchronised storage.
56
70
  This is used to decrypt the data stored in the synchronised storage.
57
71
 
58
72
  #### Parameters
59
73
 
60
- ##### nodeIdentity
61
-
62
- `string`
63
-
64
- The identity of the node requesting the decryption key.
74
+ ##### actionRequest
65
75
 
66
- ##### proof
76
+ `IIdentityAuthenticationActionRequest`
67
77
 
68
- `IProof`
69
-
70
- The proof of the request so we know the request is from the specified node.
78
+ The action request used in the verifiable credential.
71
79
 
72
80
  #### Returns
73
81
 
@@ -83,7 +91,7 @@ The decryption key.
83
91
 
84
92
  ### syncChangeSet()
85
93
 
86
- > **syncChangeSet**(`syncChangeSet`): `Promise`\<`void`\>
94
+ > **syncChangeSet**(`syncChangeSet`, `actionRequest`): `Promise`\<`void`\>
87
95
 
88
96
  Synchronise a set of changes from an untrusted node, assumes this is a trusted node.
89
97
 
@@ -95,6 +103,12 @@ Synchronise a set of changes from an untrusted node, assumes this is a trusted n
95
103
 
96
104
  The change set to synchronise.
97
105
 
106
+ ##### actionRequest
107
+
108
+ `IIdentityAuthenticationActionRequest`
109
+
110
+ The action request used in the verifiable credential.
111
+
98
112
  #### Returns
99
113
 
100
114
  `Promise`\<`void`\>
@@ -2,4 +2,4 @@
2
2
 
3
3
  ## Classes
4
4
 
5
- - [SynchronisedStorageClient](classes/SynchronisedStorageClient.md)
5
+ - [SynchronisedStorageRestClient](classes/SynchronisedStorageRestClient.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/synchronised-storage-rest-client",
3
- "version": "0.0.1-next.8",
3
+ "version": "0.0.3-next.1",
4
4
  "description": "Synchronised storage contract implementation which can connect to REST endpoints",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,28 +16,41 @@
16
16
  "dependencies": {
17
17
  "@twin.org/api-core": "next",
18
18
  "@twin.org/api-models": "next",
19
+ "@twin.org/context": "next",
19
20
  "@twin.org/core": "next",
20
21
  "@twin.org/entity": "next",
22
+ "@twin.org/identity-authentication": "next",
21
23
  "@twin.org/nameof": "next",
22
24
  "@twin.org/standards-w3c-did": "next",
23
- "@twin.org/synchronised-storage-models": "0.0.1-next.8"
25
+ "@twin.org/synchronised-storage-models": "0.0.3-next.1",
26
+ "@twin.org/web": "next"
24
27
  },
25
- "main": "./dist/cjs/index.cjs",
26
- "module": "./dist/esm/index.mjs",
28
+ "main": "./dist/es/index.js",
27
29
  "types": "./dist/types/index.d.ts",
28
30
  "exports": {
29
31
  ".": {
30
32
  "types": "./dist/types/index.d.ts",
31
- "require": "./dist/cjs/index.cjs",
32
- "import": "./dist/esm/index.mjs"
33
+ "import": "./dist/es/index.js",
34
+ "default": "./dist/es/index.js"
33
35
  },
34
36
  "./locales/*.json": "./locales/*.json"
35
37
  },
36
38
  "files": [
37
- "dist/cjs",
38
- "dist/esm",
39
+ "dist/es",
39
40
  "dist/types",
40
41
  "locales",
41
42
  "docs"
42
- ]
43
+ ],
44
+ "keywords": [
45
+ "twin",
46
+ "trade",
47
+ "iota",
48
+ "framework",
49
+ "blockchain",
50
+ "synchronised-storage"
51
+ ],
52
+ "bugs": {
53
+ "url": "git+https://github.com/twinfoundation/synchronised-storage/issues"
54
+ },
55
+ "homepage": "https://twindev.org"
43
56
  }
@@ -1,59 +0,0 @@
1
- 'use strict';
2
-
3
- var apiCore = require('@twin.org/api-core');
4
- var core = require('@twin.org/core');
5
-
6
- // Copyright 2024 IOTA Stiftung.
7
- // SPDX-License-Identifier: Apache-2.0.
8
- /**
9
- * Client for performing synchronised storage through to REST endpoints.
10
- */
11
- class SynchronisedStorageClient extends apiCore.BaseRestClient {
12
- /**
13
- * Runtime name for the class.
14
- * @internal
15
- */
16
- static _CLASS_NAME = "SynchronisedStorageClient";
17
- /**
18
- * Runtime name for the class.
19
- */
20
- CLASS_NAME = SynchronisedStorageClient._CLASS_NAME;
21
- /**
22
- * Create a new instance of SynchronisedStorageClient.
23
- * @param config The configuration for the client.
24
- */
25
- constructor(config) {
26
- super(SynchronisedStorageClient._CLASS_NAME, config, "synchronised-storage");
27
- }
28
- /**
29
- * Get the decryption key for the synchronised storage.
30
- * This is used to decrypt the data stored in the synchronised storage.
31
- * @param nodeIdentity The identity of the node requesting the decryption key.
32
- * @param proof The proof of the request so we know the request is from the specified node.
33
- * @returns The decryption key.
34
- */
35
- async getDecryptionKey(nodeIdentity, proof) {
36
- core.Guards.stringValue(this.CLASS_NAME, "nodeIdentity", nodeIdentity);
37
- core.Guards.object(this.CLASS_NAME, "proof", proof);
38
- const response = await this.fetch("/decryption-key", "POST", {
39
- body: {
40
- nodeIdentity,
41
- proof
42
- }
43
- });
44
- return response.body.decryptionKey;
45
- }
46
- /**
47
- * Synchronise a set of changes from an untrusted node, assumes this is a trusted node.
48
- * @param syncChangeSet The change set to synchronise.
49
- * @returns Nothing.
50
- */
51
- async syncChangeSet(syncChangeSet) {
52
- core.Guards.object(this.CLASS_NAME, "syncChangeSet", syncChangeSet);
53
- await this.fetch("/sync-changeset", "POST", {
54
- body: syncChangeSet
55
- });
56
- }
57
- }
58
-
59
- exports.SynchronisedStorageClient = SynchronisedStorageClient;
@@ -1,57 +0,0 @@
1
- import { BaseRestClient } from '@twin.org/api-core';
2
- import { Guards } from '@twin.org/core';
3
-
4
- // Copyright 2024 IOTA Stiftung.
5
- // SPDX-License-Identifier: Apache-2.0.
6
- /**
7
- * Client for performing synchronised storage through to REST endpoints.
8
- */
9
- class SynchronisedStorageClient extends BaseRestClient {
10
- /**
11
- * Runtime name for the class.
12
- * @internal
13
- */
14
- static _CLASS_NAME = "SynchronisedStorageClient";
15
- /**
16
- * Runtime name for the class.
17
- */
18
- CLASS_NAME = SynchronisedStorageClient._CLASS_NAME;
19
- /**
20
- * Create a new instance of SynchronisedStorageClient.
21
- * @param config The configuration for the client.
22
- */
23
- constructor(config) {
24
- super(SynchronisedStorageClient._CLASS_NAME, config, "synchronised-storage");
25
- }
26
- /**
27
- * Get the decryption key for the synchronised storage.
28
- * This is used to decrypt the data stored in the synchronised storage.
29
- * @param nodeIdentity The identity of the node requesting the decryption key.
30
- * @param proof The proof of the request so we know the request is from the specified node.
31
- * @returns The decryption key.
32
- */
33
- async getDecryptionKey(nodeIdentity, proof) {
34
- Guards.stringValue(this.CLASS_NAME, "nodeIdentity", nodeIdentity);
35
- Guards.object(this.CLASS_NAME, "proof", proof);
36
- const response = await this.fetch("/decryption-key", "POST", {
37
- body: {
38
- nodeIdentity,
39
- proof
40
- }
41
- });
42
- return response.body.decryptionKey;
43
- }
44
- /**
45
- * Synchronise a set of changes from an untrusted node, assumes this is a trusted node.
46
- * @param syncChangeSet The change set to synchronise.
47
- * @returns Nothing.
48
- */
49
- async syncChangeSet(syncChangeSet) {
50
- Guards.object(this.CLASS_NAME, "syncChangeSet", syncChangeSet);
51
- await this.fetch("/sync-changeset", "POST", {
52
- body: syncChangeSet
53
- });
54
- }
55
- }
56
-
57
- export { SynchronisedStorageClient };