@twin.org/synchronised-storage-models 0.0.1-next.3 → 0.0.1-next.5

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.
Files changed (35) hide show
  1. package/dist/cjs/index.cjs +26 -0
  2. package/dist/esm/index.mjs +26 -1
  3. package/dist/types/index.d.ts +6 -0
  4. package/dist/types/models/ISyncChange.d.ts +19 -0
  5. package/dist/types/models/ISyncChangeSet.d.ts +36 -0
  6. package/dist/types/models/ISynchronisedEntity.d.ts +4 -0
  7. package/dist/types/models/ISynchronisedStorageComponent.d.ts +13 -3
  8. package/dist/types/models/api/ISyncChangeSetRequest.d.ts +3 -7
  9. package/dist/types/models/api/ISyncDecryptionKeyRequest.d.ts +19 -0
  10. package/dist/types/models/api/ISyncDecryptionKeyResponse.d.ts +14 -0
  11. package/dist/types/models/eventBus/ISyncBatchRequest.d.ts +5 -0
  12. package/dist/types/models/eventBus/ISyncBatchResponse.d.ts +0 -4
  13. package/dist/types/models/eventBus/ISyncItemChange.d.ts +4 -0
  14. package/dist/types/models/eventBus/ISyncItemRemove.d.ts +4 -0
  15. package/dist/types/models/eventBus/ISyncReset.d.ts +14 -0
  16. package/dist/types/models/syncNodeIdentityMode.d.ts +21 -0
  17. package/dist/types/models/synchronisedStorageTopics.d.ts +4 -0
  18. package/docs/changelog.md +19 -0
  19. package/docs/reference/index.md +7 -0
  20. package/docs/reference/interfaces/ISyncBatchRequest.md +8 -0
  21. package/docs/reference/interfaces/ISyncBatchResponse.md +0 -8
  22. package/docs/reference/interfaces/ISyncChange.md +33 -0
  23. package/docs/reference/interfaces/ISyncChangeSet.md +65 -0
  24. package/docs/reference/interfaces/ISyncChangeSetRequest.md +3 -9
  25. package/docs/reference/interfaces/ISyncDecryptionKeyRequest.md +23 -0
  26. package/docs/reference/interfaces/ISyncDecryptionKeyResponse.md +17 -0
  27. package/docs/reference/interfaces/ISyncItemChange.md +8 -0
  28. package/docs/reference/interfaces/ISyncItemRemove.md +8 -0
  29. package/docs/reference/interfaces/ISyncReset.md +19 -0
  30. package/docs/reference/interfaces/ISynchronisedEntity.md +8 -0
  31. package/docs/reference/interfaces/ISynchronisedStorageComponent.md +34 -5
  32. package/docs/reference/type-aliases/SyncNodeIdentityMode.md +5 -0
  33. package/docs/reference/variables/SyncNodeIdentityMode.md +25 -0
  34. package/docs/reference/variables/SynchronisedStorageTopics.md +6 -0
  35. package/package.json +3 -2
@@ -40,6 +40,10 @@ const SynchronisedStorageTopics = {
40
40
  * A response to a local item request.
41
41
  */
42
42
  LocalItemResponse: "synchronised-storage:local-item-response",
43
+ /**
44
+ * Reset the storage.
45
+ */
46
+ Reset: "synchronised-storage:reset",
43
47
  /**
44
48
  * A request has been made for a batch.
45
49
  */
@@ -58,5 +62,27 @@ const SynchronisedStorageTopics = {
58
62
  RemoteItemRemove: "synchronised-storage:remote-item-remove"
59
63
  };
60
64
 
65
+ // Copyright 2024 IOTA Stiftung.
66
+ // SPDX-License-Identifier: Apache-2.0.
67
+ /**
68
+ * The mode to determine how node identities are matched.
69
+ */
70
+ // eslint-disable-next-line @typescript-eslint/naming-convention
71
+ const SyncNodeIdentityMode = {
72
+ /**
73
+ * Match the local node identity.
74
+ */
75
+ Local: "local",
76
+ /**
77
+ * Match all but the local node identity.
78
+ */
79
+ Remote: "remote",
80
+ /**
81
+ * All match both local and remote entities.
82
+ */
83
+ All: "all"
84
+ };
85
+
61
86
  exports.SyncChangeOperation = SyncChangeOperation;
87
+ exports.SyncNodeIdentityMode = SyncNodeIdentityMode;
62
88
  exports.SynchronisedStorageTopics = SynchronisedStorageTopics;
@@ -38,6 +38,10 @@ const SynchronisedStorageTopics = {
38
38
  * A response to a local item request.
39
39
  */
40
40
  LocalItemResponse: "synchronised-storage:local-item-response",
41
+ /**
42
+ * Reset the storage.
43
+ */
44
+ Reset: "synchronised-storage:reset",
41
45
  /**
42
46
  * A request has been made for a batch.
43
47
  */
@@ -56,4 +60,25 @@ const SynchronisedStorageTopics = {
56
60
  RemoteItemRemove: "synchronised-storage:remote-item-remove"
57
61
  };
58
62
 
59
- export { SyncChangeOperation, SynchronisedStorageTopics };
63
+ // Copyright 2024 IOTA Stiftung.
64
+ // SPDX-License-Identifier: Apache-2.0.
65
+ /**
66
+ * The mode to determine how node identities are matched.
67
+ */
68
+ // eslint-disable-next-line @typescript-eslint/naming-convention
69
+ const SyncNodeIdentityMode = {
70
+ /**
71
+ * Match the local node identity.
72
+ */
73
+ Local: "local",
74
+ /**
75
+ * Match all but the local node identity.
76
+ */
77
+ Remote: "remote",
78
+ /**
79
+ * All match both local and remote entities.
80
+ */
81
+ All: "all"
82
+ };
83
+
84
+ export { SyncChangeOperation, SyncNodeIdentityMode, SynchronisedStorageTopics };
@@ -1,4 +1,6 @@
1
1
  export * from "./models/api/ISyncChangeSetRequest";
2
+ export * from "./models/api/ISyncDecryptionKeyRequest";
3
+ export * from "./models/api/ISyncDecryptionKeyResponse";
2
4
  export * from "./models/eventBus/ISyncBatchRequest";
3
5
  export * from "./models/eventBus/ISyncBatchResponse";
4
6
  export * from "./models/eventBus/ISyncItemChange";
@@ -7,7 +9,11 @@ export * from "./models/eventBus/ISyncItemRequest";
7
9
  export * from "./models/eventBus/ISyncItemResponse";
8
10
  export * from "./models/eventBus/ISyncItemSet";
9
11
  export * from "./models/eventBus/ISyncRegisterStorageKey";
12
+ export * from "./models/eventBus/ISyncReset";
10
13
  export * from "./models/eventBus/syncChangeOperation";
14
+ export * from "./models/ISyncChange";
15
+ export * from "./models/ISyncChangeSet";
11
16
  export * from "./models/ISynchronisedEntity";
12
17
  export * from "./models/ISynchronisedStorageComponent";
13
18
  export * from "./models/synchronisedStorageTopics";
19
+ export * from "./models/syncNodeIdentityMode";
@@ -0,0 +1,19 @@
1
+ import type { SyncChangeOperation } from "./eventBus/syncChangeOperation";
2
+ import type { ISynchronisedEntity } from "./ISynchronisedEntity";
3
+ /**
4
+ * The object definition for a sync change.
5
+ */
6
+ export interface ISyncChange<T extends ISynchronisedEntity = ISynchronisedEntity> {
7
+ /**
8
+ * Operation.
9
+ */
10
+ operation: SyncChangeOperation;
11
+ /**
12
+ * The item id.
13
+ */
14
+ id: string;
15
+ /**
16
+ * The entity to set.
17
+ */
18
+ entity?: Omit<T, "id" | "nodeIdentity">;
19
+ }
@@ -0,0 +1,36 @@
1
+ import type { IProof } from "@twin.org/standards-w3c-did";
2
+ import type { ISyncChange } from "./ISyncChange";
3
+ import type { ISynchronisedEntity } from "./ISynchronisedEntity";
4
+ /**
5
+ * The object definition for a sync change set.
6
+ */
7
+ export interface ISyncChangeSet<T extends ISynchronisedEntity = ISynchronisedEntity> {
8
+ /**
9
+ * The id of the change set.
10
+ */
11
+ id: string;
12
+ /**
13
+ * The date the change set was created.
14
+ */
15
+ dateCreated: string;
16
+ /**
17
+ * The storage key of the change set. This is used to identify the entities being synchronised.
18
+ */
19
+ storageKey: string;
20
+ /**
21
+ * The date the change set was last modified.
22
+ */
23
+ dateModified: string;
24
+ /**
25
+ * The changes to apply after a snapshot.
26
+ */
27
+ changes: ISyncChange<T>[];
28
+ /**
29
+ * The identity of the node that created the change set.
30
+ */
31
+ nodeIdentity: string;
32
+ /**
33
+ * The proof for the change set.
34
+ */
35
+ proof?: IProof;
36
+ }
@@ -2,6 +2,10 @@
2
2
  * The base definition for synchronised entries.
3
3
  */
4
4
  export interface ISynchronisedEntity {
5
+ /**
6
+ * The id of the entry.
7
+ */
8
+ id: string;
5
9
  /**
6
10
  * The date the entry was modified
7
11
  */
@@ -1,12 +1,22 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
+ import type { IProof } from "@twin.org/standards-w3c-did";
3
+ import type { ISyncChangeSet } from "./ISyncChangeSet";
2
4
  /**
3
5
  * Class for performing synchronised storage operations.
4
6
  */
5
7
  export interface ISynchronisedStorageComponent extends IComponent {
6
8
  /**
7
- * Synchronise a complete set of changes, assumes this is a trusted node.
8
- * @param changeSetStorageId The id of the change set to synchronise in blob storage.
9
+ * Get the decryption key for the synchronised storage.
10
+ * This is used to decrypt the data stored in the synchronised storage.
11
+ * @param nodeIdentity The identity of the node requesting the decryption key.
12
+ * @param proof The proof of the request so we know the request is from the specified node.
13
+ * @returns The decryption key.
14
+ */
15
+ getDecryptionKey(nodeIdentity: string, proof: IProof): Promise<string>;
16
+ /**
17
+ * Synchronise a set of changes from an untrusted node, assumes this is a trusted node.
18
+ * @param syncChangeSet The change set to synchronise.
9
19
  * @returns Nothing.
10
20
  */
11
- syncChangeSet(changeSetStorageId: string): Promise<void>;
21
+ syncChangeSet(syncChangeSet: ISyncChangeSet): Promise<void>;
12
22
  }
@@ -1,14 +1,10 @@
1
+ import type { ISyncChangeSet } from "../ISyncChangeSet";
1
2
  /**
2
3
  * Request a trusted node to perform a sync request for a changeset.
3
4
  */
4
5
  export interface ISyncChangeSetRequest {
5
6
  /**
6
- * The query parameters.
7
+ * The body of the request.
7
8
  */
8
- query: {
9
- /**
10
- * The storage id of the changeset.
11
- */
12
- changeSetStorageId: string;
13
- };
9
+ body: ISyncChangeSet;
14
10
  }
@@ -0,0 +1,19 @@
1
+ import type { IProof } from "@twin.org/standards-w3c-did";
2
+ /**
3
+ * Request for the decryption key for the synchronised storage.
4
+ */
5
+ export interface ISyncDecryptionKeyRequest {
6
+ /**
7
+ * The body of the request.
8
+ */
9
+ body: {
10
+ /**
11
+ * The identity of the node making the request.
12
+ */
13
+ nodeIdentity: string;
14
+ /**
15
+ * The proof of the request.
16
+ */
17
+ proof: IProof;
18
+ };
19
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Response to a request for the decryption key for the synchronised storage.
3
+ */
4
+ export interface ISyncDecryptionKeyResponse {
5
+ /**
6
+ * The body of the response.
7
+ */
8
+ body: {
9
+ /**
10
+ * The decryption key for the synchronised storage as base64.
11
+ */
12
+ decryptionKey: string;
13
+ };
14
+ }
@@ -1,3 +1,4 @@
1
+ import type { SyncNodeIdentityMode } from "../syncNodeIdentityMode";
1
2
  /**
2
3
  * Request for a local batch.
3
4
  */
@@ -10,4 +11,8 @@ export interface ISyncBatchRequest {
10
11
  * The size of the batch.
11
12
  */
12
13
  batchSize: number;
14
+ /**
15
+ * Determines which entries are required, for local it will match the nodeIdentity, for remote it will not include matching nodeIdentity, for all it will include all entries.
16
+ */
17
+ requestMode: SyncNodeIdentityMode;
13
18
  }
@@ -7,10 +7,6 @@ export interface ISyncBatchResponse<T extends ISynchronisedEntity> {
7
7
  * The key of the storage for the entities in the batch.
8
8
  */
9
9
  storageKey: string;
10
- /**
11
- * The primary key of the entity in the sync item response.
12
- */
13
- primaryKey: keyof T;
14
10
  /**
15
11
  * The entities in the batch.
16
12
  */
@@ -11,6 +11,10 @@ export interface ISyncItemChange {
11
11
  * The operation being performed on the item.
12
12
  */
13
13
  operation: SyncChangeOperation;
14
+ /**
15
+ * The node performing the operation.
16
+ */
17
+ nodeIdentity: string;
14
18
  /**
15
19
  * The id of the item being changed.
16
20
  */
@@ -6,6 +6,10 @@ export interface ISyncItemRemove {
6
6
  * The key of the storage being removed.
7
7
  */
8
8
  storageKey: string;
9
+ /**
10
+ * The node identity of the entity being removed.
11
+ */
12
+ nodeIdentity: string;
9
13
  /**
10
14
  * The entity being removed from the item set.
11
15
  */
@@ -0,0 +1,14 @@
1
+ import type { SyncNodeIdentityMode } from "../syncNodeIdentityMode";
2
+ /**
3
+ * Request to reset the local storage.
4
+ */
5
+ export interface ISyncReset {
6
+ /**
7
+ * The key of the storage for the entities in the batch.
8
+ */
9
+ storageKey: string;
10
+ /**
11
+ * Reset mode, this will use the nodeIdentity in the entities to determine which are local/remote.
12
+ */
13
+ resetMode: SyncNodeIdentityMode;
14
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The mode to determine how node identities are matched.
3
+ */
4
+ export declare const SyncNodeIdentityMode: {
5
+ /**
6
+ * Match the local node identity.
7
+ */
8
+ readonly Local: "local";
9
+ /**
10
+ * Match all but the local node identity.
11
+ */
12
+ readonly Remote: "remote";
13
+ /**
14
+ * All match both local and remote entities.
15
+ */
16
+ readonly All: "all";
17
+ };
18
+ /**
19
+ * The mode to determine how node identities are matched.
20
+ */
21
+ export type SyncNodeIdentityMode = (typeof SyncNodeIdentityMode)[keyof typeof SyncNodeIdentityMode];
@@ -18,6 +18,10 @@ export declare const SynchronisedStorageTopics: {
18
18
  * A response to a local item request.
19
19
  */
20
20
  readonly LocalItemResponse: "synchronised-storage:local-item-response";
21
+ /**
22
+ * Reset the storage.
23
+ */
24
+ readonly Reset: "synchronised-storage:reset";
21
25
  /**
22
26
  * A request has been made for a batch.
23
27
  */
package/docs/changelog.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.1-next.5](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-models-v0.0.1-next.4...synchronised-storage-models-v0.0.1-next.5) (2025-08-11)
4
+
5
+
6
+ ### Features
7
+
8
+ * additional node identity checks ([76257c4](https://github.com/twinfoundation/synchronised-storage/commit/76257c4173303d484391f71f581fd0e214204029))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * missing dependency ([cf4427e](https://github.com/twinfoundation/synchronised-storage/commit/cf4427edf6668b90aae9a9c1faafff13dffc2fc7))
14
+
15
+ ## [0.0.1-next.4](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-models-v0.0.1-next.3...synchronised-storage-models-v0.0.1-next.4) (2025-08-08)
16
+
17
+
18
+ ### Features
19
+
20
+ * blob storage connector instead of component ([#7](https://github.com/twinfoundation/synchronised-storage/issues/7)) ([ea27241](https://github.com/twinfoundation/synchronised-storage/commit/ea27241cf0810b52ab7a6be7346809d127b7109a))
21
+
3
22
  ## [0.0.1-next.3](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-models-v0.0.1-next.2...synchronised-storage-models-v0.0.1-next.3) (2025-07-25)
4
23
 
5
24
 
@@ -2,9 +2,13 @@
2
2
 
3
3
  ## Interfaces
4
4
 
5
+ - [ISyncChange](interfaces/ISyncChange.md)
6
+ - [ISyncChangeSet](interfaces/ISyncChangeSet.md)
5
7
  - [ISynchronisedEntity](interfaces/ISynchronisedEntity.md)
6
8
  - [ISynchronisedStorageComponent](interfaces/ISynchronisedStorageComponent.md)
7
9
  - [ISyncChangeSetRequest](interfaces/ISyncChangeSetRequest.md)
10
+ - [ISyncDecryptionKeyRequest](interfaces/ISyncDecryptionKeyRequest.md)
11
+ - [ISyncDecryptionKeyResponse](interfaces/ISyncDecryptionKeyResponse.md)
8
12
  - [ISyncBatchRequest](interfaces/ISyncBatchRequest.md)
9
13
  - [ISyncBatchResponse](interfaces/ISyncBatchResponse.md)
10
14
  - [ISyncItemChange](interfaces/ISyncItemChange.md)
@@ -13,13 +17,16 @@
13
17
  - [ISyncItemResponse](interfaces/ISyncItemResponse.md)
14
18
  - [ISyncItemSet](interfaces/ISyncItemSet.md)
15
19
  - [ISyncRegisterStorageKey](interfaces/ISyncRegisterStorageKey.md)
20
+ - [ISyncReset](interfaces/ISyncReset.md)
16
21
 
17
22
  ## Type Aliases
18
23
 
19
24
  - [SyncChangeOperation](type-aliases/SyncChangeOperation.md)
25
+ - [SyncNodeIdentityMode](type-aliases/SyncNodeIdentityMode.md)
20
26
  - [SynchronisedStorageTopics](type-aliases/SynchronisedStorageTopics.md)
21
27
 
22
28
  ## Variables
23
29
 
24
30
  - [SyncChangeOperation](variables/SyncChangeOperation.md)
31
+ - [SyncNodeIdentityMode](variables/SyncNodeIdentityMode.md)
25
32
  - [SynchronisedStorageTopics](variables/SynchronisedStorageTopics.md)
@@ -17,3 +17,11 @@ The key of the storage for the entities in the batch.
17
17
  > **batchSize**: `number`
18
18
 
19
19
  The size of the batch.
20
+
21
+ ***
22
+
23
+ ### requestMode
24
+
25
+ > **requestMode**: [`SyncNodeIdentityMode`](../type-aliases/SyncNodeIdentityMode.md)
26
+
27
+ Determines which entries are required, for local it will match the nodeIdentity, for remote it will not include matching nodeIdentity, for all it will include all entries.
@@ -18,14 +18,6 @@ The key of the storage for the entities in the batch.
18
18
 
19
19
  ***
20
20
 
21
- ### primaryKey
22
-
23
- > **primaryKey**: keyof `T`
24
-
25
- The primary key of the entity in the sync item response.
26
-
27
- ***
28
-
29
21
  ### entities
30
22
 
31
23
  > **entities**: `T`[]
@@ -0,0 +1,33 @@
1
+ # Interface: ISyncChange\<T\>
2
+
3
+ The object definition for a sync change.
4
+
5
+ ## Type Parameters
6
+
7
+ ### T
8
+
9
+ `T` *extends* [`ISynchronisedEntity`](ISynchronisedEntity.md) = [`ISynchronisedEntity`](ISynchronisedEntity.md)
10
+
11
+ ## Properties
12
+
13
+ ### operation
14
+
15
+ > **operation**: [`SyncChangeOperation`](../type-aliases/SyncChangeOperation.md)
16
+
17
+ Operation.
18
+
19
+ ***
20
+
21
+ ### id
22
+
23
+ > **id**: `string`
24
+
25
+ The item id.
26
+
27
+ ***
28
+
29
+ ### entity?
30
+
31
+ > `optional` **entity**: `Omit`\<`T`, `"id"` \| `"nodeIdentity"`\>
32
+
33
+ The entity to set.
@@ -0,0 +1,65 @@
1
+ # Interface: ISyncChangeSet\<T\>
2
+
3
+ The object definition for a sync change set.
4
+
5
+ ## Type Parameters
6
+
7
+ ### T
8
+
9
+ `T` *extends* [`ISynchronisedEntity`](ISynchronisedEntity.md) = [`ISynchronisedEntity`](ISynchronisedEntity.md)
10
+
11
+ ## Properties
12
+
13
+ ### id
14
+
15
+ > **id**: `string`
16
+
17
+ The id of the change set.
18
+
19
+ ***
20
+
21
+ ### dateCreated
22
+
23
+ > **dateCreated**: `string`
24
+
25
+ The date the change set was created.
26
+
27
+ ***
28
+
29
+ ### storageKey
30
+
31
+ > **storageKey**: `string`
32
+
33
+ The storage key of the change set. This is used to identify the entities being synchronised.
34
+
35
+ ***
36
+
37
+ ### dateModified
38
+
39
+ > **dateModified**: `string`
40
+
41
+ The date the change set was last modified.
42
+
43
+ ***
44
+
45
+ ### changes
46
+
47
+ > **changes**: [`ISyncChange`](ISyncChange.md)\<`T`\>[]
48
+
49
+ The changes to apply after a snapshot.
50
+
51
+ ***
52
+
53
+ ### nodeIdentity
54
+
55
+ > **nodeIdentity**: `string`
56
+
57
+ The identity of the node that created the change set.
58
+
59
+ ***
60
+
61
+ ### proof?
62
+
63
+ > `optional` **proof**: `IProof`
64
+
65
+ The proof for the change set.
@@ -4,14 +4,8 @@ Request a trusted node to perform a sync request for a changeset.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### query
7
+ ### body
8
8
 
9
- > **query**: `object`
9
+ > **body**: [`ISyncChangeSet`](ISyncChangeSet.md)
10
10
 
11
- The query parameters.
12
-
13
- #### changeSetStorageId
14
-
15
- > **changeSetStorageId**: `string`
16
-
17
- The storage id of the changeset.
11
+ The body of the request.
@@ -0,0 +1,23 @@
1
+ # Interface: ISyncDecryptionKeyRequest
2
+
3
+ Request for the decryption key for the synchronised storage.
4
+
5
+ ## Properties
6
+
7
+ ### body
8
+
9
+ > **body**: `object`
10
+
11
+ The body of the request.
12
+
13
+ #### nodeIdentity
14
+
15
+ > **nodeIdentity**: `string`
16
+
17
+ The identity of the node making the request.
18
+
19
+ #### proof
20
+
21
+ > **proof**: `IProof`
22
+
23
+ The proof of the request.
@@ -0,0 +1,17 @@
1
+ # Interface: ISyncDecryptionKeyResponse
2
+
3
+ Response to a request for the decryption key for the synchronised storage.
4
+
5
+ ## Properties
6
+
7
+ ### body
8
+
9
+ > **body**: `object`
10
+
11
+ The body of the response.
12
+
13
+ #### decryptionKey
14
+
15
+ > **decryptionKey**: `string`
16
+
17
+ The decryption key for the synchronised storage as base64.
@@ -20,6 +20,14 @@ The operation being performed on the item.
20
20
 
21
21
  ***
22
22
 
23
+ ### nodeIdentity
24
+
25
+ > **nodeIdentity**: `string`
26
+
27
+ The node performing the operation.
28
+
29
+ ***
30
+
23
31
  ### id
24
32
 
25
33
  > **id**: `string`
@@ -12,6 +12,14 @@ The key of the storage being removed.
12
12
 
13
13
  ***
14
14
 
15
+ ### nodeIdentity
16
+
17
+ > **nodeIdentity**: `string`
18
+
19
+ The node identity of the entity being removed.
20
+
21
+ ***
22
+
15
23
  ### id
16
24
 
17
25
  > **id**: `string`
@@ -0,0 +1,19 @@
1
+ # Interface: ISyncReset
2
+
3
+ Request to reset the local storage.
4
+
5
+ ## Properties
6
+
7
+ ### storageKey
8
+
9
+ > **storageKey**: `string`
10
+
11
+ The key of the storage for the entities in the batch.
12
+
13
+ ***
14
+
15
+ ### resetMode
16
+
17
+ > **resetMode**: [`SyncNodeIdentityMode`](../type-aliases/SyncNodeIdentityMode.md)
18
+
19
+ Reset mode, this will use the nodeIdentity in the entities to determine which are local/remote.
@@ -4,6 +4,14 @@ The base definition for synchronised entries.
4
4
 
5
5
  ## Properties
6
6
 
7
+ ### id
8
+
9
+ > **id**: `string`
10
+
11
+ The id of the entry.
12
+
13
+ ***
14
+
7
15
  ### dateModified
8
16
 
9
17
  > **dateModified**: `string`
@@ -8,19 +8,48 @@ Class for performing synchronised storage operations.
8
8
 
9
9
  ## Methods
10
10
 
11
- ### syncChangeSet()
11
+ ### getDecryptionKey()
12
12
 
13
- > **syncChangeSet**(`changeSetStorageId`): `Promise`\<`void`\>
13
+ > **getDecryptionKey**(`nodeIdentity`, `proof`): `Promise`\<`string`\>
14
14
 
15
- Synchronise a complete set of changes, assumes this is a trusted node.
15
+ Get the decryption key for the synchronised storage.
16
+ This is used to decrypt the data stored in the synchronised storage.
16
17
 
17
18
  #### Parameters
18
19
 
19
- ##### changeSetStorageId
20
+ ##### nodeIdentity
20
21
 
21
22
  `string`
22
23
 
23
- The id of the change set to synchronise in blob storage.
24
+ The identity of the node requesting the decryption key.
25
+
26
+ ##### proof
27
+
28
+ `IProof`
29
+
30
+ The proof of the request so we know the request is from the specified node.
31
+
32
+ #### Returns
33
+
34
+ `Promise`\<`string`\>
35
+
36
+ The decryption key.
37
+
38
+ ***
39
+
40
+ ### syncChangeSet()
41
+
42
+ > **syncChangeSet**(`syncChangeSet`): `Promise`\<`void`\>
43
+
44
+ Synchronise a set of changes from an untrusted node, assumes this is a trusted node.
45
+
46
+ #### Parameters
47
+
48
+ ##### syncChangeSet
49
+
50
+ [`ISyncChangeSet`](ISyncChangeSet.md)
51
+
52
+ The change set to synchronise.
24
53
 
25
54
  #### Returns
26
55
 
@@ -0,0 +1,5 @@
1
+ # Type Alias: SyncNodeIdentityMode
2
+
3
+ > **SyncNodeIdentityMode** = *typeof* [`SyncNodeIdentityMode`](../variables/SyncNodeIdentityMode.md)\[keyof *typeof* [`SyncNodeIdentityMode`](../variables/SyncNodeIdentityMode.md)\]
4
+
5
+ The mode to determine how node identities are matched.
@@ -0,0 +1,25 @@
1
+ # Variable: SyncNodeIdentityMode
2
+
3
+ > `const` **SyncNodeIdentityMode**: `object`
4
+
5
+ The mode to determine how node identities are matched.
6
+
7
+ ## Type declaration
8
+
9
+ ### Local
10
+
11
+ > `readonly` **Local**: `"local"` = `"local"`
12
+
13
+ Match the local node identity.
14
+
15
+ ### Remote
16
+
17
+ > `readonly` **Remote**: `"remote"` = `"remote"`
18
+
19
+ Match all but the local node identity.
20
+
21
+ ### All
22
+
23
+ > `readonly` **All**: `"all"` = `"all"`
24
+
25
+ All match both local and remote entities.
@@ -30,6 +30,12 @@ A request has been made for a local item.
30
30
 
31
31
  A response to a local item request.
32
32
 
33
+ ### Reset
34
+
35
+ > `readonly` **Reset**: `"synchronised-storage:reset"` = `"synchronised-storage:reset"`
36
+
37
+ Reset the storage.
38
+
33
39
  ### BatchRequest
34
40
 
35
41
  > `readonly` **BatchRequest**: `"synchronised-storage:batch-request"` = `"synchronised-storage:batch-request"`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/synchronised-storage-models",
3
- "version": "0.0.1-next.3",
3
+ "version": "0.0.1-next.5",
4
4
  "description": "Models which define the structure of the synchronised storage connectors and services",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,7 +16,8 @@
16
16
  "dependencies": {
17
17
  "@twin.org/core": "next",
18
18
  "@twin.org/entity": "next",
19
- "@twin.org/nameof": "next"
19
+ "@twin.org/nameof": "next",
20
+ "@twin.org/standards-w3c-did": "next"
20
21
  },
21
22
  "main": "./dist/cjs/index.cjs",
22
23
  "module": "./dist/esm/index.mjs",