@ghostlytools/sdk 1.7.3 → 1.8.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.
Files changed (34) hide show
  1. package/dist/core.js +2 -2
  2. package/dist/{fakes-NFHnJNv8.js → fakes-DSeGiDvk.js} +2 -2
  3. package/dist/fakes-DSeGiDvk.js.map +1 -0
  4. package/dist/fakes.js +1 -1
  5. package/dist/index.js +2 -2
  6. package/dist/{keet-identity-key-740ESaV_.js → keet-identity-key-Db5KY0V1.js} +2 -2
  7. package/dist/{keet-identity-key-740ESaV_.js.map → keet-identity-key-Db5KY0V1.js.map} +1 -1
  8. package/dist/{src-Dw-9Vq6U.js → src-CfpOdLVf.js} +1435 -236
  9. package/dist/src-CfpOdLVf.js.map +1 -0
  10. package/dist/testing.js +3 -3
  11. package/dist/types/browser/src/shared/features.d.ts +5 -0
  12. package/dist/types/browser/src/shared/mints.d.ts +6 -0
  13. package/dist/types/core/src/chatFiles.d.ts +18 -1
  14. package/dist/types/core/src/dhtDelivery.d.ts +51 -0
  15. package/dist/types/core/src/domainProofs.d.ts +3 -2
  16. package/dist/types/core/src/engineErrors.d.ts +5 -1
  17. package/dist/types/core/src/ghostlink.d.ts +24 -5
  18. package/dist/types/core/src/groupCommunity.d.ts +42 -4
  19. package/dist/types/core/src/groupSession.d.ts +6 -2
  20. package/dist/types/core/src/identityProofs.d.ts +1 -0
  21. package/dist/types/core/src/identityTimeline.d.ts +1 -1
  22. package/dist/types/core/src/image.d.ts +2 -1
  23. package/dist/types/core/src/index.d.ts +1 -0
  24. package/dist/types/core/src/link.d.ts +13 -0
  25. package/dist/types/core/src/linkPreview.d.ts +8 -4
  26. package/dist/types/core/src/pairedApps.d.ts +10 -5
  27. package/dist/types/core/src/ratchet.d.ts +201 -0
  28. package/dist/types/core/src/relay.d.ts +28 -2
  29. package/dist/types/core/src/storeForward.d.ts +32 -11
  30. package/dist/{verify-chCUPRKH.js → verify-C-u4HILn.js} +2 -2
  31. package/dist/{verify-chCUPRKH.js.map → verify-C-u4HILn.js.map} +1 -1
  32. package/package.json +1 -1
  33. package/dist/fakes-NFHnJNv8.js.map +0 -1
  34. package/dist/src-Dw-9Vq6U.js.map +0 -1
@@ -0,0 +1,201 @@
1
+ /**
2
+ * The ratchet of a 1:1 chat's stored paths (WISP 4xx-ratchet, reserved number 407): what goes on the DHT floor
3
+ * (WISP 403) and what is held (WISP 404) is sealed with a key used once, from a double ratchet in the manner of
4
+ * Signal's (an X25519 step each time the turn passes, a one-way chain per message), so a participation key stolen
5
+ * later opens none of it once the turn has passed. The live session needs none: its transports agree fresh keys on
6
+ * every connection.
7
+ *
8
+ * Pure: every call takes a state and returns the next one. The caller holds one lock per chat from reading the state
9
+ * to saving the next (an open's until what it opened is stored), and saves a seal's state before the sealed bytes
10
+ * leave the device. Nothing here reads a clock or the network but through its options.
11
+ */
12
+ export declare const RATCHET_CAPABILITY: "ratchet/1";
13
+ export type RatchetLane = "floor" | "hold";
14
+ /** version, lane, session id, the sender's ratchet key, the hold lane's previous chain length, the message number. */
15
+ export declare const RATCHET_HEADER_BYTES: number;
16
+ /** What sealing adds to a plaintext: the header and the 16-byte tag (the nonce is derived, never sent). */
17
+ export declare const RATCHET_OVERHEAD: number;
18
+ /**
19
+ * How far a message may be ahead of the last one opened on its chain. A mailbox shows only its newest envelope, so the
20
+ * floor's between were replaced unread: their keys are stepped over and never kept. A held item's are kept. A sender
21
+ * whose chain reaches the bound without the turn passing starts a new session rather than seal past it.
22
+ */
23
+ export declare const MAX_SKIP: Record<RatchetLane, number>;
24
+ /** Keys kept for held items not opened yet, at most, oldest dropped first. */
25
+ export declare const MAX_SKIPPED_KEYS = 512;
26
+ /** A kept key, and a session only received on, is dropped this long after it was last of use: a held item lives 7 days. */
27
+ export declare const RATCHET_KEEP_MS: number;
28
+ /**
29
+ * A session that lost (`lost`) becomes current when its floor envelopes keep rising in sequence while the current one
30
+ * has opened no floor envelope for this long: two that started at once settle within one keep-alive (about four
31
+ * minutes), and a contact that lost its state meanwhile seals in its own session from then on.
32
+ */
33
+ export declare const FOLLOW_MS: number;
34
+ interface Chain {
35
+ k: string;
36
+ n: number;
37
+ }
38
+ interface Lanes {
39
+ floor: Chain;
40
+ hold: Chain;
41
+ }
42
+ export interface RatchetSession {
43
+ /** 8 random bytes, base64url: the session, chosen by the side that started it. */
44
+ sid: string;
45
+ rk: string;
46
+ /** This side's ratchet secret; null while it is still the participation key's (the second side, before its first step). */
47
+ dhs: string | null;
48
+ dhsPub: string;
49
+ /** The contact's ratchet key; null until its first message (the second side). */
50
+ dhr: string | null;
51
+ send: Lanes;
52
+ /** How many held items the previous sending chain used: said in every header. */
53
+ pnHold: number;
54
+ recv: Lanes | null;
55
+ /** A message of the contact's opened under this session. */
56
+ heard: boolean;
57
+ /**
58
+ * The highest floor sequence (WISP 403's, signed by the contact and kept across its restores) of an envelope opened
59
+ * under this session: what orders the contact's sessions, so an envelope from before both settled never wins.
60
+ */
61
+ floorSeq?: number;
62
+ /** When a floor envelope was last opened under it. */
63
+ floorAt?: number;
64
+ /** A session that lost when both started at once, or came from before both settled: only opened with (but `FOLLOW_MS`). */
65
+ lost?: true;
66
+ /** When this side made or first opened it. */
67
+ made: number;
68
+ /**
69
+ * The turn passed both ways: this side stepped on a key of the contact's with a ratchet secret of its own, so what
70
+ * either side seals from now on needs secrets that are deleted after use, not the participation keys.
71
+ */
72
+ fs: boolean;
73
+ at: number;
74
+ }
75
+ interface Skipped {
76
+ s: string;
77
+ d: string;
78
+ n: number;
79
+ k: string;
80
+ at: number;
81
+ }
82
+ export interface RatchetState {
83
+ v: 1;
84
+ /** The session this side seals with. */
85
+ current?: RatchetSession;
86
+ /**
87
+ * Sessions this side only opens with, newest last, at most `MAX_OTHERS`: the contact's that lost to this side's, this
88
+ * side's before the contact started anew, or one the contact had left.
89
+ */
90
+ others: RatchetSession[];
91
+ /** Hold lane only. */
92
+ skipped: Skipped[];
93
+ retired: string[];
94
+ /** A ratcheted item from the contact was opened on this lane: from then on a plain one is refused there. */
95
+ heard: {
96
+ floor?: true;
97
+ hold?: true;
98
+ };
99
+ }
100
+ export declare const emptyRatchetState: () => RatchetState;
101
+ /** What both sides of one chat derive the ratchet from: never stored in the state. */
102
+ export interface RatchetKeys {
103
+ /** This side's participation seed (Ed25519, 32 bytes). */
104
+ seed: Uint8Array;
105
+ /** Both participation keys, z-base-32. */
106
+ self: string;
107
+ peer: string;
108
+ /** The chat's two rendezvous keys, z-base-32, in either order. */
109
+ rendezvous: [string, string];
110
+ /** The invite's secret (`LinkParams.encKeyB64`). */
111
+ secret: Uint8Array;
112
+ }
113
+ export interface RatchetOptions {
114
+ now?: number;
115
+ /** For test vectors only: where random bytes come from. */
116
+ random?: (bytes: number) => Uint8Array;
117
+ }
118
+ /** The root key a session starts from: the two participation keys' agreement, salted by the invite and the chat, per session id. */
119
+ export declare const ratchetRoot: (keys: RatchetKeys, sid: Uint8Array) => Uint8Array;
120
+ /**
121
+ * Seals one item for the contact on a lane, with the current session (started here when there is none, or when its
122
+ * chain on this lane reached `MAX_SKIP` without the turn passing: past it the contact could not step over to it). The
123
+ * state returned MUST be saved before the sealed bytes leave the device: a key is used once, and a crash between the
124
+ * two that kept the old state would use it again on other bytes.
125
+ */
126
+ export declare function ratchetSeal(prev: RatchetState, keys: RatchetKeys, lane: RatchetLane, plaintext: Uint8Array, options?: RatchetOptions): {
127
+ state: RatchetState;
128
+ sealed: Uint8Array;
129
+ };
130
+ /**
131
+ * Opens an item the contact sealed. Null: not a ratcheted item of this chat on this lane, or one already opened, or
132
+ * past the bounds. Otherwise the plaintext, and `finish`, which gives the state to save once the item is stored and
133
+ * passed its path's own checks (a newer DHT sequence, a held item not taken before): those, not the ratchet, are what
134
+ * refuse a replay. `order`: a floor envelope's sequence, read from the body once opened. `fresh`: it came under a
135
+ * session this side did not know.
136
+ */
137
+ export declare function ratchetOpen(prev: RatchetState, keys: RatchetKeys, lane: RatchetLane, sealed: Uint8Array, options?: RatchetOptions): {
138
+ plaintext: Uint8Array;
139
+ fresh: boolean;
140
+ finish(order?: number): RatchetState;
141
+ } | null;
142
+ /** Whether `sealed` is shaped as a ratcheted item of this lane (it may still not open). */
143
+ export declare const isRatcheted: (sealed: Uint8Array, lane: RatchetLane) => boolean;
144
+ /** The session a ratcheted item of this lane names (its `sid`, base64url), as its header says; undefined for anything else. */
145
+ export declare const ratchetSessionOf: (sealed: Uint8Array, lane: RatchetLane) => string | undefined;
146
+ /**
147
+ * Whether `sealed` names a session this side has no state of and did not retire: neither the current one nor one of the
148
+ * others. What the contact sealed in the session it shares with a device this profile was on before (a Move, a restore:
149
+ * WISP 4xx § Several devices) is such an item, once the turn passed there; so is anything under a made-up `sid`. It says
150
+ * nothing of whether the item is genuine: only that this side could not tell, having never had the session.
151
+ */
152
+ export declare function ratchetUnknownSession(state: RatchetState | undefined, sealed: Uint8Array, lane: RatchetLane): boolean;
153
+ /** Whether forward secrecy is on for this chat: the turn passed both ways in the session this side seals with. */
154
+ export declare const ratchetOn: (state: RatchetState | undefined) => boolean;
155
+ /** Whether a lane refuses plain items from the contact: a ratcheted one opened there (WISP 4xx § Downgrade). */
156
+ export declare const ratchetHeard: (state: RatchetState | undefined, lane: RatchetLane) => boolean;
157
+ /**
158
+ * One chat's ratchet, shared by its two lanes (the DHT floor and held items): the one lock per chat of WISP 4xx §
159
+ * Saving state, and the order of saving. Every change goes through `lock`, so a seal and an open never start from the
160
+ * same state.
161
+ */
162
+ export declare class RatchetBox {
163
+ private readonly keys;
164
+ private state;
165
+ private readonly save;
166
+ private chain;
167
+ constructor(keys: () => RatchetKeys, state: RatchetState, save: (state: RatchetState) => Promise<void>);
168
+ /** Runs `fn` alone among this chat's ratchet changes; `seal` and `open` are called inside it only. */
169
+ lock<T>(fn: (box: RatchetTransaction) => Promise<T>): Promise<T>;
170
+ private transaction;
171
+ /**
172
+ * Opens without keeping anything, and without the lock: a look from another profile, or the first half of a receive
173
+ * whose content is then stored with no lock held (`commitOpen` keeps it).
174
+ */
175
+ peek(lane: RatchetLane, sealed: Uint8Array): Uint8Array | null;
176
+ /**
177
+ * The second half of a receive, once what `peek` gave is stored: opened again under the lock on the state as it is now
178
+ * (a seal or another open may have moved it meanwhile), and that state saved. False: it no longer opens (taken by a
179
+ * receive of the same item meanwhile), and nothing moved. So the lock is never held while content is stored, which
180
+ * may call back into the other lane.
181
+ */
182
+ commitOpen(lane: RatchetLane, sealed: Uint8Array, order?: number): Promise<boolean>;
183
+ heard(lane: RatchetLane): boolean;
184
+ /** A ratcheted item from the contact opened on either lane: this side seals with the ratchet whatever the contact's record says. */
185
+ get heardAny(): boolean;
186
+ get on(): boolean;
187
+ /** The session this side seals with now, if any (its `sid`). */
188
+ get session(): string | undefined;
189
+ /** `ratchetUnknownSession` on the state as it is: an item under a session this side never had. */
190
+ unknownSession(lane: RatchetLane, sealed: Uint8Array): boolean;
191
+ }
192
+ export interface RatchetTransaction {
193
+ seal(lane: RatchetLane, plaintext: Uint8Array): Promise<Uint8Array>;
194
+ /** `commit(order)`: a floor envelope's sequence, as `ratchetOpen`'s `finish`. */
195
+ open(lane: RatchetLane, sealed: Uint8Array): {
196
+ plaintext: Uint8Array;
197
+ fresh: boolean;
198
+ commit(order?: number): Promise<void>;
199
+ } | null;
200
+ }
201
+ export {};
@@ -31,6 +31,14 @@ export declare const REQUESTS_PER_MINUTE = 30;
31
31
  * signaling cannot wait, and a burst of signaling does not hold the background ones back afterwards.
32
32
  */
33
33
  export declare const BACKGROUND_REQUESTS_PER_MINUTE = 20;
34
+ /**
35
+ * Of the background share, what background writes may spend in a minute on a relay (10 of the 20): the rest is kept
36
+ * for background reads. Those writes are mostly the upkeep of chats whose contacts are away (the link's heartbeat, the
37
+ * DHT floor's keep-alive, the capability record), about one a minute for every two chats. A profile with 200 such chats
38
+ * spent the share on them, and on one relay 147 of its 200 contacts were not read once in 25 minutes: a contact back
39
+ * then went unnoticed (bug hunt, 2026-11-01). Upkeep held back goes when a request of this share frees.
40
+ */
41
+ export declare const BACKGROUND_WRITES_SHARE: number;
34
42
  /**
35
43
  * A link's write the budget refused (its presence, its offer, its answer) goes first when the minute
36
44
  * frees a request: reads on that relay wait this long after the refusal. A link that polls fast for a
@@ -236,6 +244,11 @@ export interface RelayTransportOptions {
236
244
  log?: (line: string) => void;
237
245
  }
238
246
  export declare function normalizeRelayUrl(input: string): string | null;
247
+ /**
248
+ * Why a line of a Pkarr relay list is not a relay `normalizeRelayUrl` keeps, with the line as typed; null when it is
249
+ * one. A host alone or another scheme (`relay.example.org`, `wss://…`) was meant as an https:// relay.
250
+ */
251
+ export declare function relayUrlProblem(input: string): string | null;
239
252
  /**
240
253
  * A read the relays failed (or left alone for failing before), when its caller has another path to ask
241
254
  * (`RelayTransport.resolve` with `keptOnFailure` false): `kept` is the newest packet the relays gave for the key before.
@@ -273,6 +286,8 @@ export declare class RelayTransport implements PkarrTransport {
273
286
  private readonly lastReadFrom;
274
287
  private readonly spent;
275
288
  private readonly spentBackground;
289
+ /** Background writes on each relay in the last minute (`BACKGROUND_WRITES_SHARE`). */
290
+ private readonly spentBackgroundWrites;
276
291
  /** Groups' urgent reads on each relay in the last `GROUP_BURST_MS`. */
277
292
  private readonly spentGroupUrgent;
278
293
  /** Watch reads on each relay in the last `GROUP_RATION_WINDOW_MS` (`WATCH_SHARE`). */
@@ -306,9 +321,11 @@ export declare class RelayTransport implements PkarrTransport {
306
321
  /**
307
322
  * Per key a 1:1 chat asks for: when it last read urgently (for the next minute, groups leave it `CHAT_RESERVE` on
308
323
  * every relay) and when the budget last refused it on each relay (the same, on that relay). A read of the key at a
309
- * slow pace (the chat is live, or back in the background) drops it: `CHAT_RESERVE`.
324
+ * slow pace (the chat is live, or back in the background) drops it: `CHAT_RESERVE`. Per relay, the later of the two
325
+ * for each key (`chatNeed`); `chatUrgentAt` keeps the urgent ones for a relay not asked yet.
310
326
  */
311
327
  private readonly chatNeeds;
328
+ private readonly chatUrgentAt;
312
329
  /** When a link (a chat's or a group's) last asked urgently: background requests yield for `SIGNALING_WINDOW_MS`. */
313
330
  private urgentAt;
314
331
  /** Timestamp of the last packet sent to each relay, per key: the compare-and-swap value for the next one. */
@@ -533,8 +550,17 @@ export declare class RelayTransport implements PkarrTransport {
533
550
  private departedReads;
534
551
  /** One more, the contacts with none in the last minute dropped. */
535
552
  private departedOverAdd;
553
+ /** A chat's request of `key` asked urgently (it needs every relay), or the budget refused it on `relay` (it needs that one). */
536
554
  private chatNeed;
537
- /** How long groups still leave a chat its reserve on this relay (`CHAT_RESERVE`); a chat's need a minute old goes. */
555
+ /** The chats that need this relay: those a request of was refused there, and the urgent ones. */
556
+ private chatNeedsOn;
557
+ /** The chat reading `key` has nothing due: it needs no relay any more. */
558
+ private chatNeedLapsed;
559
+ /**
560
+ * How long groups still leave a chat its reserve on this relay (`CHAT_RESERVE`); a chat's need a minute old goes.
561
+ * Kept up to date as needs come and go (`RecentKeys`): walking them all for each request cost a daemon with 500
562
+ * contacts away 2.7 s of CPU per 10 idle minutes (bug hunt, 2026-11-01).
563
+ */
538
564
  private chatReservedFor;
539
565
  /**
540
566
  * How long a chat's packet another relay already took waits for this one: while chats need the relays, a copy takes
@@ -38,6 +38,15 @@ export declare const HOLD_LIMITS: {
38
38
  */
39
39
  export declare const HOLD_DATED_BACK_MS: number;
40
40
  export type HoldKind = "text" | "file" | "pay-req" | "manifest";
41
+ type HoldItem = {
42
+ mailbox: string;
43
+ seq: number;
44
+ id: string;
45
+ ts: number;
46
+ kind: HoldKind;
47
+ meta?: unknown;
48
+ expires: number;
49
+ };
41
50
  export interface HoldFileMeta {
42
51
  name: string;
43
52
  size: number;
@@ -80,8 +89,10 @@ export interface HoldPointer {
80
89
  }
81
90
  /** Why a bundle, manifest or pointer was refused. Never a reason to trust it a little. */
82
91
  export declare class HoldRefusedError extends Error {
83
- readonly reason: "size" | "format" | "tampered" | "not-for-me" | "author" | "signature" | "digest" | "limits" | "expired";
84
- constructor(reason: "size" | "format" | "tampered" | "not-for-me" | "author" | "signature" | "digest" | "limits" | "expired", message: string);
92
+ readonly reason: "size" | "format" | "tampered" | "not-for-me" | "author" | "signature" | "digest" | "limits" | "expired" | "plain";
93
+ /** The bytes the chat's ratchet opened, when it opened them before the item was refused: the caller commits them. */
94
+ ratcheted?: Uint8Array;
95
+ constructor(reason: "size" | "format" | "tampered" | "not-for-me" | "author" | "signature" | "digest" | "limits" | "expired" | "plain", message: string);
85
96
  }
86
97
  declare const newMailbox: () => string;
87
98
  export { newMailbox as newHoldMailbox };
@@ -102,29 +113,39 @@ export declare class HoldKeys {
102
113
  private readonly sealKey;
103
114
  constructor(params: LinkParams, participationSeedB64: string, peerKey: string);
104
115
  /** Seals one item for the contact: signed with my participation key, encrypted to our shared key. */
105
- seal(item: {
106
- mailbox: string;
107
- seq: number;
108
- id: string;
109
- ts: number;
110
- kind: HoldKind;
111
- meta?: unknown;
112
- expires: number;
113
- }, body: Uint8Array): Uint8Array;
116
+ seal(item: HoldItem, body: Uint8Array): Uint8Array;
117
+ /**
118
+ * The same item as a version-2 bundle (WISP 4xx § Held items): the same plaintext, sealed by the chat's ratchet
119
+ * (`seal`, which saves the ratchet's state before it returns), so the bundle can be uploaded once this returns.
120
+ */
121
+ sealRatcheted(item: HoldItem, body: Uint8Array, seal: (plaintext: Uint8Array) => Promise<Uint8Array>): Promise<Uint8Array>;
122
+ /** What a bundle seals: the header's length, the signed header, the body. */
123
+ private inner;
114
124
  /**
115
125
  * Opens a bundle the contact sealed for me. Everything is checked before anything is returned: the
116
126
  * authenticated encryption, the header's shape, that it names this link, this contact and me, the
117
127
  * signature, the body digest and the limits of its kind. `loopback`: see `isHoldUrl`.
118
128
  */
129
+ /**
130
+ * `ratchet`: opens a version-2 bundle's sealed bytes (WISP 4xx), without keeping anything; absent, one is from a newer
131
+ * Ghostly. `refusePlain`: a ratcheted item from this contact opened here, so a version-1 item other than the manifest is
132
+ * refused (WISP 4xx § Downgrade). `ratcheted` in the result: the bytes the ratchet opened, for the caller to commit once
133
+ * the item is stored.
134
+ */
119
135
  open(bytes: Uint8Array, expect?: {
120
136
  maxBytes?: number;
121
137
  mailbox?: string;
122
138
  now?: number;
123
139
  loopback?: boolean;
140
+ ratchet?: (sealed: Uint8Array) => Uint8Array | null;
141
+ refusePlain?: boolean;
124
142
  }): {
125
143
  header: HoldHeader;
126
144
  body: Uint8Array;
145
+ ratcheted?: Uint8Array;
127
146
  };
147
+ /** The checks of `open` once the bundle is decrypted. */
148
+ private read;
128
149
  /** My pointer, as records to publish under `identity`. Throws when it cannot fit a packet. */
129
150
  pointerRecords(pointer: HoldPointer, now?: number): GhostRecord[];
130
151
  /**
@@ -1,4 +1,4 @@
1
- import { Xu as boundVerifiedIdentity } from "./src-Dw-9Vq6U.js";
1
+ import { Zu as boundVerifiedIdentity } from "./src-CfpOdLVf.js";
2
2
  //#region ../browser/src/proofs/verify.ts
3
3
  var DAY = 86400;
4
4
  /**
@@ -103,4 +103,4 @@ function boundedIdentityFetch(options = { online: () => true }) {
103
103
  //#endregion
104
104
  export { verifyIdentity as i, boundedIdentityFetch as n, descriptorProblems as r, availableSigners as t };
105
105
 
106
- //# sourceMappingURL=verify-chCUPRKH.js.map
106
+ //# sourceMappingURL=verify-C-u4HILn.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"verify-chCUPRKH.js","names":[],"sources":["../../browser/src/proofs/verify.ts"],"sourcesContent":["import { boundVerifiedIdentity, IDENTITY_MAX_EVIDENCE, IDENTITY_MAX_VALIDITY, type IdentityStatement, type VerifiedIdentity } from \"@ghostly/core\";\nimport type { IdentityFetch, IdentityProofProvider, IdentitySigner, VerifyContext } from \"./contract\";\n\nconst DAY = 86_400;\n\n/**\n * The checks every proof goes through, whatever its provider: known provider, validity within the\n * provider's limit, bounded evidence, strict parsing, the provider's own check, and the category rule\n * (a self-custodied proof proves exactly the subject it names; an attested one says who attests it).\n * The engine verifies a contact's proof, and the person's own proof before saving it, only through this.\n */\nexport async function verifyIdentity(providers: readonly IdentityProofProvider[], statement: IdentityStatement, evidence: unknown, ctx: VerifyContext): Promise<VerifiedIdentity> {\n const { binding } = statement;\n const provider = providers.find(p => p.id === binding.provider);\n if (!provider) throw new Error(\"This app cannot verify this kind of identity\");\n if (binding.expiresAt - binding.issuedAt > Math.min(provider.validity.maxDays * DAY, IDENTITY_MAX_VALIDITY)) throw new Error(\"The proof lasts longer than this kind of identity allows\");\n if (JSON.stringify(evidence ?? null).length > IDENTITY_MAX_EVIDENCE) throw new Error(\"Evidence too large\");\n const parsed = provider.parseEvidence(evidence);\n const verified = boundVerifiedIdentity(await provider.verify(statement, parsed, ctx));\n if (provider.category === \"self-custodied\" && verified.subject !== binding.subject) throw new Error(\"The evidence is for another identity\");\n if (provider.category === \"provider-attested\" && !verified.attester) throw new Error(\"The evidence does not say who attests it\");\n return verified;\n}\n\n/** Problems with a provider's descriptor, empty when it is well-formed. The registry and the contract suite use it. */\nexport function descriptorProblems(p: IdentityProofProvider): string[] {\n const problems: string[] = [];\n if (!/^[a-z][a-z0-9-]{0,31}$/.test(p.id)) problems.push(\"id must match ^[a-z][a-z0-9-]{0,31}$\");\n if (!p.label?.trim()) problems.push(\"label is empty\");\n if (!p.description?.trim()) problems.push(\"description is empty\");\n if (!p.privacy?.trim()) problems.push(\"privacy is empty: say what verify contacts\");\n if (p.category !== \"self-custodied\" && p.category !== \"provider-attested\") problems.push(\"category is unknown\");\n if (!p.platforms.length) problems.push(\"no platforms\");\n const { defaultDays, maxDays } = p.validity;\n if (!(Number.isInteger(defaultDays) && Number.isInteger(maxDays) && defaultDays >= 1 && defaultDays <= maxDays && maxDays * DAY <= IDENTITY_MAX_VALIDITY)) problems.push(\"validity must be whole days, 1 ≤ default ≤ max ≤ 400\");\n if (p.recheck && !(Number.isInteger(p.recheck.afterSeconds) && p.recheck.afterSeconds >= 60)) problems.push(\"recheck.afterSeconds must be at least 60\");\n if (!p.signers.length) problems.push(\"no signers\");\n const ids = p.signers.map(s => s.id);\n if (new Set(ids).size !== ids.length) problems.push(\"signer ids are not unique\");\n for (const s of p.signers as readonly IdentitySigner<unknown>[]) {\n if (![\"in-app\", \"external-tool\", \"redirect\", \"publish\"].includes(s.kind)) problems.push(`signer ${s.id} has an unknown kind`);\n if (s.kind === \"in-app\" && typeof s.run !== \"function\") problems.push(`signer ${s.id} has no run()`);\n if (s.kind === \"external-tool\" && (typeof s.instructions !== \"function\" || typeof s.parse !== \"function\")) problems.push(`signer ${s.id} needs instructions() and parse()`);\n if (s.kind === \"redirect\" && typeof s.start !== \"function\") problems.push(`signer ${s.id} has no start()`);\n if (s.kind === \"publish\" && (typeof s.instructions !== \"function\" || typeof s.evidence !== \"function\")) problems.push(`signer ${s.id} needs instructions() and evidence()`);\n }\n return problems;\n}\n\n/** Signers of a provider that run on this platform and are available in this window. */\nexport function availableSigners<E>(p: IdentityProofProvider<E>, platform: IdentityProofProvider[\"platforms\"][number]): IdentitySigner<E>[] {\n return p.signers.filter(s => (s.platforms ?? p.platforms).includes(platform) && (s.available?.() ?? true));\n}\n\n/**\n * The engine's `ctx.fetch`: HTTPS GET only, no credentials or referrer, a time-out, a size cap,\n * redirects refused unless asked for.\n * `online` false refuses everything (the person turned the network off).\n */\nexport function boundedIdentityFetch(options: { online: () => boolean; timeoutMs?: number; fetcher?: typeof fetch } = { online: () => true }): IdentityFetch {\n return async (url, { headers, maxBytes = 64 * 1024, signal, redirect = \"error\" } = {}) => {\n if (!options.online()) throw new Error(\"Offline: this identity cannot be checked now\");\n const target = new URL(url);\n if (target.protocol !== \"https:\" || target.username || target.password) throw new Error(\"Identity checks use HTTPS only\");\n const timeout = AbortSignal.timeout(options.timeoutMs ?? 10_000);\n const response = await (options.fetcher ?? fetch)(target.href, {\n headers, signal: signal ? AbortSignal.any([signal, timeout]) : timeout,\n credentials: \"omit\", referrerPolicy: \"no-referrer\", cache: \"no-store\", redirect,\n });\n if (Number(response.headers.get(\"content-length\")) > maxBytes) throw new Error(\"Identity check response too large\");\n const reader = response.body?.getReader();\n const parts: Uint8Array[] = [];\n let length = 0;\n if (reader) {\n try {\n for (;;) {\n const { done, value } = await reader.read();\n if (done) break;\n length += value.length;\n if (length > maxBytes) throw new Error(\"Identity check response too large\");\n parts.push(value);\n }\n } finally { await reader.cancel().catch(() => {}); }\n }\n const bytes = new Uint8Array(length);\n let offset = 0;\n for (const part of parts) { bytes.set(part, offset); offset += part.length; }\n return { status: response.status, contentType: response.headers.get(\"content-type\") ?? \"\", text: new TextDecoder().decode(bytes), bytes };\n };\n}\n"],"mappings":";;AAGA,IAAM,MAAM;;;;;;;AAQZ,eAAsB,eAAe,WAA6C,WAA8B,UAAmB,KAA+C;CAChL,MAAM,EAAE,YAAY;CACpB,MAAM,WAAW,UAAU,MAAK,MAAK,EAAE,OAAO,QAAQ,QAAQ;CAC9D,IAAI,CAAC,UAAU,MAAM,IAAI,MAAM,8CAA8C;CAC7E,IAAI,QAAQ,YAAY,QAAQ,WAAW,KAAK,IAAI,SAAS,SAAS,UAAU,KAAA,MAA0B,GAAG,MAAM,IAAI,MAAM,0DAA0D;CACvL,IAAI,KAAK,UAAU,YAAY,IAAI,CAAC,CAAC,SAAA,OAAgC,MAAM,IAAI,MAAM,oBAAoB;CACzG,MAAM,SAAS,SAAS,cAAc,QAAQ;CAC9C,MAAM,WAAW,sBAAsB,MAAM,SAAS,OAAO,WAAW,QAAQ,GAAG,CAAC;CACpF,IAAI,SAAS,aAAa,oBAAoB,SAAS,YAAY,QAAQ,SAAS,MAAM,IAAI,MAAM,sCAAsC;CAC1I,IAAI,SAAS,aAAa,uBAAuB,CAAC,SAAS,UAAU,MAAM,IAAI,MAAM,0CAA0C;CAC/H,OAAO;AACT;;AAGA,SAAgB,mBAAmB,GAAoC;CACrE,MAAM,WAAqB,CAAC;CAC5B,IAAI,CAAC,yBAAyB,KAAK,EAAE,EAAE,GAAG,SAAS,KAAK,sCAAsC;CAC9F,IAAI,CAAC,EAAE,OAAO,KAAK,GAAG,SAAS,KAAK,gBAAgB;CACpD,IAAI,CAAC,EAAE,aAAa,KAAK,GAAG,SAAS,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AAM,QAAQ,IAAI,WAAW,MAAM;EACnC,IAAI,SAAS;EACb,KAAK,MAAM,QAAQ,OAAO;GAAE,MAAM,IAAI,MAAM,MAAM;GAAG,UAAU,KAAK;EAAQ;EAC5E,OAAO;GAAE,QAAQ,SAAS;GAAQ,aAAa,SAAS,QAAQ,IAAI,cAAc,KAAK;GAAI,MAAM,IAAI,YAAY,CAAC,CAAC,OAAO,KAAK;GAAG;EAAM;CAC1I;AACF"}
1
+ {"version":3,"file":"verify-C-u4HILn.js","names":[],"sources":["../../browser/src/proofs/verify.ts"],"sourcesContent":["import { boundVerifiedIdentity, IDENTITY_MAX_EVIDENCE, IDENTITY_MAX_VALIDITY, type IdentityStatement, type VerifiedIdentity } from \"@ghostly/core\";\nimport type { IdentityFetch, IdentityProofProvider, IdentitySigner, VerifyContext } from \"./contract\";\n\nconst DAY = 86_400;\n\n/**\n * The checks every proof goes through, whatever its provider: known provider, validity within the\n * provider's limit, bounded evidence, strict parsing, the provider's own check, and the category rule\n * (a self-custodied proof proves exactly the subject it names; an attested one says who attests it).\n * The engine verifies a contact's proof, and the person's own proof before saving it, only through this.\n */\nexport async function verifyIdentity(providers: readonly IdentityProofProvider[], statement: IdentityStatement, evidence: unknown, ctx: VerifyContext): Promise<VerifiedIdentity> {\n const { binding } = statement;\n const provider = providers.find(p => p.id === binding.provider);\n if (!provider) throw new Error(\"This app cannot verify this kind of identity\");\n if (binding.expiresAt - binding.issuedAt > Math.min(provider.validity.maxDays * DAY, IDENTITY_MAX_VALIDITY)) throw new Error(\"The proof lasts longer than this kind of identity allows\");\n if (JSON.stringify(evidence ?? null).length > IDENTITY_MAX_EVIDENCE) throw new Error(\"Evidence too large\");\n const parsed = provider.parseEvidence(evidence);\n const verified = boundVerifiedIdentity(await provider.verify(statement, parsed, ctx));\n if (provider.category === \"self-custodied\" && verified.subject !== binding.subject) throw new Error(\"The evidence is for another identity\");\n if (provider.category === \"provider-attested\" && !verified.attester) throw new Error(\"The evidence does not say who attests it\");\n return verified;\n}\n\n/** Problems with a provider's descriptor, empty when it is well-formed. The registry and the contract suite use it. */\nexport function descriptorProblems(p: IdentityProofProvider): string[] {\n const problems: string[] = [];\n if (!/^[a-z][a-z0-9-]{0,31}$/.test(p.id)) problems.push(\"id must match ^[a-z][a-z0-9-]{0,31}$\");\n if (!p.label?.trim()) problems.push(\"label is empty\");\n if (!p.description?.trim()) problems.push(\"description is empty\");\n if (!p.privacy?.trim()) problems.push(\"privacy is empty: say what verify contacts\");\n if (p.category !== \"self-custodied\" && p.category !== \"provider-attested\") problems.push(\"category is unknown\");\n if (!p.platforms.length) problems.push(\"no platforms\");\n const { defaultDays, maxDays } = p.validity;\n if (!(Number.isInteger(defaultDays) && Number.isInteger(maxDays) && defaultDays >= 1 && defaultDays <= maxDays && maxDays * DAY <= IDENTITY_MAX_VALIDITY)) problems.push(\"validity must be whole days, 1 ≤ default ≤ max ≤ 400\");\n if (p.recheck && !(Number.isInteger(p.recheck.afterSeconds) && p.recheck.afterSeconds >= 60)) problems.push(\"recheck.afterSeconds must be at least 60\");\n if (!p.signers.length) problems.push(\"no signers\");\n const ids = p.signers.map(s => s.id);\n if (new Set(ids).size !== ids.length) problems.push(\"signer ids are not unique\");\n for (const s of p.signers as readonly IdentitySigner<unknown>[]) {\n if (![\"in-app\", \"external-tool\", \"redirect\", \"publish\"].includes(s.kind)) problems.push(`signer ${s.id} has an unknown kind`);\n if (s.kind === \"in-app\" && typeof s.run !== \"function\") problems.push(`signer ${s.id} has no run()`);\n if (s.kind === \"external-tool\" && (typeof s.instructions !== \"function\" || typeof s.parse !== \"function\")) problems.push(`signer ${s.id} needs instructions() and parse()`);\n if (s.kind === \"redirect\" && typeof s.start !== \"function\") problems.push(`signer ${s.id} has no start()`);\n if (s.kind === \"publish\" && (typeof s.instructions !== \"function\" || typeof s.evidence !== \"function\")) problems.push(`signer ${s.id} needs instructions() and evidence()`);\n }\n return problems;\n}\n\n/** Signers of a provider that run on this platform and are available in this window. */\nexport function availableSigners<E>(p: IdentityProofProvider<E>, platform: IdentityProofProvider[\"platforms\"][number]): IdentitySigner<E>[] {\n return p.signers.filter(s => (s.platforms ?? p.platforms).includes(platform) && (s.available?.() ?? true));\n}\n\n/**\n * The engine's `ctx.fetch`: HTTPS GET only, no credentials or referrer, a time-out, a size cap,\n * redirects refused unless asked for.\n * `online` false refuses everything (the person turned the network off).\n */\nexport function boundedIdentityFetch(options: { online: () => boolean; timeoutMs?: number; fetcher?: typeof fetch } = { online: () => true }): IdentityFetch {\n return async (url, { headers, maxBytes = 64 * 1024, signal, redirect = \"error\" } = {}) => {\n if (!options.online()) throw new Error(\"Offline: this identity cannot be checked now\");\n const target = new URL(url);\n if (target.protocol !== \"https:\" || target.username || target.password) throw new Error(\"Identity checks use HTTPS only\");\n const timeout = AbortSignal.timeout(options.timeoutMs ?? 10_000);\n const response = await (options.fetcher ?? fetch)(target.href, {\n headers, signal: signal ? AbortSignal.any([signal, timeout]) : timeout,\n credentials: \"omit\", referrerPolicy: \"no-referrer\", cache: \"no-store\", redirect,\n });\n if (Number(response.headers.get(\"content-length\")) > maxBytes) throw new Error(\"Identity check response too large\");\n const reader = response.body?.getReader();\n const parts: Uint8Array[] = [];\n let length = 0;\n if (reader) {\n try {\n for (;;) {\n const { done, value } = await reader.read();\n if (done) break;\n length += value.length;\n if (length > maxBytes) throw new Error(\"Identity check response too large\");\n parts.push(value);\n }\n } finally { await reader.cancel().catch(() => {}); }\n }\n const bytes = new Uint8Array(length);\n let offset = 0;\n for (const part of parts) { bytes.set(part, offset); offset += part.length; }\n return { status: response.status, contentType: response.headers.get(\"content-type\") ?? \"\", text: new TextDecoder().decode(bytes), bytes };\n };\n}\n"],"mappings":";;AAGA,IAAM,MAAM;;;;;;;AAQZ,eAAsB,eAAe,WAA6C,WAA8B,UAAmB,KAA+C;CAChL,MAAM,EAAE,YAAY;CACpB,MAAM,WAAW,UAAU,MAAK,MAAK,EAAE,OAAO,QAAQ,QAAQ;CAC9D,IAAI,CAAC,UAAU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AI,OAAO,aAAa,YAAY,OAAO,YAAY,OAAO,UAAU,MAAM,IAAI,MAAM,gCAAgC;EACxH,MAAM,UAAU,YAAY,QAAQ,QAAQ,aAAa,GAAM;EAC/D,MAAM,WAAW,OAAO,QAAQ,WAAW,MAAA,CAAO,OAAO,MAAM;GAC7D;GAAS,QAAQ,SAAS,YAAY,IAAI,CAAC,QAAQ,OAAO,CAAC,IAAI;GAC/D,aAAa;GAAQ,gBAAgB;GAAe,OAAO;GAAY;EACzE,CAAC;EACD,IAAI,OAAO,SAAS,QAAQ,IAAI,gBAAgB,CAAC,IAAI,UAAU,MAAM,IAAI,MAAM,mCAAmC;EAClH,MAAM,SAAS,SAAS,MAAM,UAAU;EACxC,MAAM,QAAsB,CAAC;EAC7B,IAAI,SAAS;EACb,IAAI,QACF,IAAI;GACF,SAAS;IACP,MAAM,EAAE,MAAM,UAAU,MAAM,OAAO,KAAK;IAC1C,IAAI,MAAM;IACV,UAAU,MAAM;IAChB,IAAI,SAAS,UAAU,MAAM,IAAI,MAAM,mCAAmC;IAC1E,MAAM,KAAK,KAAK;GAClB;EACF,UAAU;GAAE,MAAM,OAAO,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC;EAAG;EAErD,MAAM,QAAQ,IAAI,WAAW,MAAM;EACnC,IAAI,SAAS;EACb,KAAK,MAAM,QAAQ,OAAO;GAAE,MAAM,IAAI,MAAM,MAAM;GAAG,UAAU,KAAK;EAAQ;EAC5E,OAAO;GAAE,QAAQ,SAAS;GAAQ,aAAa,SAAS,QAAQ,IAAI,cAAc,KAAK;GAAI,MAAM,IAAI,YAAY,CAAC,CAAC,OAAO,KAAK;GAAG;EAAM;CAC1I;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghostlytools/sdk",
3
- "version": "1.7.3",
3
+ "version": "1.8.0",
4
4
  "type": "module",
5
5
  "description": "Build a wallet source, an identity proof, a mini-app or a client for Ghostly without reading its internals: the adapter contracts, their fakes and contract test suites, the plugin registry, and the mini-app API types (Apps run in Ghostly 1.2 and later).",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- {"version":3,"file":"fakes-NFHnJNv8.js","names":["hex"],"sources":["../../browser/src/shared/features.ts","../../browser/src/engine/paymentAdapters/providers/testing.ts","../../browser/src/proofs/testing.ts"],"sourcesContent":["/** Release policy: external identity experiments are retained for future work,\n * but must not advertise capabilities, start network lookups, or expose cached\n * external profiles. This does not gate Ghostly participation authentication. */\nexport const EXTERNAL_IDENTITIES_ENABLED: boolean = false;\n\n/** Mini-apps (WISP 1200): `apps/1` on paired sessions and the engine's `app*` calls. On from release 1.2 (a version\n * before 1.2.0 is never cut with it on: `RELEASE_GUARDS` in tools/scripts/changes.mjs). Off, nothing is offered to\n * contacts and every call is refused; a host that runs no apps pins its engine off (`NodeOptions.apps`). */\nexport const APPS_ENABLED: boolean = true;\n\n/**\n * A build that may be put into test mode: a development build (`import.meta.env.DEV`, which vitest also sets) or the\n * e2e suite's build (`VITE_APPS_TEST`, fixed when the build is made, as the mini-app switch is). A release build is\n * neither: Vite folds this to `false` there, so the storage flags the test fakes answer to are ignored. The fakes\n * themselves are still in the bundle (the registries import them); plugins may still pass fakes to the registry.\n */\nexport const testBuild = (): boolean => { try { return !!import.meta.env?.DEV || import.meta.env?.VITE_APPS_TEST === \"1\"; } catch { return false; } };\n","import { sha256 } from \"@noble/hashes/sha2.js\";\nimport { bech32 } from \"@scure/base\";\nimport { decodeBolt11 } from \"@ghostly/core\";\nimport type { InvoiceStatus, LightningInvoice, LightningPayResult, LightningPaymentRef, LightningPaymentStatus, LightningProvider, LightningProviderDescriptor } from \"./lightning\";\nimport type { OnchainBalance, OnchainPrepared, OnchainProvider, OnchainProviderDescriptor, OnchainSendRequest, OnchainTx, OnchainTxStatus } from \"./onchain\";\nimport { NothingSpentError, type ProviderField, type ProviderSettings } from \"./types\";\nimport { testBuild } from \"../../../shared/features\";\n\n/**\n * Fake providers, for unit tests and e2e: they hold regtest \"sats\" in memory, so they only ever show up in\n * the Testnet mode, and only in a dev or e2e build (`testBuild`) that has `localStorage[\"ghostly-test-providers\"]\n * === \"1\"` (or a test passes them to the registry itself); a release build ignores the key. No network, no money.\n *\n * `behaviour` drives the outcome of a spend:\n * - settle: invoices are paid by themselves after `settleMs`; payments and broadcasts succeed.\n * - refuse: a spend fails, provably before anything left (`NothingSpentError`).\n * - hang: a spend throws an unknown error, and the lookup later says it went through (a lost answer).\n */\nexport type FakeBehaviour = \"settle\" | \"refuse\" | \"hang\";\nexport const TEST_PROVIDERS_FLAG = \"ghostly-test-providers\";\n\nconst hex = (bytes: Uint8Array) => Array.from(bytes, (b) => b.toString(16).padStart(2, \"0\")).join(\"\");\nconst random = (n: number) => crypto.getRandomValues(new Uint8Array(n));\nconst uint = (value: number, length = 1) => {\n const out: number[] = [];\n for (let v = value; v > 0; v = Math.floor(v / 32)) out.unshift(v % 32);\n while (out.length < length) out.unshift(0);\n return out;\n};\n\n/** A BOLT 11 invoice on regtest with a real checksum and a blank signature: it decodes, nobody can pay it. */\nexport function fakeInvoice(amount: number, paymentHash: Uint8Array, memo = \"\", expirySeconds = 3600): string {\n const words = uint(Math.floor(Date.now() / 1000), 7);\n const field = (tag: number, data: number[]) => words.push(tag, data.length >> 5, data.length & 31, ...data);\n field(1, bech32.toWords(paymentHash));\n if (memo) field(13, bech32.toWords(new TextEncoder().encode(memo.slice(0, 100))));\n field(6, uint(expirySeconds));\n return bech32.encode(`lnbcrt${amount * 10}n`, [...words, ...new Array<number>(104).fill(0)], false);\n}\n\n/** A valid regtest P2WPKH address of nobody's. */\nexport const fakeAddress = () => bech32.encode(\"bcrt\", [0, ...bech32.toWords(random(20))]);\n\nconst FIELDS: ProviderField[] = [\n { name: \"alias\", label: \"Name\", kind: \"text\", optional: true, placeholder: \"Fake node\" },\n { name: \"token\", label: \"Access token\", kind: \"secret\", placeholder: \"anything\", help: \"Sealed like a real provider's secret; the fake only checks it is there.\" },\n { name: \"behaviour\", label: \"Spends\", kind: \"select\", optional: true, options: [{ value: \"settle\", label: \"Go through\" }, { value: \"refuse\", label: \"Are refused\" }, { value: \"hang\", label: \"Lose their answer\" }], defaults: { testnet: \"settle\" } },\n];\nconst validate = ({ secrets, config }: ProviderSettings) => {\n if (!secrets.token?.trim()) throw new Error(\"Enter an access token\");\n if (config.behaviour && ![\"settle\", \"refuse\", \"hang\"].includes(config.behaviour)) throw new Error(\"Unknown behaviour\");\n};\n\ninterface FakeOptions { alias?: string; behaviour?: FakeBehaviour; balance?: number; settleMs?: number; token?: string }\n\nexport class FakeLightningProvider implements LightningProvider {\n readonly capabilities = { receive: true, send: true, balance: true, lookup: true };\n readonly invoices = new Map<string, { invoice: LightningInvoice; paid: boolean }>();\n readonly payments = new Map<string, LightningPaymentStatus>();\n readonly paid: string[] = [];\n balance: number;\n behaviour: FakeBehaviour;\n closed = false;\n private timers: ReturnType<typeof setTimeout>[] = [];\n constructor(readonly options: FakeOptions = {}) { this.balance = options.balance ?? 100_000; this.behaviour = options.behaviour ?? \"settle\"; }\n async info() { return { network: \"regtest\" as const, alias: this.options.alias || \"Fake Lightning\", balance: this.balance }; }\n async createInvoice(amount: number, memo?: string): Promise<LightningInvoice> {\n const preimage = random(32), hash = sha256(preimage);\n const invoice: LightningInvoice = { invoice: fakeInvoice(amount, hash, memo), paymentHash: hex(hash), amount, expiresAt: Date.now() + 3600_000, ref: hex(preimage) };\n this.invoices.set(invoice.paymentHash, { invoice, paid: false });\n if (this.behaviour === \"settle\") this.timers.push(setTimeout(() => this.markPaid(invoice.paymentHash), this.options.settleMs ?? 1500));\n return invoice;\n }\n /** Someone paid this invoice. */\n markPaid(paymentHash: string) {\n const entry = this.invoices.get(paymentHash);\n if (!entry || entry.paid || this.closed) return;\n entry.paid = true; this.balance += entry.invoice.amount;\n }\n async invoiceStatus(invoice: LightningInvoice): Promise<InvoiceStatus> {\n const entry = this.invoices.get(invoice.paymentHash);\n if (entry?.paid) return { state: \"paid\", amount: entry.invoice.amount };\n return { state: invoice.expiresAt < Date.now() ? \"expired\" : \"open\" };\n }\n async estimateFee(_invoice: string, amount: number) { return Math.max(1, Math.ceil(amount / 100)); }\n async payInvoice(invoice: string, maxFee: number): Promise<LightningPayResult> {\n const decoded = decodeBolt11(invoice);\n if (!decoded?.paymentHash || decoded.amountSat === null) throw new NothingSpentError(\"Not an invoice this fake can pay\");\n const fee = Math.min(maxFee, Math.max(1, Math.ceil(decoded.amountSat / 100)));\n if (this.behaviour === \"refuse\") throw new NothingSpentError(\"No route (fake)\");\n if (this.balance < decoded.amountSat + fee) throw new NothingSpentError(\"Not enough sats in the fake wallet\");\n this.balance -= decoded.amountSat + fee;\n this.paid.push(decoded.paymentHash);\n this.payments.set(decoded.paymentHash, { state: \"paid\", fee, preimage: hex(random(32)) });\n if (this.behaviour === \"hang\") throw new Error(\"Connection lost (fake)\");\n return { state: \"paid\", fee, preimage: this.payments.get(decoded.paymentHash)!.preimage };\n }\n async paymentStatus(payment: LightningPaymentRef): Promise<LightningPaymentStatus> {\n return this.payments.get(payment.paymentHash) ?? { state: \"failed\" };\n }\n async close() { this.closed = true; for (const t of this.timers) clearTimeout(t); }\n}\n\nexport class FakeOnchainProvider implements OnchainProvider {\n readonly addresses: string[] = [];\n readonly broadcasts: string[] = [];\n readonly released: string[] = [];\n readonly txs = new Map<string, { prepared: OnchainPrepared; confirmations: number }>();\n confirmed: number;\n behaviour: FakeBehaviour;\n closed = false;\n constructor(readonly options: FakeOptions = {}) { this.confirmed = options.balance ?? 100_000; this.behaviour = options.behaviour ?? \"settle\"; }\n async info() { return { network: \"regtest\" as const, alias: this.options.alias || \"Fake Bitcoin wallet\" }; }\n async receiveAddress() { const address = fakeAddress(); this.addresses.push(address); return address; }\n async balance(): Promise<OnchainBalance> { return { confirmed: this.confirmed, unconfirmed: 0 }; }\n async prepareSend(request: OnchainSendRequest): Promise<OnchainPrepared> {\n const feeRate = request.feeRate ?? 2, fee = feeRate * 141;\n if (fee > request.feeCap) throw new Error(`The fee (${fee} sats) is above your limit`);\n if (this.confirmed < request.amount + fee) throw new Error(\"Not enough confirmed sats\");\n return { txid: hex(random(32)), address: request.address, amount: request.amount, fee, feeRate, signed: hex(random(64)) };\n }\n async broadcast(prepared: OnchainPrepared) {\n if (this.behaviour === \"refuse\") throw new NothingSpentError(\"Rejected by the node (fake)\");\n if (!this.txs.has(prepared.txid)) { this.confirmed -= prepared.amount + prepared.fee; this.txs.set(prepared.txid, { prepared, confirmations: 1 }); }\n this.broadcasts.push(prepared.txid);\n if (this.behaviour === \"hang\") throw new Error(\"Connection lost (fake)\");\n return prepared.txid;\n }\n async status(prepared: OnchainPrepared): Promise<OnchainTxStatus> {\n const tx = this.txs.get(prepared.txid);\n return tx ? { state: \"confirmed\", confirmations: tx.confirmations } : { state: \"missing\", confirmations: 0 };\n }\n async release(prepared: OnchainPrepared) { this.released.push(prepared.txid); }\n async history(limit: number): Promise<OnchainTx[]> {\n return [...this.txs.values()].reverse().slice(0, limit).map(({ prepared, confirmations }) => ({ txid: prepared.txid, amount: -prepared.amount, fee: prepared.fee, confirmations }));\n }\n async close() { this.closed = true; }\n}\n\nconst options = ({ config, secrets }: ProviderSettings): FakeOptions => ({ alias: config.alias, behaviour: (config.behaviour as FakeBehaviour) || \"settle\", token: secrets.token });\n\nexport const fakeLightning: LightningProviderDescriptor = {\n id: \"fake-lightning\",\n label: \"Fake Lightning (test)\",\n kind: \"lightning\",\n description: \"In-memory regtest node for tests. Holds nothing.\",\n networks: [\"regtest\"],\n platforms: [\"web\", \"desktop\"],\n fields: FIELDS,\n experimental: true,\n validate,\n async create(settings) { return new FakeLightningProvider(options(settings)); },\n};\n\nexport const fakeOnchain: OnchainProviderDescriptor = {\n id: \"fake-onchain\",\n label: \"Fake Bitcoin wallet (test)\",\n kind: \"onchain\",\n description: \"In-memory regtest wallet for tests. Holds nothing.\",\n networks: [\"regtest\"],\n platforms: [\"web\", \"desktop\"],\n fields: FIELDS,\n experimental: true,\n validate,\n async create(settings) { return new FakeOnchainProvider(options(settings)); },\n};\n\n/** Whether this browser asked for the fake providers (an e2e run sets it before the app starts). */\nexport function testProvidersEnabled(): boolean {\n try { return testBuild() && globalThis.localStorage?.getItem(TEST_PROVIDERS_FLAG) === \"1\"; } catch { return false; }\n}\n","import { ed25519 } from \"@noble/curves/ed25519.js\";\nimport { fromBase64Url, toBase64Url, utf8Decode, utf8Encode, type IdentityStatement } from \"@ghostly/core\";\nimport { testBuild } from \"../shared/features\";\nimport type { IdentityProofProvider } from \"./contract\";\n\n/**\n * Fake identity providers, for unit tests and e2e. No network, no real accounts. They are in the\n * registry only in a dev or e2e build (`testBuild`) that has `localStorage[\"ghostly-test-identities\"] === \"1\"`\n * (or a test passes them itself); a release build ignores the key.\n *\n * - fake-key self-custodied: an Ed25519 key held by a fake in-app signer, or signed \"outside\" and pasted.\n * - fake-account provider-attested: a fake issuer signs a token whose nonce is the statement id (like OIDC).\n * - fake-record self-custodied, published: a record the verifier fetches through `ctx.fetch` (like DNS).\n */\nexport const TEST_IDENTITIES_FLAG = \"ghostly-test-identities\";\nexport const testIdentitiesEnabled = () => { try { return testBuild() && globalThis.localStorage?.getItem(TEST_IDENTITIES_FLAG) === \"1\"; } catch { return false; } };\n\nconst HEX64 = /^[a-f0-9]{64}$/;\nconst hex = (b: Uint8Array) => Array.from(b, x => x.toString(16).padStart(2, \"0\")).join(\"\");\nconst unhex = (s: string) => Uint8Array.from(s.match(/../g)!, x => parseInt(x, 16));\nconst normalizeHexKey = (input: string) => { const v = input.trim().toLowerCase(); if (!HEX64.test(v)) throw new Error(\"Enter 64 hex characters\"); return v; };\nconst exactKeys = (raw: unknown, keys: string) => !!raw && typeof raw === \"object\" && !Array.isArray(raw) && Object.keys(raw).sort().join(\",\") === keys;\n\n/** The key behind the fake in-app signer, made on first use so a release start draws no key. Tests may replace it. */\nlet fakeSeed: Uint8Array | undefined;\nexport const fakeKeyring = { get seed() { return fakeSeed ??= ed25519.utils.randomSecretKey(); }, set seed(value: Uint8Array) { fakeSeed = value; } };\nexport const fakeKeySubject = (seed = fakeKeyring.seed) => hex(ed25519.getPublicKey(seed));\nexport const fakeKeySign = (statement: IdentityStatement, seed = fakeKeyring.seed) => ({ sig: toBase64Url(ed25519.sign(statement.bytes, seed)) });\n\nexport interface FakeKeyEvidence { sig: string }\nexport const fakeKey: IdentityProofProvider<FakeKeyEvidence> = {\n id: \"fake-key\", label: \"Test key\", category: \"self-custodied\",\n summary: \"Sign with the test key\", description: \"A test identity: an Ed25519 key held by this page. For tests only.\",\n platforms: [\"web\", \"desktop\"],\n subject: { label: \"Public key\", placeholder: \"64 hex characters\", normalize: normalizeHexKey, short: k => `${k.slice(0, 8)}…${k.slice(-4)}` },\n publicUri: k => `urn:ghostly-test:${k}`,\n validity: { defaultDays: 30, maxDays: 365 },\n privacy: \"Nothing: checked on this device.\",\n signers: [\n { id: \"fake-signer\", kind: \"in-app\", label: \"Test signer\", fields: [{ name: \"refuse\", label: \"Refuse\", kind: \"text\", optional: true }],\n run: async (ctx, work) => {\n ctx.signal.throwIfAborted();\n if (ctx.values.refuse) throw new Error(\"The test signer refused\");\n return work({ subject: async () => fakeKeySubject(), sign: async statement => fakeKeySign(statement) });\n } },\n { id: \"fake-tool\", kind: \"external-tool\", label: \"Sign outside Ghostly\",\n instructions: statement => ({ steps: [{ text: \"Sign this statement with your test key:\", copy: statement.text }], paste: { label: \"Signature (base64url)\" } }),\n parse: pasted => { const sig = pasted.trim(); if (!/^[A-Za-z0-9_-]{86}$/.test(sig)) throw new Error(\"That is not a test signature\"); return { sig }; } },\n ],\n parseEvidence(raw) {\n const e = raw as FakeKeyEvidence;\n if (!exactKeys(raw, \"sig\") || typeof e.sig !== \"string\" || !/^[A-Za-z0-9_-]{86}$/.test(e.sig)) throw new Error(\"Invalid test evidence\");\n return { sig: e.sig };\n },\n async verify(statement, evidence) {\n let ok: boolean;\n try { ok = ed25519.verify(fromBase64Url(evidence.sig), statement.bytes, unhex(statement.binding.subject)); } catch { ok = false; }\n if (!ok) throw new Error(\"Invalid test signature\");\n return { subject: statement.binding.subject, source: \"Test signature (Ed25519)\" };\n },\n};\n\n/** The fake issuer's key. Its public half is what fake-account trusts, like a provider's JWKS. */\nconst ISSUER_SEED = unhex(\"7a\".repeat(32));\nexport const FAKE_ISSUER = \"https://issuer.ghostly.test\";\nexport interface FakeAccountEvidence { token: string }\n/** What the fake login page signs: iss, sub, nonce (= statement id), iat. */\nexport function fakeAccountToken(statement: IdentityStatement, account = \"alice\", seed = ISSUER_SEED, iat = statement.binding.issuedAt): FakeAccountEvidence {\n const payload = toBase64Url(utf8Encode(JSON.stringify({ iss: FAKE_ISSUER, sub: account, nonce: statement.id, iat })));\n return { token: `${payload}.${toBase64Url(ed25519.sign(utf8Encode(payload), seed))}` };\n}\nexport const fakeAccount: IdentityProofProvider<FakeAccountEvidence> = {\n id: \"fake-account\", label: \"Test account\", category: \"provider-attested\",\n summary: \"Log in to the test issuer\", description: \"A test login provider that vouches for an account. For tests only.\",\n platforms: [\"web\", \"desktop\"],\n subject: { label: \"Provider\", options: [{ value: FAKE_ISSUER, label: \"Test issuer\" }],\n normalize: input => { if (input.trim() !== FAKE_ISSUER) throw new Error(\"Unknown test issuer\"); return FAKE_ISSUER; } },\n validity: { defaultDays: 30, maxDays: 90 },\n privacy: \"Nothing: the issuer's signature is checked on this device.\",\n signers: [{ id: \"fake-login\", kind: \"redirect\", label: \"Log in to the test issuer\",\n start: async (statement, ctx) => { ctx.signal.throwIfAborted(); return fakeAccountToken(statement, ctx.values.account || \"alice\"); } }],\n parseEvidence(raw) {\n const e = raw as FakeAccountEvidence;\n if (!exactKeys(raw, \"token\") || typeof e.token !== \"string\" || e.token.length > 2048 || !/^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]{86}$/.test(e.token)) throw new Error(\"Invalid test token\");\n return { token: e.token };\n },\n async verify(statement, { token }) {\n const [payload, sig] = token.split(\".\");\n if (!ed25519.verify(fromBase64Url(sig), utf8Encode(payload), ed25519.getPublicKey(ISSUER_SEED))) throw new Error(\"Not signed by the test issuer\");\n const claims = JSON.parse(utf8Decode(fromBase64Url(payload))) as { iss: string; sub: string; nonce: string };\n if (claims.iss !== statement.binding.subject) throw new Error(\"Token from another issuer\");\n if (claims.nonce !== statement.id) throw new Error(\"Token for another statement\");\n if (typeof claims.sub !== \"string\" || !/^[a-z0-9]{1,64}$/.test(claims.sub)) throw new Error(\"Invalid account\");\n return { subject: `${claims.iss}#${claims.sub}`, attester: \"issuer.ghostly.test\", source: \"Token signed by the test issuer\",\n display: { name: claims.sub, source: \"Test issuer profile\", fetchedAt: statement.binding.issuedAt } };\n },\n};\n\n/** fake-record's records: subject → published text. The verifier reads `https://records.ghostly.test/<subject>`. */\nexport const FAKE_RECORD_HOST = \"https://records.ghostly.test/\";\nexport const fakeRecordText = (statement: IdentityStatement) => `ghostly-proof=${statement.id}`;\nexport const fakeRecord: IdentityProofProvider<Record<string, never>> = {\n id: \"fake-record\", label: \"Test record\", category: \"self-custodied\",\n summary: \"Publish a test record\", description: \"A test record published where the verifier looks it up, like DNS. For tests only.\",\n platforms: [\"web\", \"desktop\"],\n subject: { label: \"Name\", placeholder: \"alice\", normalize: input => { const v = input.trim().toLowerCase(); if (!/^[a-z0-9-]{1,63}$/.test(v)) throw new Error(\"Letters, digits and dashes\"); return v; } },\n validity: { defaultDays: 30, maxDays: 365 },\n recheck: { afterSeconds: 3600 },\n privacy: \"The verifier asks records.ghostly.test for the record: that server learns the name was checked.\",\n signers: [{ id: \"fake-publish\", kind: \"publish\", label: \"Publish a record\",\n instructions: statement => ({ steps: [{ text: `Publish this record for ${statement.binding.subject}:`, copy: fakeRecordText(statement) }] }),\n evidence: () => ({}) }],\n parseEvidence(raw) { if (!exactKeys(raw, \"\")) throw new Error(\"Invalid test evidence\"); return {}; },\n async verify(statement, _evidence, ctx) {\n const response = await ctx.fetch(`${FAKE_RECORD_HOST}${statement.binding.subject}`, { maxBytes: 4096, signal: ctx.signal });\n if (response.status !== 200 || !response.text.split(\"\\n\").includes(fakeRecordText(statement))) throw new Error(\"The record is not published\");\n return { subject: statement.binding.subject, source: \"Record published at records.ghostly.test\" };\n },\n};\n\nexport const FAKE_IDENTITY_PROVIDERS: readonly IdentityProofProvider[] = [fakeKey, fakeAccount, fakeRecord];\n"],"mappings":";;;;;;;;;;;;AAgBA,IAAa,kBAA2B;CAAE,IAAI;EAAE,OAAiC;CAAyC,QAAQ;EAAE,OAAO;CAAO;AAAE;;;ACGpJ,IAAa,sBAAsB;AAEnC,IAAMA,SAAO,UAAsB,MAAM,KAAK,QAAQ,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE;AACpG,IAAM,UAAU,MAAc,OAAO,gBAAgB,IAAI,WAAW,CAAC,CAAC;AACtE,IAAM,QAAQ,OAAe,SAAS,MAAM;CAC1C,MAAM,MAAgB,CAAC;CACvB,KAAK,IAAI,IAAI,OAAO,IAAI,GAAG,IAAI,KAAK,MAAM,IAAI,EAAE,GAAG,IAAI,QAAQ,IAAI,EAAE;CACrE,OAAO,IAAI,SAAS,QAAQ,IAAI,QAAQ,CAAC;CACzC,OAAO;AACT;;AAGA,SAAgB,YAAY,QAAgB,aAAyB,OAAO,IAAI,gBAAgB,MAAc;CAC5G,MAAM,QAAQ,KAAK,KAAK,MAAM,KAAK,IAAI,IAAI,GAAI,GAAG,CAAC;CACnD,MAAM,SAAS,KAAa,SAAmB,MAAM,KAAK,KAAK,KAAK,UAAU,GAAG,KAAK,SAAS,IAAI,GAAG,IAAI;CAC1G,MAAM,GAAG,OAAO,QAAQ,WAAW,CAAC;CACpC,IAAI,MAAM,MAAM,IAAI,OAAO,QAAQ,IAAI,YAAY,CAAC,CAAC,OAAO,KAAK,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC;CAChF,MAAM,GAAG,KAAK,aAAa,CAAC;CAC5B,OAAO,OAAO,OAAO,SAAS,SAAS,GAAG,IAAI,CAAC,GAAG,OAAO,GAAG,IAAI,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