@twin.org/synchronised-storage-rest-client 0.0.3-next.1 → 0.0.3-next.10
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/README.md +2 -2
- package/dist/es/synchronisedStorageRestClient.js +13 -17
- package/dist/es/synchronisedStorageRestClient.js.map +1 -1
- package/dist/types/synchronisedStorageRestClient.d.ts +4 -5
- package/docs/changelog.md +127 -1
- package/docs/examples.md +56 -1
- package/docs/reference/classes/SynchronisedStorageRestClient.md +12 -12
- package/package.json +3 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Synchronised Storage REST Client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package provides a client for calling trusted synchronised storage REST endpoints, including decryption key retrieval and submission of change sets from connected nodes.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright 2024 IOTA Stiftung.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
3
|
import { BaseRestClient } from "@twin.org/api-core";
|
|
4
|
-
import { ContextIdKeys } from "@twin.org/context";
|
|
5
4
|
import { Guards } from "@twin.org/core";
|
|
5
|
+
import { HeaderHelper, HeaderTypes } from "@twin.org/web";
|
|
6
6
|
/**
|
|
7
7
|
* Client for performing synchronised storage through to REST endpoints.
|
|
8
8
|
*/
|
|
@@ -28,16 +28,14 @@ export class SynchronisedStorageRestClient extends BaseRestClient {
|
|
|
28
28
|
/**
|
|
29
29
|
* Get the decryption key for the synchronised storage.
|
|
30
30
|
* This is used to decrypt the data stored in the synchronised storage.
|
|
31
|
-
* @param
|
|
31
|
+
* @param trustPayload Trust payload to verify the requesters identity.
|
|
32
32
|
* @returns The decryption key.
|
|
33
33
|
*/
|
|
34
|
-
async getDecryptionKey(
|
|
35
|
-
Guards.
|
|
36
|
-
const response = await this.fetch("/decryption-key", "GET",
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
contextId: ContextIdKeys.Organization,
|
|
40
|
-
subject: actionRequest
|
|
34
|
+
async getDecryptionKey(trustPayload) {
|
|
35
|
+
Guards.stringValue(SynchronisedStorageRestClient.CLASS_NAME, "trustPayload", trustPayload);
|
|
36
|
+
const response = await this.fetch("/decryption-key", "GET", {
|
|
37
|
+
headers: {
|
|
38
|
+
[HeaderTypes.Authorization]: HeaderHelper.createBearer(trustPayload)
|
|
41
39
|
}
|
|
42
40
|
});
|
|
43
41
|
return response.body.decryptionKey;
|
|
@@ -45,19 +43,17 @@ export class SynchronisedStorageRestClient extends BaseRestClient {
|
|
|
45
43
|
/**
|
|
46
44
|
* Synchronise a set of changes from an untrusted node, assumes this is a trusted node.
|
|
47
45
|
* @param syncChangeSet The change set to synchronise.
|
|
48
|
-
* @param
|
|
46
|
+
* @param trustPayload Trust payload to verify the requesters identity.
|
|
49
47
|
* @returns Nothing.
|
|
50
48
|
*/
|
|
51
|
-
async syncChangeSet(syncChangeSet,
|
|
49
|
+
async syncChangeSet(syncChangeSet, trustPayload) {
|
|
52
50
|
Guards.object(SynchronisedStorageRestClient.CLASS_NAME, "syncChangeSet", syncChangeSet);
|
|
51
|
+
Guards.stringValue(SynchronisedStorageRestClient.CLASS_NAME, "trustPayload", trustPayload);
|
|
53
52
|
await this.fetch("/sync-changeset", "POST", {
|
|
53
|
+
headers: {
|
|
54
|
+
[HeaderTypes.Authorization]: HeaderHelper.createBearer(trustPayload)
|
|
55
|
+
},
|
|
54
56
|
body: syncChangeSet
|
|
55
|
-
}, {
|
|
56
|
-
authenticationGeneratorType: "verifiable-credential",
|
|
57
|
-
authenticationData: {
|
|
58
|
-
contextId: ContextIdKeys.Organization,
|
|
59
|
-
subject: actionRequest
|
|
60
|
-
}
|
|
61
57
|
});
|
|
62
58
|
}
|
|
63
59
|
}
|
|
@@ -1 +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,
|
|
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,MAAM,EAAE,MAAM,gBAAgB,CAAC;AASxC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE1D;;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,CAAC,YAAqB;QAClD,MAAM,CAAC,WAAW,CACjB,6BAA6B,CAAC,UAAU,kBAExC,YAAY,CACZ,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,iBAAiB,EACjB,KAAK,EACL;YACC,OAAO,EAAE;gBACR,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,YAAY,CAAC;aACpE;SACD,CACD,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC;IACpC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,aAAa,CAAC,aAA6B,EAAE,YAAqB;QAC9E,MAAM,CAAC,MAAM,CACZ,6BAA6B,CAAC,UAAU,mBAExC,aAAa,CACb,CAAC;QAEF,MAAM,CAAC,WAAW,CACjB,6BAA6B,CAAC,UAAU,kBAExC,YAAY,CACZ,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CAA4C,iBAAiB,EAAE,MAAM,EAAE;YACtF,OAAO,EAAE;gBACR,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,YAAY,CAAC;aACpE;YACD,IAAI,EAAE,aAAa;SACnB,CAAC,CAAC;IACJ,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 { Guards } from \"@twin.org/core\";\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\";\nimport { HeaderHelper, HeaderTypes } from \"@twin.org/web\";\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 trustPayload Trust payload to verify the requesters identity.\n\t * @returns The decryption key.\n\t */\n\tpublic async getDecryptionKey(trustPayload: unknown): Promise<string> {\n\t\tGuards.stringValue(\n\t\t\tSynchronisedStorageRestClient.CLASS_NAME,\n\t\t\tnameof(trustPayload),\n\t\t\ttrustPayload\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\t{\n\t\t\t\theaders: {\n\t\t\t\t\t[HeaderTypes.Authorization]: HeaderHelper.createBearer(trustPayload)\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 trustPayload Trust payload to verify the requesters identity.\n\t * @returns Nothing.\n\t */\n\tpublic async syncChangeSet(syncChangeSet: ISyncChangeSet, trustPayload: unknown): 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\tGuards.stringValue(\n\t\t\tSynchronisedStorageRestClient.CLASS_NAME,\n\t\t\tnameof(trustPayload),\n\t\t\ttrustPayload\n\t\t);\n\n\t\tawait this.fetch<ISyncChangeSetRequest, INoContentResponse>(\"/sync-changeset\", \"POST\", {\n\t\t\theaders: {\n\t\t\t\t[HeaderTypes.Authorization]: HeaderHelper.createBearer(trustPayload)\n\t\t\t},\n\t\t\tbody: syncChangeSet\n\t\t});\n\t}\n}\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BaseRestClient } from "@twin.org/api-core";
|
|
2
2
|
import type { IBaseRestClientConfig } from "@twin.org/api-models";
|
|
3
|
-
import type { IIdentityAuthenticationActionRequest } from "@twin.org/identity-authentication";
|
|
4
3
|
import type { ISyncChangeSet, ISynchronisedStorageComponent } from "@twin.org/synchronised-storage-models";
|
|
5
4
|
/**
|
|
6
5
|
* Client for performing synchronised storage through to REST endpoints.
|
|
@@ -23,15 +22,15 @@ export declare class SynchronisedStorageRestClient extends BaseRestClient implem
|
|
|
23
22
|
/**
|
|
24
23
|
* Get the decryption key for the synchronised storage.
|
|
25
24
|
* This is used to decrypt the data stored in the synchronised storage.
|
|
26
|
-
* @param
|
|
25
|
+
* @param trustPayload Trust payload to verify the requesters identity.
|
|
27
26
|
* @returns The decryption key.
|
|
28
27
|
*/
|
|
29
|
-
getDecryptionKey(
|
|
28
|
+
getDecryptionKey(trustPayload: unknown): Promise<string>;
|
|
30
29
|
/**
|
|
31
30
|
* Synchronise a set of changes from an untrusted node, assumes this is a trusted node.
|
|
32
31
|
* @param syncChangeSet The change set to synchronise.
|
|
33
|
-
* @param
|
|
32
|
+
* @param trustPayload Trust payload to verify the requesters identity.
|
|
34
33
|
* @returns Nothing.
|
|
35
34
|
*/
|
|
36
|
-
syncChangeSet(syncChangeSet: ISyncChangeSet,
|
|
35
|
+
syncChangeSet(syncChangeSet: ISyncChangeSet, trustPayload: unknown): Promise<void>;
|
|
37
36
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,131 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.10](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.3-next.9...synchronised-storage-rest-client-v0.0.3-next.10) (2026-03-20)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* remove redundant code ([19edb23](https://github.com/twinfoundation/synchronised-storage/commit/19edb236f318b9c9454a64259d0ab5098a0c8173))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/synchronised-storage-models bumped from 0.0.3-next.9 to 0.0.3-next.10
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.9](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.3-next.8...synchronised-storage-rest-client-v0.0.3-next.9) (2026-03-04)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Miscellaneous Chores
|
|
21
|
+
|
|
22
|
+
* **synchronised-storage-rest-client:** Synchronize repo versions
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/synchronised-storage-models bumped from 0.0.3-next.8 to 0.0.3-next.9
|
|
30
|
+
|
|
31
|
+
## [0.0.3-next.8](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.3-next.7...synchronised-storage-rest-client-v0.0.3-next.8) (2026-02-25)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Miscellaneous Chores
|
|
35
|
+
|
|
36
|
+
* **synchronised-storage-rest-client:** Synchronize repo versions
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Dependencies
|
|
40
|
+
|
|
41
|
+
* The following workspace dependencies were updated
|
|
42
|
+
* dependencies
|
|
43
|
+
* @twin.org/synchronised-storage-models bumped from 0.0.3-next.7 to 0.0.3-next.8
|
|
44
|
+
|
|
45
|
+
## [0.0.3-next.7](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.3-next.6...synchronised-storage-rest-client-v0.0.3-next.7) (2026-01-28)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Miscellaneous Chores
|
|
49
|
+
|
|
50
|
+
* **synchronised-storage-rest-client:** Synchronize repo versions
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Dependencies
|
|
54
|
+
|
|
55
|
+
* The following workspace dependencies were updated
|
|
56
|
+
* dependencies
|
|
57
|
+
* @twin.org/synchronised-storage-models bumped from 0.0.3-next.6 to 0.0.3-next.7
|
|
58
|
+
|
|
59
|
+
## [0.0.3-next.6](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.3-next.5...synchronised-storage-rest-client-v0.0.3-next.6) (2026-01-22)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Miscellaneous Chores
|
|
63
|
+
|
|
64
|
+
* **synchronised-storage-rest-client:** Synchronize repo versions
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### Dependencies
|
|
68
|
+
|
|
69
|
+
* The following workspace dependencies were updated
|
|
70
|
+
* dependencies
|
|
71
|
+
* @twin.org/synchronised-storage-models bumped from 0.0.3-next.5 to 0.0.3-next.6
|
|
72
|
+
|
|
73
|
+
## [0.0.3-next.5](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.3-next.4...synchronised-storage-rest-client-v0.0.3-next.5) (2026-01-19)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Features
|
|
77
|
+
|
|
78
|
+
* remove unused dependencies ([518c460](https://github.com/twinfoundation/synchronised-storage/commit/518c460d2e5e2b2c487565acb5162a03ddb85eae))
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Dependencies
|
|
82
|
+
|
|
83
|
+
* The following workspace dependencies were updated
|
|
84
|
+
* dependencies
|
|
85
|
+
* @twin.org/synchronised-storage-models bumped from 0.0.3-next.4 to 0.0.3-next.5
|
|
86
|
+
|
|
87
|
+
## [0.0.3-next.4](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.3-next.3...synchronised-storage-rest-client-v0.0.3-next.4) (2026-01-15)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### Miscellaneous Chores
|
|
91
|
+
|
|
92
|
+
* **synchronised-storage-rest-client:** Synchronize repo versions
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
### Dependencies
|
|
96
|
+
|
|
97
|
+
* The following workspace dependencies were updated
|
|
98
|
+
* dependencies
|
|
99
|
+
* @twin.org/synchronised-storage-models bumped from 0.0.3-next.3 to 0.0.3-next.4
|
|
100
|
+
|
|
101
|
+
## [0.0.3-next.3](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.3-next.2...synchronised-storage-rest-client-v0.0.3-next.3) (2026-01-12)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### Features
|
|
105
|
+
|
|
106
|
+
* add trustPayload guards ([cf1622f](https://github.com/twinfoundation/synchronised-storage/commit/cf1622f8b65a4b77032e31ecaa41664499f4c892))
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
### Dependencies
|
|
110
|
+
|
|
111
|
+
* The following workspace dependencies were updated
|
|
112
|
+
* dependencies
|
|
113
|
+
* @twin.org/synchronised-storage-models bumped from 0.0.3-next.2 to 0.0.3-next.3
|
|
114
|
+
|
|
115
|
+
## [0.0.3-next.2](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-rest-client-v0.0.3-next.1...synchronised-storage-rest-client-v0.0.3-next.2) (2025-12-04)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### Features
|
|
119
|
+
|
|
120
|
+
* use trust component ([424f0d6](https://github.com/twinfoundation/synchronised-storage/commit/424f0d6aaacfdc7700c46fe6c2def23b2eacddc9))
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
### Dependencies
|
|
124
|
+
|
|
125
|
+
* The following workspace dependencies were updated
|
|
126
|
+
* dependencies
|
|
127
|
+
* @twin.org/synchronised-storage-models bumped from 0.0.3-next.1 to 0.0.3-next.2
|
|
128
|
+
|
|
3
129
|
## [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
130
|
|
|
5
131
|
|
|
@@ -245,4 +371,4 @@
|
|
|
245
371
|
* dependencies
|
|
246
372
|
* @twin.org/synchronised-storage-models bumped from 0.0.1-next.0 to 0.0.1-next.1
|
|
247
373
|
|
|
248
|
-
##
|
|
374
|
+
## Changelog
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,56 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Synchronised Storage REST Client Examples
|
|
2
|
+
|
|
3
|
+
These snippets show how to call trusted synchronisation endpoints from a node or backend process using strongly typed request data.
|
|
4
|
+
|
|
5
|
+
## SynchronisedStorageRestClient
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { SynchronisedStorageRestClient } from '@twin.org/synchronised-storage-rest-client';
|
|
9
|
+
|
|
10
|
+
const client = new SynchronisedStorageRestClient({
|
|
11
|
+
endpoint: 'https://api.example.net'
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const className = client.className();
|
|
15
|
+
|
|
16
|
+
console.log(className); // SynchronisedStorageRestClient
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import {
|
|
21
|
+
SynchronisedStorageContexts,
|
|
22
|
+
SynchronisedStorageTypes,
|
|
23
|
+
type ISyncChangeSet
|
|
24
|
+
} from '@twin.org/synchronised-storage-models';
|
|
25
|
+
import { SynchronisedStorageRestClient } from '@twin.org/synchronised-storage-rest-client';
|
|
26
|
+
|
|
27
|
+
const client = new SynchronisedStorageRestClient({
|
|
28
|
+
endpoint: 'https://api.example.net'
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const trustPayload = 'eyJhbGciOiJFZERTQSJ9.sample-payload.signature';
|
|
32
|
+
const decryptionKey = await client.getDecryptionKey(trustPayload);
|
|
33
|
+
|
|
34
|
+
console.log(decryptionKey.length); // 44
|
|
35
|
+
|
|
36
|
+
const changeSet: ISyncChangeSet = {
|
|
37
|
+
'@context': SynchronisedStorageContexts.Context,
|
|
38
|
+
type: SynchronisedStorageTypes.ChangeSet,
|
|
39
|
+
id: 'changeset-20260310-01',
|
|
40
|
+
storageKey: 'profile',
|
|
41
|
+
dateCreated: '2026-03-10T10:00:00.000Z',
|
|
42
|
+
dateModified: '2026-03-10T10:00:00.000Z',
|
|
43
|
+
nodeIdentity: 'did:iota:node-2',
|
|
44
|
+
changes: [
|
|
45
|
+
{
|
|
46
|
+
operation: 'set',
|
|
47
|
+
id: 'profile-4',
|
|
48
|
+
entity: {
|
|
49
|
+
dateModified: '2026-03-10T10:00:00.000Z'
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
await client.syncChangeSet(changeSet, trustPayload);
|
|
56
|
+
```
|
|
@@ -36,7 +36,7 @@ The configuration for the client.
|
|
|
36
36
|
|
|
37
37
|
## Properties
|
|
38
38
|
|
|
39
|
-
### CLASS\_NAME
|
|
39
|
+
### CLASS\_NAME {#class_name}
|
|
40
40
|
|
|
41
41
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
42
42
|
|
|
@@ -44,7 +44,7 @@ Runtime name for the class.
|
|
|
44
44
|
|
|
45
45
|
## Methods
|
|
46
46
|
|
|
47
|
-
### className()
|
|
47
|
+
### className() {#classname}
|
|
48
48
|
|
|
49
49
|
> **className**(): `string`
|
|
50
50
|
|
|
@@ -62,20 +62,20 @@ The class name of the component.
|
|
|
62
62
|
|
|
63
63
|
***
|
|
64
64
|
|
|
65
|
-
### getDecryptionKey()
|
|
65
|
+
### getDecryptionKey() {#getdecryptionkey}
|
|
66
66
|
|
|
67
|
-
> **getDecryptionKey**(`
|
|
67
|
+
> **getDecryptionKey**(`trustPayload`): `Promise`\<`string`\>
|
|
68
68
|
|
|
69
69
|
Get the decryption key for the synchronised storage.
|
|
70
70
|
This is used to decrypt the data stored in the synchronised storage.
|
|
71
71
|
|
|
72
72
|
#### Parameters
|
|
73
73
|
|
|
74
|
-
#####
|
|
74
|
+
##### trustPayload
|
|
75
75
|
|
|
76
|
-
`
|
|
76
|
+
`unknown`
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
Trust payload to verify the requesters identity.
|
|
79
79
|
|
|
80
80
|
#### Returns
|
|
81
81
|
|
|
@@ -89,9 +89,9 @@ The decryption key.
|
|
|
89
89
|
|
|
90
90
|
***
|
|
91
91
|
|
|
92
|
-
### syncChangeSet()
|
|
92
|
+
### syncChangeSet() {#syncchangeset}
|
|
93
93
|
|
|
94
|
-
> **syncChangeSet**(`syncChangeSet`, `
|
|
94
|
+
> **syncChangeSet**(`syncChangeSet`, `trustPayload`): `Promise`\<`void`\>
|
|
95
95
|
|
|
96
96
|
Synchronise a set of changes from an untrusted node, assumes this is a trusted node.
|
|
97
97
|
|
|
@@ -103,11 +103,11 @@ Synchronise a set of changes from an untrusted node, assumes this is a trusted n
|
|
|
103
103
|
|
|
104
104
|
The change set to synchronise.
|
|
105
105
|
|
|
106
|
-
#####
|
|
106
|
+
##### trustPayload
|
|
107
107
|
|
|
108
|
-
`
|
|
108
|
+
`unknown`
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
Trust payload to verify the requesters identity.
|
|
111
111
|
|
|
112
112
|
#### Returns
|
|
113
113
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/synchronised-storage-rest-client",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.10",
|
|
4
|
+
"description": "REST client for trusted decryption key retrieval and change set synchronisation.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/twinfoundation/synchronised-storage.git",
|
|
@@ -19,10 +19,8 @@
|
|
|
19
19
|
"@twin.org/context": "next",
|
|
20
20
|
"@twin.org/core": "next",
|
|
21
21
|
"@twin.org/entity": "next",
|
|
22
|
-
"@twin.org/identity-authentication": "next",
|
|
23
22
|
"@twin.org/nameof": "next",
|
|
24
|
-
"@twin.org/
|
|
25
|
-
"@twin.org/synchronised-storage-models": "0.0.3-next.1",
|
|
23
|
+
"@twin.org/synchronised-storage-models": "0.0.3-next.10",
|
|
26
24
|
"@twin.org/web": "next"
|
|
27
25
|
},
|
|
28
26
|
"main": "./dist/es/index.js",
|