@useaccord/sdk 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/LICENSE +21 -0
- package/dist/adapter.d.ts.map +1 -1
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/evidence/base64.d.ts +12 -0
- package/dist/evidence/base64.d.ts.map +1 -0
- package/dist/evidence/delivery-key.d.ts +82 -0
- package/dist/evidence/delivery-key.d.ts.map +1 -0
- package/dist/evidence/ecies.d.ts +5 -5
- package/dist/evidence/ecies.d.ts.map +1 -1
- package/dist/evidence/fetch.d.ts +34 -10
- package/dist/evidence/fetch.d.ts.map +1 -1
- package/dist/evidence/index.d.ts +1 -0
- package/dist/evidence/index.d.ts.map +1 -1
- package/dist/evidence/index.js +171 -14
- package/dist/evidence/index.js.map +1 -1
- package/dist/evidence/keys.d.ts.map +1 -1
- package/dist/evidence/parse.d.ts +3 -0
- package/dist/evidence/parse.d.ts.map +1 -1
- package/dist/evidence/publish.d.ts.map +1 -1
- package/dist/generated/accounts/appealBond.d.ts +16 -0
- package/dist/generated/accounts/appealBond.d.ts.map +1 -1
- package/dist/generated/accounts/dispute.d.ts +34 -8
- package/dist/generated/accounts/dispute.d.ts.map +1 -1
- package/dist/generated/accounts/jurorStake.d.ts +24 -0
- package/dist/generated/accounts/jurorStake.d.ts.map +1 -1
- package/dist/generated/errors/accord.d.ts +3 -1
- package/dist/generated/errors/accord.d.ts.map +1 -1
- package/dist/generated/instructions/claimFilingBounty.d.ts +82 -0
- package/dist/generated/instructions/claimFilingBounty.d.ts.map +1 -0
- package/dist/generated/instructions/index.d.ts +1 -0
- package/dist/generated/instructions/index.d.ts.map +1 -1
- package/dist/generated/instructions/settleRound.d.ts +1 -1
- package/dist/generated/programs/accord.d.ts +31 -27
- package/dist/generated/programs/accord.d.ts.map +1 -1
- package/dist/index.js +1021 -770
- package/dist/index.js.map +1 -1
- package/dist/methods/appeal.d.ts +9 -5
- package/dist/methods/appeal.d.ts.map +1 -1
- package/dist/methods/dispute.d.ts +6 -5
- package/dist/methods/dispute.d.ts.map +1 -1
- package/dist/methods/settlement.d.ts +24 -1
- package/dist/methods/settlement.d.ts.map +1 -1
- package/dist/methods/staking.d.ts +23 -5
- package/dist/methods/staking.d.ts.map +1 -1
- package/dist/methods/voting.d.ts +6 -7
- package/dist/methods/voting.d.ts.map +1 -1
- package/dist/methods/vrf.d.ts.map +1 -1
- package/dist/methods.d.ts +3 -2
- package/dist/methods.d.ts.map +1 -1
- package/package.json +17 -8
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ChainSquad GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/adapter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAWH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAWH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAiC1C,OAAO,KAAK,EACV,kBAAkB,EAGnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EACV,mBAAmB,EAIpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,qBAAqB,EAEtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,mBAAmB,EAIpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,sBAAsB,EAGvB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,kDAAkD;AAClD,MAAM,WAAW,aACf,SACE,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,kBAAkB;CAAG;AAEzB;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CA2ZjE;AAiHD,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -9,6 +9,12 @@ import type { Address } from "@solana/kit";
|
|
|
9
9
|
export declare const MAX_JURORS = 31;
|
|
10
10
|
export declare const MAX_APPEALS = 3;
|
|
11
11
|
export declare const MAX_OPTIONS = 8;
|
|
12
|
+
/**
|
|
13
|
+
* Maximum sortition retries per seat accepted by on-chain `draw_seat`
|
|
14
|
+
* (constants.rs, L-5 review 2026-09-23). Bounded so one instruction fits the
|
|
15
|
+
* 1.4M CU cap; chains beyond it are rejected with `MaxRetriesExceeded`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const MAX_SORTITION_RETRIES = 128;
|
|
12
18
|
export declare const UPDATE_TIMELOCK_SLOTS = 432000n;
|
|
13
19
|
export declare const UNPAUSE_TIMELOCK_SLOTS = 216000n;
|
|
14
20
|
/** Default appeal window (ADR-0022). Per-Subaccord now; this is the
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;GAMG;AAIH,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,WAAW,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;GAMG;AAIH,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,WAAW,IAAI,CAAC;AAE7B;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAIzC,eAAO,MAAM,qBAAqB,UAAW,CAAC;AAC9C,eAAO,MAAM,sBAAsB,UAAW,CAAC;AAI/C;;wEAEwE;AACxE,eAAO,MAAM,0BAA0B,UAAW,CAAC;AACnD,mEAAmE;AACnE,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAI7C;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAIrC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,iBAAiB,OAAQ,CAAC;AACvC,eAAO,MAAM,0BAA0B,UAAW,CAAC;AACnD,eAAO,MAAM,0BAA0B,UAAW,CAAC;AACnD,eAAO,MAAM,0BAA0B,UAAW,CAAC;AACnD,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC;;;GAGG;AACH,eAAO,MAAM,4BAA4B,OAAQ,CAAC;AAClD,+EAA+E;AAC/E,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,gFAAgF;AAChF,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAC7C,eAAO,MAAM,iBAAiB,QAAS,CAAC;AACxC,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAMxC;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,YAAY,GAAE,MAA2B,GACxC,MAAM,GAAG,IAAI,CAcf;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAClB,YAAY,GAAE,MAA2B,GACxC,MAAM,CAGR;AAWD,oEAAoE;AACpE,eAAO,MAAM,gBAAgB,EACuB,OAAO,CAAC;AAC5D,gGAAgG;AAChG,eAAO,MAAM,0BAA0B,EACa,OAAO,CAAC;AAC5D,wEAAwE;AACxE,eAAO,MAAM,qBAAqB,EACkB,OAAO,CAAC;AAC5D,oGAAoG;AACpG,eAAO,MAAM,+BAA+B,EACO,OAAO,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* evidence/base64.ts — base64 codec for the daemon's JSON wire fields
|
|
3
|
+
* (internal to the evidence module; not exported from the barrel).
|
|
4
|
+
*
|
|
5
|
+
* Standard alphabet, no padding concerns for this protocol's fixed-size
|
|
6
|
+
* fields. Runs on the global `btoa`/`atob` (Node ≥16, Bun, browsers).
|
|
7
|
+
*/
|
|
8
|
+
/** Uint8Array → base64 string. */
|
|
9
|
+
export declare function toBase64(bytes: Uint8Array): string;
|
|
10
|
+
/** base64 string → Uint8Array. Throws on invalid input. */
|
|
11
|
+
export declare function fromBase64(s: string): Uint8Array;
|
|
12
|
+
//# sourceMappingURL=base64.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../src/evidence/base64.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,kCAAkC;AAClC,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAMlD;AAED,2DAA2D;AAC3D,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,CAOhD"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/** Prefix pinning the registration message to `accord-delkey-v1` (ADR-0034). */
|
|
2
|
+
export declare const DELKEY_PREFIX = "accord-delkey-v1";
|
|
3
|
+
/** A juror-held X25519 Delivery Keypair. The secret never leaves origin storage. */
|
|
4
|
+
export interface DeliveryKeypair {
|
|
5
|
+
/** 32-byte X25519 public key — what gets registered at the daemon. */
|
|
6
|
+
publicKey: Uint8Array;
|
|
7
|
+
/** 32-byte X25519 secret key. */
|
|
8
|
+
secretKey: Uint8Array;
|
|
9
|
+
}
|
|
10
|
+
/** Fresh Delivery Keypair (noble X25519; ADR-0034 custody model). */
|
|
11
|
+
export declare function generateDeliveryKey(): DeliveryKeypair;
|
|
12
|
+
/**
|
|
13
|
+
* The wallet-signed registration message:
|
|
14
|
+
* `accord-delkey-v1\nregistered_at:{ms}\nenc_pub:{base58}`.
|
|
15
|
+
* `registered_at` is Unix ms; the daemon rejects `registered_at <= stored`
|
|
16
|
+
* (kills replay-downgrade of an exfiltrated superseded key).
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildDeliveryKeyMessage(encPub: Uint8Array, registeredAtMs: number): Uint8Array;
|
|
19
|
+
/**
|
|
20
|
+
* Daemon-shared verification of a registration signature: Ed25519 over
|
|
21
|
+
* {@link buildDeliveryKeyMessage} by the juror's Solana key. Returns false for
|
|
22
|
+
* a bad signature OR malformed inputs (the daemon maps false → 400).
|
|
23
|
+
*/
|
|
24
|
+
export declare function verifyDeliveryKeyRegistration(jurorEd25519Pub: Uint8Array, encPub: Uint8Array, registeredAtMs: number, sig: Uint8Array): boolean;
|
|
25
|
+
/** Wallet `signMessage` seam (app wires its wallet adapter; ADR-0015 split). */
|
|
26
|
+
export type SignMessage = (message: Uint8Array) => Promise<Uint8Array>;
|
|
27
|
+
export interface RegisterDeliveryKeyParams {
|
|
28
|
+
/** Daemon base URL (app-side `EVIDENCE_DAEMON_URL`). */
|
|
29
|
+
endpoint: string;
|
|
30
|
+
/** Juror's Solana address, base58. */
|
|
31
|
+
juror: string;
|
|
32
|
+
/** Delivery public key to register (32 bytes). */
|
|
33
|
+
encPub: Uint8Array;
|
|
34
|
+
/** Wallet signMessage — signs the registration message (Ed25519). */
|
|
35
|
+
signMessage: SignMessage;
|
|
36
|
+
}
|
|
37
|
+
/** Registration result echoed by the daemon on 201. */
|
|
38
|
+
export interface RegisteredDeliveryKey {
|
|
39
|
+
encPub: Uint8Array;
|
|
40
|
+
registeredAt: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Register (or rotate) the juror's Delivery Key:
|
|
44
|
+
* `PUT /jurors/{juror}/delivery-key` {enc_pub, registered_at, sig} → 201.
|
|
45
|
+
* Throws on 400 (bad sig/body) and 409 (stale `registered_at` — retry later).
|
|
46
|
+
*/
|
|
47
|
+
export declare function registerDeliveryKey(params: RegisterDeliveryKeyParams): Promise<RegisteredDeliveryKey>;
|
|
48
|
+
/**
|
|
49
|
+
* The currently registered Delivery Key:
|
|
50
|
+
* `GET /jurors/{juror}/delivery-key` → 200 {enc_pub, registered_at} | 404 → null.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getRegisteredDeliveryKey(params: {
|
|
53
|
+
endpoint: string;
|
|
54
|
+
juror: string;
|
|
55
|
+
}): Promise<RegisteredDeliveryKey | null>;
|
|
56
|
+
/**
|
|
57
|
+
* Multi-origin self-heal (ADR-0034): compare the daemon's registered key with
|
|
58
|
+
* the local one; mismatch (or none registered — another origin rotated) ⇒
|
|
59
|
+
* re-register with one `signMessage`. Returns `"current"` when already bound,
|
|
60
|
+
* `"re-registered"` after a fresh PUT — then re-pull the delivery.
|
|
61
|
+
*/
|
|
62
|
+
export declare function ensureRegisteredDeliveryKey(params: RegisterDeliveryKeyParams): Promise<"current" | "re-registered">;
|
|
63
|
+
/** Serialized form: `publicKey(32) ‖ secretKey(32)`. */
|
|
64
|
+
export declare function encodeDeliveryKeypair(kp: DeliveryKeypair): Uint8Array;
|
|
65
|
+
/** Inverse of {@link encodeDeliveryKeypair}; throws on a wrong length. */
|
|
66
|
+
export declare function decodeDeliveryKeypair(bytes: Uint8Array): DeliveryKeypair;
|
|
67
|
+
/**
|
|
68
|
+
* Origin-scoped storage port for the serialized keypair. Apps implement it
|
|
69
|
+
* over IndexedDB / localStorage / whatever the origin offers — the SDK owns
|
|
70
|
+
* only the codec, keeping DOM typing out of this module.
|
|
71
|
+
*/
|
|
72
|
+
export interface DeliveryKeyStorage {
|
|
73
|
+
get(): Promise<Uint8Array | null>;
|
|
74
|
+
set(serialized: Uint8Array): Promise<void>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Load the origin's Delivery Key, generating + persisting one on first use.
|
|
78
|
+
* Generate-once semantics: every call on an empty store MUST return the same
|
|
79
|
+
* keypair — re-generating would orphan the daemon registration.
|
|
80
|
+
*/
|
|
81
|
+
export declare function loadOrCreateDeliveryKey(storage: DeliveryKeyStorage): Promise<DeliveryKeypair>;
|
|
82
|
+
//# sourceMappingURL=delivery-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery-key.d.ts","sourceRoot":"","sources":["../../src/evidence/delivery-key.ts"],"names":[],"mappings":"AAgCA,gFAAgF;AAChF,eAAO,MAAM,aAAa,qBAAqB,CAAC;AAEhD,oFAAoF;AACpF,MAAM,WAAW,eAAe;IAC9B,sEAAsE;IACtE,SAAS,EAAE,UAAU,CAAC;IACtB,iCAAiC;IACjC,SAAS,EAAE,UAAU,CAAC;CACvB;AAED,qEAAqE;AACrE,wBAAgB,mBAAmB,IAAI,eAAe,CAGrD;AAMD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,UAAU,EAClB,cAAc,EAAE,MAAM,GACrB,UAAU,CAOZ;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAC3C,eAAe,EAAE,UAAU,EAC3B,MAAM,EAAE,UAAU,EAClB,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,UAAU,GACd,OAAO,CAOT;AAMD,gFAAgF;AAChF,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AAEvE,MAAM,WAAW,yBAAyB;IACxC,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,MAAM,EAAE,UAAU,CAAC;IACnB,qEAAqE;IACrE,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,uDAAuD;AACvD,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,UAAU,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,qBAAqB,CAAC,CAkBhC;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,MAAM,EAAE;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CASxC;AAED;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,SAAS,GAAG,eAAe,CAAC,CAWtC;AAMD,wDAAwD;AACxD,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,eAAe,GAAG,UAAU,CAOrE;AAED,0EAA0E;AAC1E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,eAAe,CAGxE;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAClC,GAAG,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,eAAe,CAAC,CAM1B"}
|
package/dist/evidence/ecies.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface IngestBundle {
|
|
|
12
12
|
/** sha256(plaintext); matches the dispute's on-chain `evidence_hash`. */
|
|
13
13
|
plaintext_hash: Uint8Array;
|
|
14
14
|
}
|
|
15
|
-
/** A bundle re-encrypted to a single drawn juror. */
|
|
15
|
+
/** A bundle re-encrypted to a single drawn juror's Delivery Key (ADR-0034). */
|
|
16
16
|
export interface JurorBundle {
|
|
17
17
|
/** AES-GCM(k_out, plaintext) — nonce(12) prepended. */
|
|
18
18
|
out: Uint8Array;
|
|
@@ -31,10 +31,10 @@ export declare function claimantEncrypt(plaintext: Uint8Array, operatorEd25519Pu
|
|
|
31
31
|
* Callers MUST run {@link verifyIntegrity} next.
|
|
32
32
|
*/
|
|
33
33
|
export declare function operatorDecrypt(bundle: IngestBundle, operatorEd25519SecretSeed: Uint8Array): Promise<Uint8Array>;
|
|
34
|
-
/** Operator re-encrypts plaintext to
|
|
35
|
-
export declare function
|
|
36
|
-
/** Juror-side decrypt of a delivered bundle
|
|
37
|
-
export declare function
|
|
34
|
+
/** Operator re-encrypts plaintext to the juror's registered Delivery Key (ADR-0034). */
|
|
35
|
+
export declare function deliverToDeliveryKey(plaintext: Uint8Array, deliveryEncPub: Uint8Array): Promise<JurorBundle>;
|
|
36
|
+
/** Juror-side decrypt of a delivered bundle with the Delivery Key secret (ADR-0034). */
|
|
37
|
+
export declare function jurorDecryptDelivery(delivered: JurorBundle, deliverySecret: Uint8Array): Promise<Uint8Array>;
|
|
38
38
|
/**
|
|
39
39
|
* Mandatory integrity gate (SPEC §3, §Failure modes): `sha256(plaintext)` MUST
|
|
40
40
|
* equal the dispute's on-chain `evidence_hash`. Both operands are public hashes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecies.d.ts","sourceRoot":"","sources":["../../src/evidence/ecies.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ecies.d.ts","sourceRoot":"","sources":["../../src/evidence/ecies.ts"],"names":[],"mappings":"AAkCA,kEAAkE;AAClE,eAAO,MAAM,WAAW,qBAAqB,CAAC;AAC9C,eAAO,MAAM,YAAY,sBAAsB,CAAC;AAIhD,uEAAuE;AACvE,MAAM,WAAW,YAAY;IAC3B,qDAAqD;IACrD,EAAE,EAAE,UAAU,CAAC;IACf,yDAAyD;IACzD,kBAAkB,EAAE,UAAU,CAAC;IAC/B,gDAAgD;IAChD,OAAO,EAAE,UAAU,CAAC;IACpB,yEAAyE;IACzE,cAAc,EAAE,UAAU,CAAC;CAC5B;AACD,+EAA+E;AAC/E,MAAM,WAAW,WAAW;IAC1B,uDAAuD;IACvD,GAAG,EAAE,UAAU,CAAC;IAChB,2EAA2E;IAC3E,kBAAkB,EAAE,UAAU,CAAC;CAChC;AACD;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,UAAU,EACrB,kBAAkB,EAAE,UAAU,GAC7B,OAAO,CAAC,YAAY,CAAC,CAiBvB;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,YAAY,EACpB,yBAAyB,EAAE,UAAU,GACpC,OAAO,CAAC,UAAU,CAAC,CAMrB;AAED,wFAAwF;AACxF,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,UAAU,EACrB,cAAc,EAAE,UAAU,GACzB,OAAO,CAAC,WAAW,CAAC,CAMtB;AAED,wFAAwF;AACxF,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,WAAW,EACtB,cAAc,EAAE,UAAU,GACzB,OAAO,CAAC,UAAU,CAAC,CAIrB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,UAAU,EACrB,YAAY,EAAE,UAAU,GACvB,OAAO,CAAC,IAAI,CAAC,CAUf"}
|
package/dist/evidence/fetch.d.ts
CHANGED
|
@@ -1,20 +1,44 @@
|
|
|
1
|
+
import type { JurorBundle } from "./ecies.js";
|
|
2
|
+
export interface FetchDeliveryParams {
|
|
3
|
+
/** Daemon base URL (app-side `EVIDENCE_DAEMON_URL`). */
|
|
4
|
+
endpoint: string;
|
|
5
|
+
/** Dispute address, base58. */
|
|
6
|
+
dispute: string;
|
|
7
|
+
/** Juror address, base58 — delivery targets their registered Delivery Key. */
|
|
8
|
+
juror: string;
|
|
9
|
+
}
|
|
10
|
+
/** One manifest entry's delivery status (v2 multifile derived index). */
|
|
11
|
+
export interface DeliveredFile {
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly status: "stored" | "pending" | "out_of_band";
|
|
14
|
+
}
|
|
1
15
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* GET {endpoint}/evidence/{subaccord}/{dispute}/{round}
|
|
5
|
-
*
|
|
6
|
-
* Returns the decrypted manifest (a YAML string for the `accord-evidence/v1`
|
|
7
|
-
* format, or a parsed JSON object if the plaintext was JSON). `null` when no
|
|
8
|
-
* bundle is stored for the round (404).
|
|
9
|
-
*
|
|
10
|
-
* This is the pure fetch — React apps wrap it in a `useQuery` hook
|
|
11
|
-
* (see apps/app and apps/canon `useManifest.ts`).
|
|
16
|
+
* One round's delivered package: a {@link JurorBundle} plus the v2 derived
|
|
17
|
+
* per-entry index. `round` is the evidence round (or the synod party slot).
|
|
12
18
|
*/
|
|
19
|
+
export interface DeliveredRound extends JurorBundle {
|
|
20
|
+
readonly round: number;
|
|
21
|
+
readonly files: readonly DeliveredFile[];
|
|
22
|
+
/** True iff every tracked entry is stored (always true for manifest-only). */
|
|
23
|
+
readonly complete: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Pull the juror-bound delivery: one re-encrypted package per non-zero
|
|
27
|
+
* evidence hash. Base64 wire fields are decoded to bytes so each round feeds
|
|
28
|
+
* straight into `jurorDecryptDelivery`. `null` when nothing is deliverable
|
|
29
|
+
* (404 — not drawn, no bundle, or no Delivery Key registered).
|
|
30
|
+
*/
|
|
31
|
+
export declare function fetchDelivery(params: FetchDeliveryParams): Promise<DeliveredRound[] | null>;
|
|
13
32
|
export interface FetchManifestParams {
|
|
14
33
|
endpoint: string;
|
|
15
34
|
subaccord: string;
|
|
16
35
|
dispute: string;
|
|
17
36
|
round: number;
|
|
18
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Fetch the decrypted manifest (a YAML string for the `accord-evidence/v1`
|
|
40
|
+
* format, or a parsed JSON object if the plaintext was JSON). `null` when no
|
|
41
|
+
* bundle is stored for the round (404).
|
|
42
|
+
*/
|
|
19
43
|
export declare function fetchManifest(params: FetchManifestParams): Promise<unknown>;
|
|
20
44
|
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/evidence/fetch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/evidence/fetch.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAM9C,MAAM,WAAW,mBAAmB;IAClC,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,KAAK,EAAE,MAAM,CAAC;CACf;AAED,yEAAyE;AACzE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,aAAa,CAAC;CACvD;AAED;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAqBD;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC,CAgBlC;AAMD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,OAAO,CAAC,CAQlB"}
|
package/dist/evidence/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/evidence/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/evidence/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC"}
|
package/dist/evidence/index.js
CHANGED
|
@@ -116,22 +116,20 @@ async function operatorDecrypt(bundle, operatorEd25519SecretSeed) {
|
|
|
116
116
|
return aesGcmDecrypt(dek, bundle.ct);
|
|
117
117
|
}
|
|
118
118
|
__name(operatorDecrypt, "operatorDecrypt");
|
|
119
|
-
async function
|
|
119
|
+
async function deliverToDeliveryKey(plaintext, deliveryEncPub) {
|
|
120
120
|
const ephem = newX25519KeyPair();
|
|
121
|
-
const
|
|
122
|
-
const shared = x25519SharedSecret(ephem.secret, jurorX25519Pub);
|
|
121
|
+
const shared = x25519SharedSecret(ephem.secret, deliveryEncPub);
|
|
123
122
|
const kOut = await hkdfSha256(shared, te.encode(DELIVER_INFO));
|
|
124
123
|
const out = await aesGcmEncrypt(kOut, plaintext);
|
|
125
124
|
return { out, operator_ephem_pub: ephem.publicKey };
|
|
126
125
|
}
|
|
127
|
-
__name(
|
|
128
|
-
async function
|
|
129
|
-
const
|
|
130
|
-
const shared = x25519SharedSecret(jurorX25519Sk, delivered.operator_ephem_pub);
|
|
126
|
+
__name(deliverToDeliveryKey, "deliverToDeliveryKey");
|
|
127
|
+
async function jurorDecryptDelivery(delivered, deliverySecret) {
|
|
128
|
+
const shared = x25519SharedSecret(deliverySecret, delivered.operator_ephem_pub);
|
|
131
129
|
const kOut = await hkdfSha256(shared, te.encode(DELIVER_INFO));
|
|
132
130
|
return aesGcmDecrypt(kOut, delivered.out);
|
|
133
131
|
}
|
|
134
|
-
__name(
|
|
132
|
+
__name(jurorDecryptDelivery, "jurorDecryptDelivery");
|
|
135
133
|
async function verifyIntegrity(plaintext, evidenceHash) {
|
|
136
134
|
const h = await sha256(plaintext);
|
|
137
135
|
if (h.length !== evidenceHash.length) {
|
|
@@ -227,6 +225,12 @@ async function verifyOptionHashes(salt, labels, hashes) {
|
|
|
227
225
|
__name(verifyOptionHashes, "verifyOptionHashes");
|
|
228
226
|
|
|
229
227
|
// src/evidence/parse.ts
|
|
228
|
+
function scalar(item, key) {
|
|
229
|
+
const quoted = item.match(new RegExp(`${key}:\\s*"([^"]*)"`))?.[1];
|
|
230
|
+
if (quoted !== void 0) return quoted;
|
|
231
|
+
return item.match(new RegExp(`${key}:\\s*([^,}]+)`))?.[1]?.trim() ?? "";
|
|
232
|
+
}
|
|
233
|
+
__name(scalar, "scalar");
|
|
230
234
|
function parseManifest(text) {
|
|
231
235
|
const lines = text.split("\n");
|
|
232
236
|
const getField = /* @__PURE__ */ __name((key) => lines.find((l) => l.startsWith(`${key}: `))?.slice(`${key}: `.length).replace(/^"(.*)"$/, "$1"), "getField");
|
|
@@ -249,14 +253,22 @@ function parseManifest(text) {
|
|
|
249
253
|
const label = item.match(/label:\s*"([^"]*)"/)?.[1] ?? "";
|
|
250
254
|
options.push({ index, label });
|
|
251
255
|
} else if (section === "entries") {
|
|
252
|
-
const path = item
|
|
253
|
-
const sha2562 = item
|
|
256
|
+
const path = scalar(item, "path");
|
|
257
|
+
const sha2562 = scalar(item, "sha256");
|
|
254
258
|
entries.push({ path, sha256: sha2562 });
|
|
255
259
|
}
|
|
256
260
|
}
|
|
257
261
|
const descriptionRaw = getField("description");
|
|
258
|
-
|
|
262
|
+
let description = descriptionRaw ?? "";
|
|
263
|
+
if (descriptionRaw) {
|
|
264
|
+
try {
|
|
265
|
+
description = JSON.parse(`"${descriptionRaw}"`);
|
|
266
|
+
} catch {
|
|
267
|
+
description = descriptionRaw;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
259
270
|
return {
|
|
271
|
+
schema: getField("schema") ?? "",
|
|
260
272
|
title: getField("title") ?? "Untitled dispute",
|
|
261
273
|
description,
|
|
262
274
|
filedAt: getField("filed_at") ?? "\u2014",
|
|
@@ -289,7 +301,7 @@ function optionLabels(manifest) {
|
|
|
289
301
|
}
|
|
290
302
|
__name(optionLabels, "optionLabels");
|
|
291
303
|
|
|
292
|
-
// src/evidence/
|
|
304
|
+
// src/evidence/base64.ts
|
|
293
305
|
function toBase64(bytes) {
|
|
294
306
|
let binary = "";
|
|
295
307
|
for (let i = 0; i < bytes.length; i++) {
|
|
@@ -298,6 +310,17 @@ function toBase64(bytes) {
|
|
|
298
310
|
return btoa(binary);
|
|
299
311
|
}
|
|
300
312
|
__name(toBase64, "toBase64");
|
|
313
|
+
function fromBase64(s) {
|
|
314
|
+
const binary = atob(s);
|
|
315
|
+
const bytes = new Uint8Array(binary.length);
|
|
316
|
+
for (let i = 0; i < binary.length; i++) {
|
|
317
|
+
bytes[i] = binary.charCodeAt(i);
|
|
318
|
+
}
|
|
319
|
+
return bytes;
|
|
320
|
+
}
|
|
321
|
+
__name(fromBase64, "fromBase64");
|
|
322
|
+
|
|
323
|
+
// src/evidence/publish.ts
|
|
301
324
|
function equalBytes2(a, b) {
|
|
302
325
|
if (a.length !== b.length) return false;
|
|
303
326
|
return a.every((v, i) => v === b[i]);
|
|
@@ -349,7 +372,130 @@ async function verifyManifestHash(manifest, evidenceHash) {
|
|
|
349
372
|
}
|
|
350
373
|
__name(verifyManifestHash, "verifyManifestHash");
|
|
351
374
|
|
|
375
|
+
// src/evidence/delivery-key.ts
|
|
376
|
+
import { ed25519 as ed255192 } from "@noble/curves/ed25519";
|
|
377
|
+
import { getBase58Decoder } from "@solana/kit";
|
|
378
|
+
var te3 = new TextEncoder();
|
|
379
|
+
var DELKEY_PREFIX = "accord-delkey-v1";
|
|
380
|
+
function generateDeliveryKey() {
|
|
381
|
+
const pair = newX25519KeyPair();
|
|
382
|
+
return { publicKey: pair.publicKey, secretKey: pair.secret };
|
|
383
|
+
}
|
|
384
|
+
__name(generateDeliveryKey, "generateDeliveryKey");
|
|
385
|
+
function buildDeliveryKeyMessage(encPub, registeredAtMs) {
|
|
386
|
+
requireLen2(encPub, 32, "delivery enc_pub");
|
|
387
|
+
if (!Number.isSafeInteger(registeredAtMs) || registeredAtMs < 0) {
|
|
388
|
+
throw new Error(`registered_at must be a non-negative integer (ms), got ${registeredAtMs}`);
|
|
389
|
+
}
|
|
390
|
+
const b58 = getBase58Decoder().decode(encPub);
|
|
391
|
+
return te3.encode(`${DELKEY_PREFIX}
|
|
392
|
+
registered_at:${registeredAtMs}
|
|
393
|
+
enc_pub:${b58}`);
|
|
394
|
+
}
|
|
395
|
+
__name(buildDeliveryKeyMessage, "buildDeliveryKeyMessage");
|
|
396
|
+
function verifyDeliveryKeyRegistration(jurorEd25519Pub, encPub, registeredAtMs, sig) {
|
|
397
|
+
try {
|
|
398
|
+
const msg = buildDeliveryKeyMessage(encPub, registeredAtMs);
|
|
399
|
+
return ed255192.verify(sig, msg, jurorEd25519Pub);
|
|
400
|
+
} catch {
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
__name(verifyDeliveryKeyRegistration, "verifyDeliveryKeyRegistration");
|
|
405
|
+
async function registerDeliveryKey(params) {
|
|
406
|
+
const { endpoint, juror, encPub, signMessage } = params;
|
|
407
|
+
const registeredAt = Date.now();
|
|
408
|
+
const sig = await signMessage(buildDeliveryKeyMessage(encPub, registeredAt));
|
|
409
|
+
const res = await fetch(`${endpoint}/jurors/${juror}/delivery-key`, {
|
|
410
|
+
method: "PUT",
|
|
411
|
+
headers: { "content-type": "application/json" },
|
|
412
|
+
body: JSON.stringify({
|
|
413
|
+
enc_pub: toBase64(encPub),
|
|
414
|
+
registered_at: registeredAt,
|
|
415
|
+
sig: toBase64(sig)
|
|
416
|
+
})
|
|
417
|
+
});
|
|
418
|
+
if (res.status !== 201) {
|
|
419
|
+
const body = await res.text().catch(() => "");
|
|
420
|
+
throw new Error(`delivery-key registration failed: ${res.status} ${body}`);
|
|
421
|
+
}
|
|
422
|
+
return { encPub, registeredAt };
|
|
423
|
+
}
|
|
424
|
+
__name(registerDeliveryKey, "registerDeliveryKey");
|
|
425
|
+
async function getRegisteredDeliveryKey(params) {
|
|
426
|
+
const res = await fetch(`${params.endpoint}/jurors/${params.juror}/delivery-key`);
|
|
427
|
+
if (res.status === 404) return null;
|
|
428
|
+
if (!res.ok) throw new Error(`evidence daemon returned ${res.status}`);
|
|
429
|
+
const body = await res.json();
|
|
430
|
+
if (typeof body.enc_pub !== "string" || typeof body.registered_at !== "number") {
|
|
431
|
+
throw new Error("delivery-key response malformed");
|
|
432
|
+
}
|
|
433
|
+
return { encPub: fromBase64(body.enc_pub), registeredAt: body.registered_at };
|
|
434
|
+
}
|
|
435
|
+
__name(getRegisteredDeliveryKey, "getRegisteredDeliveryKey");
|
|
436
|
+
async function ensureRegisteredDeliveryKey(params) {
|
|
437
|
+
const current = await getRegisteredDeliveryKey(params);
|
|
438
|
+
if (current !== null && current.encPub.length === params.encPub.length && current.encPub.every((b, i) => b === params.encPub[i])) {
|
|
439
|
+
return "current";
|
|
440
|
+
}
|
|
441
|
+
await registerDeliveryKey(params);
|
|
442
|
+
return "re-registered";
|
|
443
|
+
}
|
|
444
|
+
__name(ensureRegisteredDeliveryKey, "ensureRegisteredDeliveryKey");
|
|
445
|
+
function encodeDeliveryKeypair(kp) {
|
|
446
|
+
requireLen2(kp.publicKey, 32, "delivery public key");
|
|
447
|
+
requireLen2(kp.secretKey, 32, "delivery secret key");
|
|
448
|
+
const out = new Uint8Array(64);
|
|
449
|
+
out.set(kp.publicKey, 0);
|
|
450
|
+
out.set(kp.secretKey, 32);
|
|
451
|
+
return out;
|
|
452
|
+
}
|
|
453
|
+
__name(encodeDeliveryKeypair, "encodeDeliveryKeypair");
|
|
454
|
+
function decodeDeliveryKeypair(bytes) {
|
|
455
|
+
requireLen2(bytes, 64, "serialized delivery keypair");
|
|
456
|
+
return { publicKey: bytes.slice(0, 32), secretKey: bytes.slice(32) };
|
|
457
|
+
}
|
|
458
|
+
__name(decodeDeliveryKeypair, "decodeDeliveryKeypair");
|
|
459
|
+
async function loadOrCreateDeliveryKey(storage) {
|
|
460
|
+
const stored = await storage.get();
|
|
461
|
+
if (stored !== null) return decodeDeliveryKeypair(stored);
|
|
462
|
+
const kp = generateDeliveryKey();
|
|
463
|
+
await storage.set(encodeDeliveryKeypair(kp));
|
|
464
|
+
return kp;
|
|
465
|
+
}
|
|
466
|
+
__name(loadOrCreateDeliveryKey, "loadOrCreateDeliveryKey");
|
|
467
|
+
function requireLen2(b, n, what) {
|
|
468
|
+
if (b.length !== n) {
|
|
469
|
+
throw new Error(`${what} must be ${n} bytes, got ${b.length}`);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
__name(requireLen2, "requireLen");
|
|
473
|
+
|
|
352
474
|
// src/evidence/fetch.ts
|
|
475
|
+
function isWireRound(v) {
|
|
476
|
+
if (v === null || typeof v !== "object") return false;
|
|
477
|
+
const r = v;
|
|
478
|
+
return typeof r["round"] === "number" && typeof r["out"] === "string" && typeof r["operator_ephem_pub"] === "string" && (r["files"] === void 0 || Array.isArray(r["files"])) && (r["complete"] === void 0 || typeof r["complete"] === "boolean");
|
|
479
|
+
}
|
|
480
|
+
__name(isWireRound, "isWireRound");
|
|
481
|
+
async function fetchDelivery(params) {
|
|
482
|
+
const { endpoint, dispute, juror } = params;
|
|
483
|
+
const res = await fetch(`${endpoint}/evidence/${dispute}/for/${juror}`);
|
|
484
|
+
if (res.status === 404) return null;
|
|
485
|
+
if (!res.ok) throw new Error(`evidence daemon returned ${res.status}`);
|
|
486
|
+
const body = await res.json();
|
|
487
|
+
if (!Array.isArray(body.rounds) || !body.rounds.every(isWireRound)) {
|
|
488
|
+
throw new Error("delivery response malformed");
|
|
489
|
+
}
|
|
490
|
+
return body.rounds.map((r) => ({
|
|
491
|
+
round: r.round,
|
|
492
|
+
out: fromBase64(r.out),
|
|
493
|
+
operator_ephem_pub: fromBase64(r.operator_ephem_pub),
|
|
494
|
+
files: r.files ?? [],
|
|
495
|
+
complete: r.complete ?? true
|
|
496
|
+
}));
|
|
497
|
+
}
|
|
498
|
+
__name(fetchDelivery, "fetchDelivery");
|
|
353
499
|
async function fetchManifest(params) {
|
|
354
500
|
const { endpoint, subaccord, dispute, round } = params;
|
|
355
501
|
const res = await fetch(
|
|
@@ -362,28 +508,39 @@ async function fetchManifest(params) {
|
|
|
362
508
|
__name(fetchManifest, "fetchManifest");
|
|
363
509
|
export {
|
|
364
510
|
DELIVER_INFO,
|
|
511
|
+
DELKEY_PREFIX,
|
|
365
512
|
INGEST_INFO,
|
|
366
513
|
SHA256_ZERO,
|
|
367
514
|
aesGcmDecrypt,
|
|
368
515
|
aesGcmEncrypt,
|
|
516
|
+
buildDeliveryKeyMessage,
|
|
369
517
|
buildManifest,
|
|
370
518
|
claimantEncrypt,
|
|
371
|
-
|
|
519
|
+
decodeDeliveryKeypair,
|
|
520
|
+
deliverToDeliveryKey,
|
|
372
521
|
deriveOptionHashes,
|
|
373
522
|
ed25519PublicKeyFromSeed,
|
|
374
523
|
ed25519SecretToX25519,
|
|
375
524
|
ed25519ToX25519PublicKey,
|
|
525
|
+
encodeDeliveryKeypair,
|
|
526
|
+
ensureRegisteredDeliveryKey,
|
|
527
|
+
fetchDelivery,
|
|
376
528
|
fetchManifest,
|
|
529
|
+
generateDeliveryKey,
|
|
377
530
|
generateSalt,
|
|
531
|
+
getRegisteredDeliveryKey,
|
|
378
532
|
hkdfSha256,
|
|
379
|
-
|
|
533
|
+
jurorDecryptDelivery,
|
|
534
|
+
loadOrCreateDeliveryKey,
|
|
380
535
|
newX25519KeyPair,
|
|
381
536
|
operatorDecrypt,
|
|
382
537
|
optionLabels,
|
|
383
538
|
parseManifest,
|
|
384
539
|
publishEvidence,
|
|
385
540
|
publishSynodEvidence,
|
|
541
|
+
registerDeliveryKey,
|
|
386
542
|
sha256,
|
|
543
|
+
verifyDeliveryKeyRegistration,
|
|
387
544
|
verifyIntegrity,
|
|
388
545
|
verifyManifestHash,
|
|
389
546
|
verifyOptionHashes,
|