@twin.org/synchronised-storage-models 0.0.1-next.2 → 0.0.1-next.4
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 +2 -2
- package/dist/esm/index.mjs +2 -2
- package/dist/types/index.d.ts +5 -1
- package/dist/types/models/ISyncChange.d.ts +19 -0
- package/dist/types/models/ISyncChangeSet.d.ts +36 -0
- package/dist/types/models/ISynchronisedEntity.d.ts +4 -0
- package/dist/types/models/ISynchronisedStorageComponent.d.ts +13 -3
- package/dist/types/models/api/ISyncChangeSetRequest.d.ts +3 -7
- package/dist/types/models/api/ISyncDecryptionKeyRequest.d.ts +19 -0
- package/dist/types/models/api/ISyncDecryptionKeyResponse.d.ts +14 -0
- package/dist/types/models/eventBus/ISyncBatchRequest.d.ts +2 -2
- package/dist/types/models/eventBus/ISyncBatchResponse.d.ts +2 -6
- package/dist/types/models/eventBus/ISyncItemChange.d.ts +2 -2
- package/dist/types/models/eventBus/ISyncItemRemove.d.ts +2 -2
- package/dist/types/models/eventBus/ISyncItemRequest.d.ts +2 -2
- package/dist/types/models/eventBus/ISyncItemResponse.d.ts +2 -2
- package/dist/types/models/eventBus/ISyncItemSet.d.ts +2 -2
- package/dist/types/models/eventBus/ISyncRegisterStorageKey.d.ts +9 -0
- package/dist/types/models/synchronisedStorageTopics.d.ts +2 -2
- package/docs/changelog.md +14 -0
- package/docs/reference/index.md +5 -1
- package/docs/reference/interfaces/ISyncBatchRequest.md +3 -3
- package/docs/reference/interfaces/ISyncBatchResponse.md +3 -11
- package/docs/reference/interfaces/ISyncChange.md +33 -0
- package/docs/reference/interfaces/ISyncChangeSet.md +65 -0
- package/docs/reference/interfaces/ISyncChangeSetRequest.md +3 -9
- package/docs/reference/interfaces/ISyncDecryptionKeyRequest.md +23 -0
- package/docs/reference/interfaces/ISyncDecryptionKeyResponse.md +17 -0
- package/docs/reference/interfaces/ISyncItemChange.md +3 -3
- package/docs/reference/interfaces/ISyncItemRemove.md +3 -3
- package/docs/reference/interfaces/ISyncItemRequest.md +3 -3
- package/docs/reference/interfaces/ISyncItemResponse.md +3 -3
- package/docs/reference/interfaces/ISyncItemSet.md +3 -3
- package/docs/reference/interfaces/ISyncRegisterStorageKey.md +11 -0
- package/docs/reference/interfaces/ISynchronisedEntity.md +8 -0
- package/docs/reference/interfaces/ISynchronisedStorageComponent.md +34 -5
- package/docs/reference/variables/SynchronisedStorageTopics.md +3 -3
- package/package.json +3 -2
- package/dist/types/models/eventBus/ISyncRegisterSchemaType.d.ts +0 -9
- package/docs/reference/interfaces/ISyncRegisterSchemaType.md +0 -11
package/dist/cjs/index.cjs
CHANGED
|
@@ -25,9 +25,9 @@ const SyncChangeOperation = {
|
|
|
25
25
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
26
26
|
const SynchronisedStorageTopics = {
|
|
27
27
|
/**
|
|
28
|
-
* Register a
|
|
28
|
+
* Register a storage key for the synchronised storage.
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
RegisterStorageKey: "synchronised-storage:register-storage-key",
|
|
31
31
|
/**
|
|
32
32
|
* An item was changed in the storage by the local node.
|
|
33
33
|
*/
|
package/dist/esm/index.mjs
CHANGED
|
@@ -23,9 +23,9 @@ const SyncChangeOperation = {
|
|
|
23
23
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
24
24
|
const SynchronisedStorageTopics = {
|
|
25
25
|
/**
|
|
26
|
-
* Register a
|
|
26
|
+
* Register a storage key for the synchronised storage.
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
RegisterStorageKey: "synchronised-storage:register-storage-key",
|
|
29
29
|
/**
|
|
30
30
|
* An item was changed in the storage by the local node.
|
|
31
31
|
*/
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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";
|
|
@@ -6,8 +8,10 @@ export * from "./models/eventBus/ISyncItemRemove";
|
|
|
6
8
|
export * from "./models/eventBus/ISyncItemRequest";
|
|
7
9
|
export * from "./models/eventBus/ISyncItemResponse";
|
|
8
10
|
export * from "./models/eventBus/ISyncItemSet";
|
|
9
|
-
export * from "./models/eventBus/
|
|
11
|
+
export * from "./models/eventBus/ISyncRegisterStorageKey";
|
|
10
12
|
export * from "./models/eventBus/syncChangeOperation";
|
|
13
|
+
export * from "./models/ISyncChange";
|
|
14
|
+
export * from "./models/ISyncChangeSet";
|
|
11
15
|
export * from "./models/ISynchronisedEntity";
|
|
12
16
|
export * from "./models/ISynchronisedStorageComponent";
|
|
13
17
|
export * from "./models/synchronisedStorageTopics";
|
|
@@ -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
|
+
}
|
|
@@ -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
|
-
*
|
|
8
|
-
*
|
|
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(
|
|
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
|
|
7
|
+
* The body of the request.
|
|
7
8
|
*/
|
|
8
|
-
|
|
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
|
+
}
|
|
@@ -4,13 +4,9 @@ import type { ISynchronisedEntity } from "../ISynchronisedEntity";
|
|
|
4
4
|
*/
|
|
5
5
|
export interface ISyncBatchResponse<T extends ISynchronisedEntity> {
|
|
6
6
|
/**
|
|
7
|
-
* The
|
|
7
|
+
* The key of the storage for the entities in the batch.
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* The primary key of the entity in the sync item response.
|
|
12
|
-
*/
|
|
13
|
-
primaryKey: keyof T;
|
|
9
|
+
storageKey: string;
|
|
14
10
|
/**
|
|
15
11
|
* The entities in the batch.
|
|
16
12
|
*/
|
|
@@ -4,9 +4,9 @@ import type { SyncChangeOperation } from "./syncChangeOperation";
|
|
|
4
4
|
*/
|
|
5
5
|
export interface ISyncItemChange {
|
|
6
6
|
/**
|
|
7
|
-
* The
|
|
7
|
+
* The key of the storage being changed.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
storageKey: string;
|
|
10
10
|
/**
|
|
11
11
|
* The operation being performed on the item.
|
|
12
12
|
*/
|
|
@@ -4,9 +4,9 @@ import type { ISynchronisedEntity } from "../ISynchronisedEntity";
|
|
|
4
4
|
*/
|
|
5
5
|
export interface ISyncItemResponse<T extends ISynchronisedEntity> {
|
|
6
6
|
/**
|
|
7
|
-
* The
|
|
7
|
+
* The key of the storage for the entities in the batch.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
storageKey: string;
|
|
10
10
|
/**
|
|
11
11
|
* The id of the entity in the sync item response.
|
|
12
12
|
*/
|
|
@@ -4,9 +4,9 @@ import type { ISynchronisedEntity } from "../ISynchronisedEntity";
|
|
|
4
4
|
*/
|
|
5
5
|
export interface ISyncItemSet<T extends ISynchronisedEntity = ISynchronisedEntity> {
|
|
6
6
|
/**
|
|
7
|
-
* The
|
|
7
|
+
* The key of the storage being set.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
storageKey: string;
|
|
10
10
|
/**
|
|
11
11
|
* The entity being set in the item set.
|
|
12
12
|
*/
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare const SynchronisedStorageTopics: {
|
|
5
5
|
/**
|
|
6
|
-
* Register a
|
|
6
|
+
* Register a storage key for the synchronised storage.
|
|
7
7
|
*/
|
|
8
|
-
readonly
|
|
8
|
+
readonly RegisterStorageKey: "synchronised-storage:register-storage-key";
|
|
9
9
|
/**
|
|
10
10
|
* An item was changed in the storage by the local node.
|
|
11
11
|
*/
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [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)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* blob storage connector instead of component ([#7](https://github.com/twinfoundation/synchronised-storage/issues/7)) ([ea27241](https://github.com/twinfoundation/synchronised-storage/commit/ea27241cf0810b52ab7a6be7346809d127b7109a))
|
|
9
|
+
|
|
10
|
+
## [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)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* sync testing ([#5](https://github.com/twinfoundation/synchronised-storage/issues/5)) ([f78d5ac](https://github.com/twinfoundation/synchronised-storage/commit/f78d5ac661b891f9912e0a81d028453f909a64b4))
|
|
16
|
+
|
|
3
17
|
## [0.0.1-next.2](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-models-v0.0.1-next.1...synchronised-storage-models-v0.0.1-next.2) (2025-07-22)
|
|
4
18
|
|
|
5
19
|
|
package/docs/reference/index.md
CHANGED
|
@@ -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)
|
|
@@ -12,7 +16,7 @@
|
|
|
12
16
|
- [ISyncItemRequest](interfaces/ISyncItemRequest.md)
|
|
13
17
|
- [ISyncItemResponse](interfaces/ISyncItemResponse.md)
|
|
14
18
|
- [ISyncItemSet](interfaces/ISyncItemSet.md)
|
|
15
|
-
- [
|
|
19
|
+
- [ISyncRegisterStorageKey](interfaces/ISyncRegisterStorageKey.md)
|
|
16
20
|
|
|
17
21
|
## Type Aliases
|
|
18
22
|
|
|
@@ -4,11 +4,11 @@ Request for a local batch.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### storageKey
|
|
8
8
|
|
|
9
|
-
> **
|
|
9
|
+
> **storageKey**: `string`
|
|
10
10
|
|
|
11
|
-
The
|
|
11
|
+
The key of the storage for the entities in the batch.
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
@@ -10,19 +10,11 @@ Response for a local batch.
|
|
|
10
10
|
|
|
11
11
|
## Properties
|
|
12
12
|
|
|
13
|
-
###
|
|
13
|
+
### storageKey
|
|
14
14
|
|
|
15
|
-
> **
|
|
15
|
+
> **storageKey**: `string`
|
|
16
16
|
|
|
17
|
-
The
|
|
18
|
-
|
|
19
|
-
***
|
|
20
|
-
|
|
21
|
-
### primaryKey
|
|
22
|
-
|
|
23
|
-
> **primaryKey**: keyof `T`
|
|
24
|
-
|
|
25
|
-
The primary key of the entity in the sync item response.
|
|
17
|
+
The key of the storage for the entities in the batch.
|
|
26
18
|
|
|
27
19
|
***
|
|
28
20
|
|
|
@@ -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
|
+
> `optional` **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
|
-
###
|
|
7
|
+
### body
|
|
8
8
|
|
|
9
|
-
> **
|
|
9
|
+
> **body**: [`ISyncChangeSet`](ISyncChangeSet.md)
|
|
10
10
|
|
|
11
|
-
The
|
|
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.
|
|
@@ -4,11 +4,11 @@ Request for a local item.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### storageKey
|
|
8
8
|
|
|
9
|
-
> **
|
|
9
|
+
> **storageKey**: `string`
|
|
10
10
|
|
|
11
|
-
The
|
|
11
|
+
The key of the storage for the entities in the batch.
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
@@ -10,11 +10,11 @@ Response for a sync item request.
|
|
|
10
10
|
|
|
11
11
|
## Properties
|
|
12
12
|
|
|
13
|
-
###
|
|
13
|
+
### storageKey
|
|
14
14
|
|
|
15
|
-
> **
|
|
15
|
+
> **storageKey**: `string`
|
|
16
16
|
|
|
17
|
-
The
|
|
17
|
+
The key of the storage for the entities in the batch.
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
@@ -8,19 +8,48 @@ Class for performing synchronised storage operations.
|
|
|
8
8
|
|
|
9
9
|
## Methods
|
|
10
10
|
|
|
11
|
-
###
|
|
11
|
+
### getDecryptionKey()
|
|
12
12
|
|
|
13
|
-
> **
|
|
13
|
+
> **getDecryptionKey**(`nodeIdentity`, `proof`): `Promise`\<`string`\>
|
|
14
14
|
|
|
15
|
-
|
|
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
|
-
#####
|
|
20
|
+
##### nodeIdentity
|
|
20
21
|
|
|
21
22
|
`string`
|
|
22
23
|
|
|
23
|
-
The
|
|
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
|
|
|
@@ -6,11 +6,11 @@ The topics for synchronised storage event bus notifications.
|
|
|
6
6
|
|
|
7
7
|
## Type declaration
|
|
8
8
|
|
|
9
|
-
###
|
|
9
|
+
### RegisterStorageKey
|
|
10
10
|
|
|
11
|
-
> `readonly` **
|
|
11
|
+
> `readonly` **RegisterStorageKey**: `"synchronised-storage:register-storage-key"` = `"synchronised-storage:register-storage-key"`
|
|
12
12
|
|
|
13
|
-
Register a
|
|
13
|
+
Register a storage key for the synchronised storage.
|
|
14
14
|
|
|
15
15
|
### LocalItemChange
|
|
16
16
|
|
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
|
+
"version": "0.0.1-next.4",
|
|
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",
|