@interncom/diplomatic 0.0.72 → 0.0.74

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.
@@ -5,7 +5,7 @@ declare class IDBStore implements IClientStateStore {
5
5
  hostID?: string;
6
6
  lastFetchedAt?: Date;
7
7
  wipe(): Promise<void>;
8
- getSeed(): Promise<Uint8Array | undefined>;
8
+ getSeed(): Promise<Uint8Array<ArrayBufferLike> | undefined>;
9
9
  setSeed(seed: Uint8Array): Promise<void>;
10
10
  getHostURL(): Promise<string | undefined>;
11
11
  setHostURL(url: string): Promise<void>;
@@ -15,14 +15,14 @@ declare class IDBStore implements IClientStateStore {
15
15
  setLastFetchedAt(ts: Date): Promise<void>;
16
16
  enqueueUpload: (sha256: Uint8Array, cipherOp: Uint8Array) => Promise<void>;
17
17
  dequeueUpload: (sha256: Uint8Array) => Promise<void>;
18
- peekUpload: (sha256: Uint8Array) => Promise<Uint8Array | undefined>;
19
- listUploads: () => Promise<Uint8Array[]>;
18
+ peekUpload: (sha256: Uint8Array) => Promise<Uint8Array<ArrayBufferLike> | undefined>;
19
+ listUploads: () => Promise<Uint8Array<ArrayBufferLike>[]>;
20
20
  numUploads: () => Promise<number>;
21
21
  downloadQueue: Set<string>;
22
22
  enqueueDownload: (sha256: Uint8Array, recordedAt: Date) => Promise<void>;
23
23
  dequeueDownload: (sha256: Uint8Array) => Promise<void>;
24
24
  listDownloads: () => Promise<{
25
- sha256: Uint8Array;
25
+ sha256: Uint8Array<ArrayBufferLike>;
26
26
  recordedAt: Date;
27
27
  }[]>;
28
28
  numDownloads: () => Promise<number>;
@@ -30,7 +30,7 @@ declare class IDBStore implements IClientStateStore {
30
30
  clearOp: (sha256: Uint8Array) => Promise<void>;
31
31
  listOps: () => Promise<{
32
32
  sha256: string;
33
- cipherOp: Uint8Array;
33
+ cipherOp: Uint8Array<ArrayBufferLike>;
34
34
  }[]>;
35
35
  hasOp: (sha256: Uint8Array) => Promise<boolean>;
36
36
  }
package/dist/index.mjs CHANGED
@@ -11631,7 +11631,10 @@ var DiplomaticClient = class {
11631
11631
  this.emitXferUpdate();
11632
11632
  } catch (err) {
11633
11633
  console.error("Processing download", err, item);
11634
- const transient = true;
11634
+ let transient = true;
11635
+ if (err instanceof Error && err.message === "wrong secret key for the given ciphertext") {
11636
+ transient = false;
11637
+ }
11635
11638
  if (!transient) {
11636
11639
  await this.store.dequeueDownload(item.sha256);
11637
11640
  this.emitXferUpdate();
@@ -11732,7 +11735,7 @@ var DiplomaticClient = class {
11732
11735
  };
11733
11736
 
11734
11737
  // src/react/useStateWatcher.ts
11735
- import { useState as useState2, useEffect as useEffect2 } from "react";
11738
+ import { use, useEffect as useEffect2, useRef, useState as useState2 } from "react";
11736
11739
  function useStateWatcher(mgr, opType, callback) {
11737
11740
  const [val, setVal] = useState2();
11738
11741
  useEffect2(() => {
@@ -1,7 +1,7 @@
1
1
  import type { IClientStateStore } from "./types";
2
2
  declare class LocalStorageStore implements IClientStateStore {
3
3
  wipe(): Promise<void>;
4
- getSeed(): Promise<Uint8Array | undefined>;
4
+ getSeed(): Promise<Uint8Array<ArrayBufferLike> | undefined>;
5
5
  setSeed(seed: Uint8Array): Promise<void>;
6
6
  getHostURL(): Promise<string | undefined>;
7
7
  setHostURL(url: string): Promise<void>;
@@ -9,26 +9,26 @@ declare class LocalStorageStore implements IClientStateStore {
9
9
  setHostID(id: string): Promise<void>;
10
10
  getLastFetchedAt(): Promise<Date | undefined>;
11
11
  setLastFetchedAt(ts: Date): Promise<void>;
12
- uploadQueue: Map<string, Uint8Array>;
12
+ uploadQueue: Map<string, Uint8Array<ArrayBufferLike>>;
13
13
  enqueueUpload: (sha256: Uint8Array, cipherOp: Uint8Array) => Promise<void>;
14
14
  dequeueUpload: (sha256: Uint8Array) => Promise<void>;
15
- peekUpload: (sha256: Uint8Array) => Promise<Uint8Array | undefined>;
16
- listUploads: () => Promise<Uint8Array[]>;
15
+ peekUpload: (sha256: Uint8Array) => Promise<Uint8Array<ArrayBufferLike> | undefined>;
16
+ listUploads: () => Promise<Uint8Array<ArrayBufferLike>[]>;
17
17
  numUploads: () => Promise<number>;
18
18
  downloadQueue: Map<string, Date>;
19
19
  enqueueDownload: (sha256: Uint8Array, recordedAt: Date) => Promise<void>;
20
20
  dequeueDownload: (sha256: Uint8Array) => Promise<void>;
21
21
  listDownloads: () => Promise<{
22
- sha256: Uint8Array;
22
+ sha256: Uint8Array<ArrayBufferLike>;
23
23
  recordedAt: Date;
24
24
  }[]>;
25
25
  numDownloads: () => Promise<number>;
26
- ops: Map<string, Uint8Array>;
26
+ ops: Map<string, Uint8Array<ArrayBufferLike>>;
27
27
  storeOp: (sha256: Uint8Array, cipherOp: Uint8Array) => Promise<void>;
28
28
  clearOp: (sha256: Uint8Array) => Promise<void>;
29
29
  listOps: () => Promise<{
30
30
  sha256: string;
31
- cipherOp: Uint8Array;
31
+ cipherOp: Uint8Array<ArrayBufferLike>;
32
32
  }[]>;
33
33
  hasOp: (sha256: Uint8Array) => Promise<boolean>;
34
34
  }
@@ -5,7 +5,7 @@ declare class MemoryStore implements IClientStateStore {
5
5
  hostID?: string;
6
6
  lastFetchedAt?: Date;
7
7
  wipe(): Promise<void>;
8
- getSeed(): Promise<Uint8Array | undefined>;
8
+ getSeed(): Promise<Uint8Array<ArrayBufferLike> | undefined>;
9
9
  setSeed(seed: Uint8Array): Promise<void>;
10
10
  getHostURL(): Promise<string | undefined>;
11
11
  setHostURL(url: string): Promise<void>;
@@ -13,26 +13,26 @@ declare class MemoryStore implements IClientStateStore {
13
13
  setHostID(id: string): Promise<void>;
14
14
  getLastFetchedAt(): Promise<Date | undefined>;
15
15
  setLastFetchedAt(ts: Date): Promise<void>;
16
- uploadQueue: Map<string, Uint8Array>;
16
+ uploadQueue: Map<string, Uint8Array<ArrayBufferLike>>;
17
17
  enqueueUpload: (sha256: Uint8Array, cipherOp: Uint8Array) => Promise<void>;
18
18
  dequeueUpload: (sha256: Uint8Array) => Promise<void>;
19
- peekUpload: (sha256: Uint8Array) => Promise<Uint8Array | undefined>;
20
- listUploads: () => Promise<Uint8Array[]>;
19
+ peekUpload: (sha256: Uint8Array) => Promise<Uint8Array<ArrayBufferLike> | undefined>;
20
+ listUploads: () => Promise<Uint8Array<ArrayBufferLike>[]>;
21
21
  numUploads: () => Promise<number>;
22
22
  downloadQueue: Map<string, Date>;
23
23
  enqueueDownload: (sha256: Uint8Array, recordedAt: Date) => Promise<void>;
24
24
  dequeueDownload: (sha256: Uint8Array) => Promise<void>;
25
25
  listDownloads: () => Promise<{
26
- sha256: Uint8Array;
26
+ sha256: Uint8Array<ArrayBufferLike>;
27
27
  recordedAt: Date;
28
28
  }[]>;
29
29
  numDownloads: () => Promise<number>;
30
- ops: Map<string, Uint8Array>;
30
+ ops: Map<string, Uint8Array<ArrayBufferLike>>;
31
31
  storeOp: (sha256: Uint8Array, cipherOp: Uint8Array) => Promise<void>;
32
32
  clearOp: (sha256: Uint8Array) => Promise<void>;
33
33
  listOps: () => Promise<{
34
34
  sha256: string;
35
- cipherOp: Uint8Array;
35
+ cipherOp: Uint8Array<ArrayBufferLike>;
36
36
  }[]>;
37
37
  hasOp: (sha256: Uint8Array) => Promise<boolean>;
38
38
  }
@@ -1,2 +1,3 @@
1
1
  import type { StateManager } from "../state";
2
2
  export default function useStateWatcher<T>(mgr: StateManager, opType: string, callback: () => Promise<T>): T | undefined;
3
+ export declare function useStateWatcherSuspense<T>(mgr: StateManager, opType: string, callback: () => Promise<T>): T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interncom/diplomatic",
3
- "version": "0.0.72",
3
+ "version": "0.0.74",
4
4
  "type": "module",
5
5
  "description": "Secure sync layer",
6
6
  "main": "dist/index.mjs",
@@ -21,14 +21,14 @@
21
21
  "devDependencies": {
22
22
  "@types/file-saver": "^2.0.7",
23
23
  "@types/node": "^20.14.11",
24
- "@types/react": "^18.3.3",
24
+ "@types/react": "^19.1.0",
25
25
  "esbuild": "0.21.5",
26
- "react": "^18.3.1",
27
- "typescript": "^5.5.2",
28
- "vitest": "^1.6.0"
26
+ "react": "^19.1.0",
27
+ "typescript": "^5.8.3",
28
+ "vitest": "^3.1.2"
29
29
  },
30
30
  "peerDependencies": {
31
- "react": "^18.3.1 || ^19.0.0"
31
+ "react": "^19.0.0"
32
32
  },
33
33
  "dependencies": {
34
34
  "@msgpack/msgpack": "^3.0.0-beta2",