@interncom/diplomatic 0.1.0 → 0.1.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.
- package/dist/client.d.ts +5 -4
- package/dist/entdb/entdb.d.ts +10 -4
- package/dist/entdb/idb.d.ts +1 -0
- package/dist/index.d.ts +4 -5
- package/dist/index.mjs +1328 -1450
- package/dist/react/useClient.d.ts +14 -3
- package/dist/shared/bag.d.ts +1 -2
- package/dist/shared/endpoint.d.ts +1 -1
- package/dist/shared/http.d.ts +2 -1
- package/dist/shared/sync.d.ts +9 -0
- package/dist/shared/types.d.ts +1 -1
- package/dist/stores/idb/store.d.ts +2 -1
- package/dist/sync.d.ts +1 -8
- package/package.json +2 -2
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { HostHandle } from "../shared/types";
|
|
3
|
-
import type { IDiplomaticClientState, IDiplomaticClientXferState } from "../types";
|
|
1
|
+
import { SyncClient } from "../client";
|
|
2
|
+
import { HostHandle, IHostConnectionInfo, MasterSeed } from "../shared/types";
|
|
3
|
+
import type { IDiplomaticClientState, IDiplomaticClientXferState, IStateManager } from "../types";
|
|
4
|
+
import { IEntDB } from "../entdb/entdb";
|
|
5
|
+
import { IClock } from "../shared/clock";
|
|
4
6
|
export declare function useClientState<Handle extends HostHandle>(client: SyncClient<Handle>): IDiplomaticClientState | undefined;
|
|
5
7
|
export declare function useClientXferState<Handle extends HostHandle>(client: SyncClient<Handle>): IDiplomaticClientXferState | undefined;
|
|
6
8
|
export declare function useSyncOnResume<Handle extends HostHandle>(client: SyncClient<Handle>): void;
|
|
9
|
+
export declare function useClient({ clock, seed, host }: {
|
|
10
|
+
clock?: IClock;
|
|
11
|
+
seed?: MasterSeed;
|
|
12
|
+
host?: IHostConnectionInfo<URL>;
|
|
13
|
+
}): {
|
|
14
|
+
client?: SyncClient<URL>;
|
|
15
|
+
entDB?: IEntDB;
|
|
16
|
+
stateMgr: IStateManager;
|
|
17
|
+
};
|
package/dist/shared/bag.d.ts
CHANGED
|
@@ -6,11 +6,10 @@ import type { Hash, HostSpecificKeyPair, IBag, ICrypto, IHostCrypto, IMessage, I
|
|
|
6
6
|
export declare function bagSigValid(bag: IBag, pubKey: PublicKey, crypto: IHostCrypto): Promise<boolean>;
|
|
7
7
|
export declare function kdmFor(msgHeadEnc: Uint8Array, keys: HostSpecificKeyPair, crypto: ICrypto): Promise<Uint8Array>;
|
|
8
8
|
export declare function sealBag(msg: IMessage, keys: HostSpecificKeyPair, crypto: ICrypto, enclave: Enclave): Promise<ValStat<IBag>>;
|
|
9
|
-
interface IOpenBag {
|
|
9
|
+
export interface IOpenBag {
|
|
10
10
|
msgHead: IMessageHead;
|
|
11
11
|
bod?: EncodedMessage;
|
|
12
12
|
headHash: Hash;
|
|
13
13
|
}
|
|
14
14
|
export declare function openBagBody(headEnc: Uint8Array, bodyCph: Uint8Array | undefined, key: Uint8Array, crypto: ICrypto): Promise<ValStat<IOpenBag>>;
|
|
15
15
|
export declare function openBag(bag: IBag, pubKey: PublicKey, crypto: ICrypto, enclave: Enclave): Promise<ValStat<IMessageWithHash>>;
|
|
16
|
-
export {};
|
|
@@ -19,5 +19,5 @@ export interface IAuthData {
|
|
|
19
19
|
keys: HostSpecificKeyPair;
|
|
20
20
|
authTS: IAuthTimestamp;
|
|
21
21
|
}
|
|
22
|
-
export declare function hostKeys(host: IProtoClient, keyPath: string, idx
|
|
22
|
+
export declare function hostKeys(host: IProtoClient, keyPath: string, idx?: number): Promise<HostSpecificKeyPair>;
|
|
23
23
|
export {};
|
package/dist/shared/http.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Decoder, Encoder } from "./codec.ts";
|
|
2
2
|
import { APICallName } from "./consts.ts";
|
|
3
|
-
import { IPushListener, ITransport } from "./types.ts";
|
|
3
|
+
import { IHostConnectionInfo, IPushListener, ITransport } from "./types.ts";
|
|
4
4
|
import { IRespHead } from "./codecs/respHead.ts";
|
|
5
5
|
import { ValStat } from "./valstat.ts";
|
|
6
6
|
export declare const api: {
|
|
@@ -75,6 +75,7 @@ export declare class HTTPTransport implements ITransport {
|
|
|
75
75
|
constructor(url: URL);
|
|
76
76
|
call(name: APICallName, enc: Encoder): Promise<ValStat<Decoder>>;
|
|
77
77
|
}
|
|
78
|
+
export declare const hostHTTPTransport: (host: IHostConnectionInfo<URL>) => HTTPTransport;
|
|
78
79
|
export declare function errResp(head: IRespHead): Response;
|
|
79
80
|
export declare function binResp(encoder: Encoder): Response;
|
|
80
81
|
export declare function cors(resp: Response): Response;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IBagPeekItem } from "./codecs/peekItem.ts";
|
|
2
|
+
import { Enclave } from "./enclave.ts";
|
|
3
|
+
import { HostSpecificKeyPair, ICrypto } from "./types.ts";
|
|
4
|
+
import { ValStat } from "./valstat.ts";
|
|
5
|
+
export interface IDecryptedBagPeekItem {
|
|
6
|
+
kdm: Uint8Array;
|
|
7
|
+
headEnc: Uint8Array;
|
|
8
|
+
}
|
|
9
|
+
export declare function decryptPeekItem(item: IBagPeekItem, hostKeys: HostSpecificKeyPair, enclave: Enclave, crypto: ICrypto): Promise<ValStat<IDecryptedBagPeekItem>>;
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -136,7 +136,7 @@ export type HostHandle = URL | IProtoHost;
|
|
|
136
136
|
export interface IHostConnectionInfo<Handle extends HostHandle> {
|
|
137
137
|
handle: Handle;
|
|
138
138
|
label: string;
|
|
139
|
-
idx
|
|
139
|
+
idx?: number;
|
|
140
140
|
}
|
|
141
141
|
export interface ISubscriptionMetadata {
|
|
142
142
|
term: number;
|
|
@@ -20,4 +20,5 @@ export declare class IDBStore implements IStore<URL> {
|
|
|
20
20
|
constructor(db: IDBDatabase, crypto: ICrypto);
|
|
21
21
|
wipe(): Promise<void>;
|
|
22
22
|
}
|
|
23
|
-
export declare function
|
|
23
|
+
export declare function openIDBStoreDB(): Promise<IDBDatabase>;
|
|
24
|
+
export declare function openIDBStore(crypto: ICrypto): Promise<IDBStore>;
|
package/dist/sync.d.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import DiplomaticClientAPI from "./shared/client";
|
|
2
2
|
import { IClock } from "./shared/clock";
|
|
3
|
-
import { IBagPeekItem } from "./shared/codecs/peekItem";
|
|
4
3
|
import { Status } from "./shared/consts";
|
|
5
4
|
import { Enclave } from "./shared/enclave";
|
|
6
|
-
import { HostHandle,
|
|
7
|
-
import { ValStat } from "./shared/valstat";
|
|
5
|
+
import { HostHandle, ICrypto } from "./shared/types";
|
|
8
6
|
import { IHostRow, IMsgParts, IStore, IStoredMessageData } from "./types";
|
|
9
|
-
export interface IDecryptedBagPeekItem {
|
|
10
|
-
kdm: Uint8Array;
|
|
11
|
-
headEnc: Uint8Array;
|
|
12
|
-
}
|
|
13
|
-
export declare function decryptPeekItem(item: IBagPeekItem, hostKeys: HostSpecificKeyPair, enclave: Enclave, crypto: ICrypto): Promise<ValStat<IDecryptedBagPeekItem>>;
|
|
14
7
|
export interface ISyncParams<Handle extends HostHandle> {
|
|
15
8
|
conn: DiplomaticClientAPI<Handle>;
|
|
16
9
|
store: IStore<Handle>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interncom/diplomatic",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Secure sync layer",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"react": "^19.0.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@msgpack/msgpack": "
|
|
37
|
+
"@msgpack/msgpack": "3.1.3",
|
|
38
38
|
"@noble/hashes": "1.8.0",
|
|
39
39
|
"file-saver": "2.0.5",
|
|
40
40
|
"libsodium.js": "git+ssh://github.com/interncom/libsodium.js#e4e7647"
|