@ghostlytools/sdk 0.0.0-stage → 1.2.4

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 (145) hide show
  1. package/README.md +13 -2
  2. package/dist/app.js +72 -0
  3. package/dist/app.js.map +1 -0
  4. package/dist/core.js +207 -0
  5. package/dist/core.js.map +1 -0
  6. package/dist/fakes-JOzOFxn3.js +536 -0
  7. package/dist/fakes-JOzOFxn3.js.map +1 -0
  8. package/dist/fakes.js +2 -0
  9. package/dist/index.js +179 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/keet-identity-key-BLli1rE4.js +76483 -0
  12. package/dist/keet-identity-key-BLli1rE4.js.map +1 -0
  13. package/dist/src-BqHTnRWH.js +31296 -0
  14. package/dist/src-BqHTnRWH.js.map +1 -0
  15. package/dist/testing.js +330 -0
  16. package/dist/testing.js.map +1 -0
  17. package/dist/types/browser/src/engine/paymentAdapters/providers/contractSuite.d.ts +41 -0
  18. package/dist/types/browser/src/engine/paymentAdapters/providers/lightning.d.ts +103 -0
  19. package/dist/types/browser/src/engine/paymentAdapters/providers/onchain.d.ts +88 -0
  20. package/dist/types/browser/src/engine/paymentAdapters/providers/testing.d.ts +89 -0
  21. package/dist/types/browser/src/engine/paymentAdapters/providers/types.d.ts +151 -0
  22. package/dist/types/browser/src/plugins/bundled.d.ts +8 -0
  23. package/dist/types/browser/src/plugins/registry.d.ts +57 -0
  24. package/dist/types/browser/src/proofs/contract.d.ts +262 -0
  25. package/dist/types/browser/src/proofs/contractSuite.d.ts +27 -0
  26. package/dist/types/browser/src/proofs/testing.d.ts +36 -0
  27. package/dist/types/browser/src/proofs/verify.d.ts +23 -0
  28. package/dist/types/browser/src/shared/mints.d.ts +50 -0
  29. package/dist/types/core/src/appBundle.d.ts +173 -0
  30. package/dist/types/core/src/appStatements.d.ts +142 -0
  31. package/dist/types/core/src/appStore.d.ts +133 -0
  32. package/dist/types/core/src/appUpdates.d.ts +88 -0
  33. package/dist/types/core/src/atprotoIdentity.d.ts +49 -0
  34. package/dist/types/core/src/atprotoRepo.d.ts +101 -0
  35. package/dist/types/core/src/avatar.d.ts +19 -0
  36. package/dist/types/core/src/bip322.d.ts +57 -0
  37. package/dist/types/core/src/bitcoinAddress.d.ts +5 -0
  38. package/dist/types/core/src/bitcoinMessage.d.ts +15 -0
  39. package/dist/types/core/src/bitcoinScript.d.ts +69 -0
  40. package/dist/types/core/src/bolt11.d.ts +30 -0
  41. package/dist/types/core/src/bytes.d.ts +11 -0
  42. package/dist/types/core/src/callSignal.d.ts +232 -0
  43. package/dist/types/core/src/canonicalJson.d.ts +22 -0
  44. package/dist/types/core/src/capsRecord.d.ts +234 -0
  45. package/dist/types/core/src/catchUp.d.ts +45 -0
  46. package/dist/types/core/src/chatFiles.d.ts +271 -0
  47. package/dist/types/core/src/clockWatch.d.ts +72 -0
  48. package/dist/types/core/src/communityRendezvous.d.ts +113 -0
  49. package/dist/types/core/src/crypto.d.ts +10 -0
  50. package/dist/types/core/src/datalink.d.ts +187 -0
  51. package/dist/types/core/src/deviceInvite.d.ts +51 -0
  52. package/dist/types/core/src/deviceLink.d.ts +70 -0
  53. package/dist/types/core/src/dhtDelivery.d.ts +407 -0
  54. package/dist/types/core/src/dhtFiles.d.ts +46 -0
  55. package/dist/types/core/src/did.d.ts +134 -0
  56. package/dist/types/core/src/didDht.d.ts +155 -0
  57. package/dist/types/core/src/directPath.d.ts +63 -0
  58. package/dist/types/core/src/dns.d.ts +41 -0
  59. package/dist/types/core/src/domainProofs.d.ts +88 -0
  60. package/dist/types/core/src/engineErrors.d.ts +91 -0
  61. package/dist/types/core/src/enroll.d.ts +98 -0
  62. package/dist/types/core/src/files.d.ts +73 -0
  63. package/dist/types/core/src/forwards.d.ts +12 -0
  64. package/dist/types/core/src/frames.d.ts +211 -0
  65. package/dist/types/core/src/ghostlink.d.ts +1532 -0
  66. package/dist/types/core/src/groupCommits.d.ts +103 -0
  67. package/dist/types/core/src/groupCommunity.d.ts +720 -0
  68. package/dist/types/core/src/groupCrypto.d.ts +60 -0
  69. package/dist/types/core/src/groupEdits.d.ts +67 -0
  70. package/dist/types/core/src/groupEntry.d.ts +61 -0
  71. package/dist/types/core/src/groupFiles.d.ts +106 -0
  72. package/dist/types/core/src/groupHubs.d.ts +61 -0
  73. package/dist/types/core/src/groupMentions.d.ts +27 -0
  74. package/dist/types/core/src/groupMeta.d.ts +162 -0
  75. package/dist/types/core/src/groupSession.d.ts +728 -0
  76. package/dist/types/core/src/groupSignals.d.ts +167 -0
  77. package/dist/types/core/src/groupTyping.d.ts +56 -0
  78. package/dist/types/core/src/groupWake.d.ts +68 -0
  79. package/dist/types/core/src/handoff.d.ts +255 -0
  80. package/dist/types/core/src/http.d.ts +125 -0
  81. package/dist/types/core/src/identity.d.ts +17 -0
  82. package/dist/types/core/src/identityProofs.d.ts +243 -0
  83. package/dist/types/core/src/identityTimeline.d.ts +72 -0
  84. package/dist/types/core/src/image.d.ts +33 -0
  85. package/dist/types/core/src/index.d.ts +100 -0
  86. package/dist/types/core/src/invite.d.ts +128 -0
  87. package/dist/types/core/src/link.d.ts +353 -0
  88. package/dist/types/core/src/linkPreview.d.ts +60 -0
  89. package/dist/types/core/src/linkTrace.d.ts +12 -0
  90. package/dist/types/core/src/lnurl.d.ts +99 -0
  91. package/dist/types/core/src/messageTime.d.ts +28 -0
  92. package/dist/types/core/src/miniApp.d.ts +146 -0
  93. package/dist/types/core/src/pairedApps.d.ts +151 -0
  94. package/dist/types/core/src/pairedCalls.d.ts +59 -0
  95. package/dist/types/core/src/pairedCapabilities.d.ts +101 -0
  96. package/dist/types/core/src/pairedEdits.d.ts +83 -0
  97. package/dist/types/core/src/pairedFiles.d.ts +30 -0
  98. package/dist/types/core/src/pairedHttp.d.ts +15 -0
  99. package/dist/types/core/src/pairedSession.d.ts +163 -0
  100. package/dist/types/core/src/pairedSignal.d.ts +17 -0
  101. package/dist/types/core/src/pairedTransports.d.ts +76 -0
  102. package/dist/types/core/src/pairedTyping.d.ts +130 -0
  103. package/dist/types/core/src/pairedWake.d.ts +109 -0
  104. package/dist/types/core/src/pairingProgress.d.ts +107 -0
  105. package/dist/types/core/src/paymentIntent.d.ts +111 -0
  106. package/dist/types/core/src/paymentUri.d.ts +34 -0
  107. package/dist/types/core/src/payments.d.ts +97 -0
  108. package/dist/types/core/src/peerProofs.d.ts +98 -0
  109. package/dist/types/core/src/pins.d.ts +73 -0
  110. package/dist/types/core/src/pkarr.d.ts +48 -0
  111. package/dist/types/core/src/pkdns.d.ts +35 -0
  112. package/dist/types/core/src/pubkyProofs.d.ts +25 -0
  113. package/dist/types/core/src/pubkyRing.d.ts +21 -0
  114. package/dist/types/core/src/reactions.d.ts +108 -0
  115. package/dist/types/core/src/records.d.ts +89 -0
  116. package/dist/types/core/src/relay.d.ts +459 -0
  117. package/dist/types/core/src/relayBreaker.d.ts +99 -0
  118. package/dist/types/core/src/replies.d.ts +41 -0
  119. package/dist/types/core/src/services.d.ts +35 -0
  120. package/dist/types/core/src/setUpdate.d.ts +53 -0
  121. package/dist/types/core/src/signal.d.ts +53 -0
  122. package/dist/types/core/src/signer.d.ts +13 -0
  123. package/dist/types/core/src/sparkAddress.d.ts +37 -0
  124. package/dist/types/core/src/sshsig.d.ts +74 -0
  125. package/dist/types/core/src/statusCards.d.ts +253 -0
  126. package/dist/types/core/src/storeForward.d.ts +144 -0
  127. package/dist/types/core/src/text.d.ts +20 -0
  128. package/dist/types/core/src/transport.d.ts +158 -0
  129. package/dist/types/core/src/transportSwitch.d.ts +160 -0
  130. package/dist/types/core/src/turnRead.d.ts +145 -0
  131. package/dist/types/core/src/turnRecord.d.ts +165 -0
  132. package/dist/types/core/src/version.d.ts +9 -0
  133. package/dist/types/core/src/video.d.ts +44 -0
  134. package/dist/types/core/src/voice.d.ts +88 -0
  135. package/dist/types/core/src/webPush.d.ts +58 -0
  136. package/dist/types/sdk/src/app.d.ts +23 -0
  137. package/dist/types/sdk/src/core.d.ts +7 -0
  138. package/dist/types/sdk/src/fakes.d.ts +6 -0
  139. package/dist/types/sdk/src/index.d.ts +26 -0
  140. package/dist/types/sdk/src/testing.d.ts +7 -0
  141. package/dist/types-DvtCy3WB.js +99 -0
  142. package/dist/types-DvtCy3WB.js.map +1 -0
  143. package/dist/verify-RjMx7eW6.js +106 -0
  144. package/dist/verify-RjMx7eW6.js.map +1 -0
  145. package/package.json +70 -4
@@ -0,0 +1,536 @@
1
+ import { gx as utf8Encode, hx as utf8Decode, lx as fromBase64Url, oa as decodeBolt11, px as toBase64Url } from "./src-BqHTnRWH.js";
2
+ import { t as NothingSpentError } from "./types-DvtCy3WB.js";
3
+ import { ed25519 } from "@noble/curves/ed25519.js";
4
+ import { sha256 } from "@noble/hashes/sha2.js";
5
+ import { bech32 } from "@scure/base";
6
+ //#region ../browser/src/engine/paymentAdapters/providers/testing.ts
7
+ var TEST_PROVIDERS_FLAG = "ghostly-test-providers";
8
+ var hex$1 = (bytes) => Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
9
+ var random = (n) => crypto.getRandomValues(new Uint8Array(n));
10
+ var uint = (value, length = 1) => {
11
+ const out = [];
12
+ for (let v = value; v > 0; v = Math.floor(v / 32)) out.unshift(v % 32);
13
+ while (out.length < length) out.unshift(0);
14
+ return out;
15
+ };
16
+ /** A BOLT 11 invoice on regtest with a real checksum and a blank signature: it decodes, nobody can pay it. */
17
+ function fakeInvoice(amount, paymentHash, memo = "", expirySeconds = 3600) {
18
+ const words = uint(Math.floor(Date.now() / 1e3), 7);
19
+ const field = (tag, data) => words.push(tag, data.length >> 5, data.length & 31, ...data);
20
+ field(1, bech32.toWords(paymentHash));
21
+ if (memo) field(13, bech32.toWords(new TextEncoder().encode(memo.slice(0, 100))));
22
+ field(6, uint(expirySeconds));
23
+ return bech32.encode(`lnbcrt${amount * 10}n`, [...words, ...new Array(104).fill(0)], false);
24
+ }
25
+ /** A valid regtest P2WPKH address of nobody's. */
26
+ var fakeAddress = () => bech32.encode("bcrt", [0, ...bech32.toWords(random(20))]);
27
+ var FIELDS = [
28
+ {
29
+ name: "alias",
30
+ label: "Name",
31
+ kind: "text",
32
+ optional: true,
33
+ placeholder: "Fake node"
34
+ },
35
+ {
36
+ name: "token",
37
+ label: "Access token",
38
+ kind: "secret",
39
+ placeholder: "anything",
40
+ help: "Sealed like a real provider's secret; the fake only checks it is there."
41
+ },
42
+ {
43
+ name: "behaviour",
44
+ label: "Spends",
45
+ kind: "select",
46
+ optional: true,
47
+ options: [
48
+ {
49
+ value: "settle",
50
+ label: "Go through"
51
+ },
52
+ {
53
+ value: "refuse",
54
+ label: "Are refused"
55
+ },
56
+ {
57
+ value: "hang",
58
+ label: "Lose their answer"
59
+ }
60
+ ],
61
+ defaults: { testnet: "settle" }
62
+ }
63
+ ];
64
+ var validate = ({ secrets, config }) => {
65
+ if (!secrets.token?.trim()) throw new Error("Enter an access token");
66
+ if (config.behaviour && ![
67
+ "settle",
68
+ "refuse",
69
+ "hang"
70
+ ].includes(config.behaviour)) throw new Error("Unknown behaviour");
71
+ };
72
+ var FakeLightningProvider = class {
73
+ options;
74
+ capabilities = {
75
+ receive: true,
76
+ send: true,
77
+ balance: true,
78
+ lookup: true
79
+ };
80
+ invoices = /* @__PURE__ */ new Map();
81
+ payments = /* @__PURE__ */ new Map();
82
+ paid = [];
83
+ balance;
84
+ behaviour;
85
+ closed = false;
86
+ timers = [];
87
+ constructor(options = {}) {
88
+ this.options = options;
89
+ this.balance = options.balance ?? 1e5;
90
+ this.behaviour = options.behaviour ?? "settle";
91
+ }
92
+ async info() {
93
+ return {
94
+ network: "regtest",
95
+ alias: this.options.alias || "Fake Lightning",
96
+ balance: this.balance
97
+ };
98
+ }
99
+ async createInvoice(amount, memo) {
100
+ const preimage = random(32), hash = sha256(preimage);
101
+ const invoice = {
102
+ invoice: fakeInvoice(amount, hash, memo),
103
+ paymentHash: hex$1(hash),
104
+ amount,
105
+ expiresAt: Date.now() + 36e5,
106
+ ref: hex$1(preimage)
107
+ };
108
+ this.invoices.set(invoice.paymentHash, {
109
+ invoice,
110
+ paid: false
111
+ });
112
+ if (this.behaviour === "settle") this.timers.push(setTimeout(() => this.markPaid(invoice.paymentHash), this.options.settleMs ?? 1500));
113
+ return invoice;
114
+ }
115
+ /** Someone paid this invoice. */
116
+ markPaid(paymentHash) {
117
+ const entry = this.invoices.get(paymentHash);
118
+ if (!entry || entry.paid || this.closed) return;
119
+ entry.paid = true;
120
+ this.balance += entry.invoice.amount;
121
+ }
122
+ async invoiceStatus(invoice) {
123
+ const entry = this.invoices.get(invoice.paymentHash);
124
+ if (entry?.paid) return {
125
+ state: "paid",
126
+ amount: entry.invoice.amount
127
+ };
128
+ return { state: invoice.expiresAt < Date.now() ? "expired" : "open" };
129
+ }
130
+ async estimateFee(_invoice, amount) {
131
+ return Math.max(1, Math.ceil(amount / 100));
132
+ }
133
+ async payInvoice(invoice, maxFee) {
134
+ const decoded = decodeBolt11(invoice);
135
+ if (!decoded?.paymentHash || decoded.amountSat === null) throw new NothingSpentError("Not an invoice this fake can pay");
136
+ const fee = Math.min(maxFee, Math.max(1, Math.ceil(decoded.amountSat / 100)));
137
+ if (this.behaviour === "refuse") throw new NothingSpentError("No route (fake)");
138
+ if (this.balance < decoded.amountSat + fee) throw new NothingSpentError("Not enough sats in the fake wallet");
139
+ this.balance -= decoded.amountSat + fee;
140
+ this.paid.push(decoded.paymentHash);
141
+ this.payments.set(decoded.paymentHash, {
142
+ state: "paid",
143
+ fee,
144
+ preimage: hex$1(random(32))
145
+ });
146
+ if (this.behaviour === "hang") throw new Error("Connection lost (fake)");
147
+ return {
148
+ state: "paid",
149
+ fee,
150
+ preimage: this.payments.get(decoded.paymentHash).preimage
151
+ };
152
+ }
153
+ async paymentStatus(payment) {
154
+ return this.payments.get(payment.paymentHash) ?? { state: "failed" };
155
+ }
156
+ async close() {
157
+ this.closed = true;
158
+ for (const t of this.timers) clearTimeout(t);
159
+ }
160
+ };
161
+ var FakeOnchainProvider = class {
162
+ options;
163
+ addresses = [];
164
+ broadcasts = [];
165
+ released = [];
166
+ txs = /* @__PURE__ */ new Map();
167
+ confirmed;
168
+ behaviour;
169
+ closed = false;
170
+ constructor(options = {}) {
171
+ this.options = options;
172
+ this.confirmed = options.balance ?? 1e5;
173
+ this.behaviour = options.behaviour ?? "settle";
174
+ }
175
+ async info() {
176
+ return {
177
+ network: "regtest",
178
+ alias: this.options.alias || "Fake Bitcoin wallet"
179
+ };
180
+ }
181
+ async receiveAddress() {
182
+ const address = fakeAddress();
183
+ this.addresses.push(address);
184
+ return address;
185
+ }
186
+ async balance() {
187
+ return {
188
+ confirmed: this.confirmed,
189
+ unconfirmed: 0
190
+ };
191
+ }
192
+ async prepareSend(request) {
193
+ const feeRate = request.feeRate ?? 2, fee = feeRate * 141;
194
+ if (fee > request.feeCap) throw new Error(`The fee (${fee} sats) is above your limit`);
195
+ if (this.confirmed < request.amount + fee) throw new Error("Not enough confirmed sats");
196
+ return {
197
+ txid: hex$1(random(32)),
198
+ address: request.address,
199
+ amount: request.amount,
200
+ fee,
201
+ feeRate,
202
+ signed: hex$1(random(64))
203
+ };
204
+ }
205
+ async broadcast(prepared) {
206
+ if (this.behaviour === "refuse") throw new NothingSpentError("Rejected by the node (fake)");
207
+ if (!this.txs.has(prepared.txid)) {
208
+ this.confirmed -= prepared.amount + prepared.fee;
209
+ this.txs.set(prepared.txid, {
210
+ prepared,
211
+ confirmations: 1
212
+ });
213
+ }
214
+ this.broadcasts.push(prepared.txid);
215
+ if (this.behaviour === "hang") throw new Error("Connection lost (fake)");
216
+ return prepared.txid;
217
+ }
218
+ async status(prepared) {
219
+ const tx = this.txs.get(prepared.txid);
220
+ return tx ? {
221
+ state: "confirmed",
222
+ confirmations: tx.confirmations
223
+ } : {
224
+ state: "missing",
225
+ confirmations: 0
226
+ };
227
+ }
228
+ async release(prepared) {
229
+ this.released.push(prepared.txid);
230
+ }
231
+ async history(limit) {
232
+ return [...this.txs.values()].reverse().slice(0, limit).map(({ prepared, confirmations }) => ({
233
+ txid: prepared.txid,
234
+ amount: -prepared.amount,
235
+ fee: prepared.fee,
236
+ confirmations
237
+ }));
238
+ }
239
+ async close() {
240
+ this.closed = true;
241
+ }
242
+ };
243
+ var options = ({ config, secrets }) => ({
244
+ alias: config.alias,
245
+ behaviour: config.behaviour || "settle",
246
+ token: secrets.token
247
+ });
248
+ var fakeLightning = {
249
+ id: "fake-lightning",
250
+ label: "Fake Lightning (test)",
251
+ kind: "lightning",
252
+ description: "In-memory regtest node for tests. Holds nothing.",
253
+ networks: ["regtest"],
254
+ platforms: [
255
+ "web",
256
+ "extension",
257
+ "desktop"
258
+ ],
259
+ fields: FIELDS,
260
+ experimental: true,
261
+ validate,
262
+ async create(settings) {
263
+ return new FakeLightningProvider(options(settings));
264
+ }
265
+ };
266
+ var fakeOnchain = {
267
+ id: "fake-onchain",
268
+ label: "Fake Bitcoin wallet (test)",
269
+ kind: "onchain",
270
+ description: "In-memory regtest wallet for tests. Holds nothing.",
271
+ networks: ["regtest"],
272
+ platforms: [
273
+ "web",
274
+ "extension",
275
+ "desktop"
276
+ ],
277
+ fields: FIELDS,
278
+ experimental: true,
279
+ validate,
280
+ async create(settings) {
281
+ return new FakeOnchainProvider(options(settings));
282
+ }
283
+ };
284
+ /** Whether this browser asked for the fake providers (an e2e run sets it before the app starts). */
285
+ function testProvidersEnabled() {
286
+ try {
287
+ return globalThis.localStorage?.getItem(TEST_PROVIDERS_FLAG) === "1";
288
+ } catch {
289
+ return false;
290
+ }
291
+ }
292
+ //#endregion
293
+ //#region ../browser/src/proofs/testing.ts
294
+ /**
295
+ * Fake identity providers, for unit tests and e2e. No network, no real accounts. They are in the
296
+ * registry only when `localStorage["ghostly-test-identities"] === "1"` (or a test passes them itself).
297
+ *
298
+ * - fake-key self-custodied: an Ed25519 key held by a fake in-app signer, or signed "outside" and pasted.
299
+ * - fake-account provider-attested: a fake issuer signs a token whose nonce is the statement id (like OIDC).
300
+ * - fake-record self-custodied, published: a record the verifier fetches through `ctx.fetch` (like DNS).
301
+ */
302
+ var TEST_IDENTITIES_FLAG = "ghostly-test-identities";
303
+ var testIdentitiesEnabled = () => {
304
+ try {
305
+ return globalThis.localStorage?.getItem(TEST_IDENTITIES_FLAG) === "1";
306
+ } catch {
307
+ return false;
308
+ }
309
+ };
310
+ var HEX64 = /^[a-f0-9]{64}$/;
311
+ var hex = (b) => Array.from(b, (x) => x.toString(16).padStart(2, "0")).join("");
312
+ var unhex = (s) => Uint8Array.from(s.match(/../g), (x) => parseInt(x, 16));
313
+ var normalizeHexKey = (input) => {
314
+ const v = input.trim().toLowerCase();
315
+ if (!HEX64.test(v)) throw new Error("Enter 64 hex characters");
316
+ return v;
317
+ };
318
+ var exactKeys = (raw, keys) => !!raw && typeof raw === "object" && !Array.isArray(raw) && Object.keys(raw).sort().join(",") === keys;
319
+ /** The key behind the fake in-app signer. Tests may replace it. */
320
+ var fakeKeyring = { seed: ed25519.utils.randomSecretKey() };
321
+ var fakeKeySubject = (seed = fakeKeyring.seed) => hex(ed25519.getPublicKey(seed));
322
+ var fakeKeySign = (statement, seed = fakeKeyring.seed) => ({ sig: toBase64Url(ed25519.sign(statement.bytes, seed)) });
323
+ var fakeKey = {
324
+ id: "fake-key",
325
+ label: "Test key",
326
+ category: "self-custodied",
327
+ summary: "Sign with the test key",
328
+ description: "A test identity: an Ed25519 key held by this page. For tests only.",
329
+ platforms: [
330
+ "web",
331
+ "extension",
332
+ "desktop"
333
+ ],
334
+ subject: {
335
+ label: "Public key",
336
+ placeholder: "64 hex characters",
337
+ normalize: normalizeHexKey,
338
+ short: (k) => `${k.slice(0, 8)}…${k.slice(-4)}`
339
+ },
340
+ publicUri: (k) => `urn:ghostly-test:${k}`,
341
+ validity: {
342
+ defaultDays: 30,
343
+ maxDays: 365
344
+ },
345
+ privacy: "Nothing: checked on this device.",
346
+ signers: [{
347
+ id: "fake-signer",
348
+ kind: "in-app",
349
+ label: "Test signer",
350
+ fields: [{
351
+ name: "refuse",
352
+ label: "Refuse",
353
+ kind: "text",
354
+ optional: true
355
+ }],
356
+ run: async (ctx, work) => {
357
+ ctx.signal.throwIfAborted();
358
+ if (ctx.values.refuse) throw new Error("The test signer refused");
359
+ return work({
360
+ subject: async () => fakeKeySubject(),
361
+ sign: async (statement) => fakeKeySign(statement)
362
+ });
363
+ }
364
+ }, {
365
+ id: "fake-tool",
366
+ kind: "external-tool",
367
+ label: "Sign outside Ghostly",
368
+ instructions: (statement) => ({
369
+ steps: [{
370
+ text: "Sign this statement with your test key:",
371
+ copy: statement.text
372
+ }],
373
+ paste: { label: "Signature (base64url)" }
374
+ }),
375
+ parse: (pasted) => {
376
+ const sig = pasted.trim();
377
+ if (!/^[A-Za-z0-9_-]{86}$/.test(sig)) throw new Error("That is not a test signature");
378
+ return { sig };
379
+ }
380
+ }],
381
+ parseEvidence(raw) {
382
+ const e = raw;
383
+ if (!exactKeys(raw, "sig") || typeof e.sig !== "string" || !/^[A-Za-z0-9_-]{86}$/.test(e.sig)) throw new Error("Invalid test evidence");
384
+ return { sig: e.sig };
385
+ },
386
+ async verify(statement, evidence) {
387
+ let ok;
388
+ try {
389
+ ok = ed25519.verify(fromBase64Url(evidence.sig), statement.bytes, unhex(statement.binding.subject));
390
+ } catch {
391
+ ok = false;
392
+ }
393
+ if (!ok) throw new Error("Invalid test signature");
394
+ return {
395
+ subject: statement.binding.subject,
396
+ source: "Test signature (Ed25519)"
397
+ };
398
+ }
399
+ };
400
+ /** The fake issuer's key. Its public half is what fake-account trusts, like a provider's JWKS. */
401
+ var ISSUER_SEED = unhex("7a".repeat(32));
402
+ var FAKE_ISSUER = "https://issuer.ghostly.test";
403
+ /** What the fake login page signs: iss, sub, nonce (= statement id), iat. */
404
+ function fakeAccountToken(statement, account = "alice", seed = ISSUER_SEED, iat = statement.binding.issuedAt) {
405
+ const payload = toBase64Url(utf8Encode(JSON.stringify({
406
+ iss: FAKE_ISSUER,
407
+ sub: account,
408
+ nonce: statement.id,
409
+ iat
410
+ })));
411
+ return { token: `${payload}.${toBase64Url(ed25519.sign(utf8Encode(payload), seed))}` };
412
+ }
413
+ var fakeAccount = {
414
+ id: "fake-account",
415
+ label: "Test account",
416
+ category: "provider-attested",
417
+ summary: "Log in to the test issuer",
418
+ description: "A test login provider that vouches for an account. For tests only.",
419
+ platforms: [
420
+ "web",
421
+ "extension",
422
+ "desktop"
423
+ ],
424
+ subject: {
425
+ label: "Provider",
426
+ options: [{
427
+ value: FAKE_ISSUER,
428
+ label: "Test issuer"
429
+ }],
430
+ normalize: (input) => {
431
+ if (input.trim() !== "https://issuer.ghostly.test") throw new Error("Unknown test issuer");
432
+ return FAKE_ISSUER;
433
+ }
434
+ },
435
+ validity: {
436
+ defaultDays: 30,
437
+ maxDays: 90
438
+ },
439
+ privacy: "Nothing: the issuer's signature is checked on this device.",
440
+ signers: [{
441
+ id: "fake-login",
442
+ kind: "redirect",
443
+ label: "Log in to the test issuer",
444
+ start: async (statement, ctx) => {
445
+ ctx.signal.throwIfAborted();
446
+ return fakeAccountToken(statement, ctx.values.account || "alice");
447
+ }
448
+ }],
449
+ parseEvidence(raw) {
450
+ const e = raw;
451
+ 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");
452
+ return { token: e.token };
453
+ },
454
+ async verify(statement, { token }) {
455
+ const [payload, sig] = token.split(".");
456
+ if (!ed25519.verify(fromBase64Url(sig), utf8Encode(payload), ed25519.getPublicKey(ISSUER_SEED))) throw new Error("Not signed by the test issuer");
457
+ const claims = JSON.parse(utf8Decode(fromBase64Url(payload)));
458
+ if (claims.iss !== statement.binding.subject) throw new Error("Token from another issuer");
459
+ if (claims.nonce !== statement.id) throw new Error("Token for another statement");
460
+ if (typeof claims.sub !== "string" || !/^[a-z0-9]{1,64}$/.test(claims.sub)) throw new Error("Invalid account");
461
+ return {
462
+ subject: `${claims.iss}#${claims.sub}`,
463
+ attester: "issuer.ghostly.test",
464
+ source: "Token signed by the test issuer",
465
+ display: {
466
+ name: claims.sub,
467
+ source: "Test issuer profile",
468
+ fetchedAt: statement.binding.issuedAt
469
+ }
470
+ };
471
+ }
472
+ };
473
+ /** fake-record's records: subject → published text. The verifier reads `https://records.ghostly.test/<subject>`. */
474
+ var FAKE_RECORD_HOST = "https://records.ghostly.test/";
475
+ var fakeRecordText = (statement) => `ghostly-proof=${statement.id}`;
476
+ var fakeRecord = {
477
+ id: "fake-record",
478
+ label: "Test record",
479
+ category: "self-custodied",
480
+ summary: "Publish a test record",
481
+ description: "A test record published where the verifier looks it up, like DNS. For tests only.",
482
+ platforms: [
483
+ "web",
484
+ "extension",
485
+ "desktop"
486
+ ],
487
+ subject: {
488
+ label: "Name",
489
+ placeholder: "alice",
490
+ normalize: (input) => {
491
+ const v = input.trim().toLowerCase();
492
+ if (!/^[a-z0-9-]{1,63}$/.test(v)) throw new Error("Letters, digits and dashes");
493
+ return v;
494
+ }
495
+ },
496
+ validity: {
497
+ defaultDays: 30,
498
+ maxDays: 365
499
+ },
500
+ recheck: { afterSeconds: 3600 },
501
+ privacy: "The verifier asks records.ghostly.test for the record: that server learns the name was checked.",
502
+ signers: [{
503
+ id: "fake-publish",
504
+ kind: "publish",
505
+ label: "Publish a record",
506
+ instructions: (statement) => ({ steps: [{
507
+ text: `Publish this record for ${statement.binding.subject}:`,
508
+ copy: fakeRecordText(statement)
509
+ }] }),
510
+ evidence: () => ({})
511
+ }],
512
+ parseEvidence(raw) {
513
+ if (!exactKeys(raw, "")) throw new Error("Invalid test evidence");
514
+ return {};
515
+ },
516
+ async verify(statement, _evidence, ctx) {
517
+ const response = await ctx.fetch(`${FAKE_RECORD_HOST}${statement.binding.subject}`, {
518
+ maxBytes: 4096,
519
+ signal: ctx.signal
520
+ });
521
+ if (response.status !== 200 || !response.text.split("\n").includes(fakeRecordText(statement))) throw new Error("The record is not published");
522
+ return {
523
+ subject: statement.binding.subject,
524
+ source: "Record published at records.ghostly.test"
525
+ };
526
+ }
527
+ };
528
+ var FAKE_IDENTITY_PROVIDERS = [
529
+ fakeKey,
530
+ fakeAccount,
531
+ fakeRecord
532
+ ];
533
+ //#endregion
534
+ export { fakeAddress as _, fakeAccount as a, fakeOnchain as b, fakeKeySign as c, fakeRecord as d, fakeRecordText as f, TEST_PROVIDERS_FLAG as g, FakeOnchainProvider as h, TEST_IDENTITIES_FLAG as i, fakeKeySubject as l, FakeLightningProvider as m, FAKE_ISSUER as n, fakeAccountToken as o, testIdentitiesEnabled as p, FAKE_RECORD_HOST as r, fakeKey as s, FAKE_IDENTITY_PROVIDERS as t, fakeKeyring as u, fakeInvoice as v, testProvidersEnabled as x, fakeLightning as y };
535
+
536
+ //# sourceMappingURL=fakes-JOzOFxn3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fakes-JOzOFxn3.js","names":["hex"],"sources":["../../browser/src/engine/paymentAdapters/providers/testing.ts","../../browser/src/proofs/testing.ts"],"sourcesContent":["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\";\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 when `localStorage[\"ghostly-test-providers\"] === \"1\"` (or a test passes them\n * to the registry itself). 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\", \"extension\", \"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\", \"extension\", \"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 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 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 when `localStorage[\"ghostly-test-identities\"] === \"1\"` (or a test passes them itself).\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 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. Tests may replace it. */\nexport const fakeKeyring = { seed: ed25519.utils.randomSecretKey() };\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\", \"extension\", \"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\", \"extension\", \"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\", \"extension\", \"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":";;;;;;AAkBA,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;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Ac,eAAc,EAAE,OAAO,CAAC;GAAE,MAAM,2BAA2B,UAAU,QAAQ,QAAQ;GAAI,MAAM,eAAe,SAAS;EAAE,CAAC,EAAE;EAC1I,iBAAiB,CAAC;CAAG,CAAC;CACxB,cAAc,KAAK;EAAE,IAAI,CAAC,UAAU,KAAK,EAAE,GAAG,MAAM,IAAI,MAAM,uBAAuB;EAAG,OAAO,CAAC;CAAG;CACnG,MAAM,OAAO,WAAW,WAAW,KAAK;EACtC,MAAM,WAAW,MAAM,IAAI,MAAM,GAAG,mBAAmB,UAAU,QAAQ,WAAW;GAAE,UAAU;GAAM,QAAQ,IAAI;EAAO,CAAC;EAC1H,IAAI,SAAS,WAAW,OAAO,CAAC,SAAS,KAAK,MAAM,IAAI,CAAC,CAAC,SAAS,eAAe,SAAS,CAAC,GAAG,MAAM,IAAI,MAAM,6BAA6B;EAC5I,OAAO;GAAE,SAAS,UAAU,QAAQ;GAAS,QAAQ;EAA2C;CAClG;AACF;AAEA,IAAa,0BAA4D;CAAC;CAAS;CAAa;AAAU"}
package/dist/fakes.js ADDED
@@ -0,0 +1,2 @@
1
+ import { _ as fakeAddress, a as fakeAccount, b as fakeOnchain, c as fakeKeySign, d as fakeRecord, f as fakeRecordText, g as TEST_PROVIDERS_FLAG, h as FakeOnchainProvider, i as TEST_IDENTITIES_FLAG, l as fakeKeySubject, m as FakeLightningProvider, n as FAKE_ISSUER, o as fakeAccountToken, p as testIdentitiesEnabled, r as FAKE_RECORD_HOST, s as fakeKey, t as FAKE_IDENTITY_PROVIDERS, u as fakeKeyring, v as fakeInvoice, x as testProvidersEnabled, y as fakeLightning } from "./fakes-JOzOFxn3.js";
2
+ export { FAKE_IDENTITY_PROVIDERS, FAKE_ISSUER, FAKE_RECORD_HOST, FakeLightningProvider, FakeOnchainProvider, TEST_IDENTITIES_FLAG, TEST_PROVIDERS_FLAG, fakeAccount, fakeAccountToken, fakeAddress, fakeInvoice, fakeKey, fakeKeySign, fakeKeySubject, fakeKeyring, fakeLightning, fakeOnchain, fakeRecord, fakeRecordText, testIdentitiesEnabled, testProvidersEnabled };