@cero-base/core 2.4.1 → 2.6.0
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/package.json +22 -15
- package/src/database/dispatch.js +159 -30
- package/src/database/encryption.js +9 -8
- package/src/database/index.js +119 -10
- package/src/database/rotation.js +13 -11
- package/src/identity/index.js +131 -56
- package/src/lib/schema.js +15 -7
- package/src/lib/spec/index.js +15 -12
- package/src/lib/spec/schema.json +10 -10
- package/src/lib/utils.js +5 -4
- package/src/network/index.js +5 -11
- package/src/pairing/index.js +18 -10
- package/src/push/index.js +37 -0
- package/types/database/encryption.d.ts +8 -6
- package/types/database/index.d.ts +40 -3
- package/types/database/rotation.d.ts +2 -2
- package/types/identity/index.d.ts +101 -41
- package/types/lib/schema.d.ts +15 -4
- package/types/lib/spec/index.d.ts +4 -4
- package/types/network/index.d.ts +1 -7
- package/types/pairing/index.d.ts +13 -2
- package/types/push/index.d.ts +23 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type Handle = {
|
|
2
|
+
id: string;
|
|
3
|
+
key: Uint8Array;
|
|
4
|
+
};
|
|
5
|
+
export type Hit = Handle & {
|
|
6
|
+
length: number;
|
|
7
|
+
newer: boolean;
|
|
8
|
+
ref: string | null;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {{ id: string, key: Uint8Array }} Handle A handle this device holds: its id and its database key.
|
|
12
|
+
* @typedef {Handle & { length: number, newer: boolean, ref: string | null }} Hit The handle a push is about, the length it proves, whether this device is behind it, and the ref the write was on.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Verify a push payload against this device's storage: the one the gateway sent, decoded from the
|
|
16
|
+
* platform's message. Null when it is about no handle given, is forged, or does not decode.
|
|
17
|
+
*
|
|
18
|
+
* @param {import('hypercore-storage')} storage The corestore's storage; may be opened read-only.
|
|
19
|
+
* @param {Uint8Array} payload
|
|
20
|
+
* @param {Handle[]} handles
|
|
21
|
+
* @returns {Promise<Hit | null>}
|
|
22
|
+
*/
|
|
23
|
+
export declare function verify(storage: import('hypercore-storage'), payload: Uint8Array, handles: Handle[]): Promise<Hit | null>;
|