@ghostlytools/sdk 1.8.1 → 1.10.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 -593
  2. package/dist/core.js.map +1 -1
  3. package/dist/{fakes-Cyfc_vXC.js → fakes-BTB2ugB3.js} +2 -2
  4. package/dist/{fakes-Cyfc_vXC.js.map → fakes-BTB2ugB3.js.map} +1 -1
  5. package/dist/fakes.js +1 -1
  6. package/dist/index.js +2 -2
  7. package/dist/{keet-identity-key-uq3scTiE.js → keet-identity-key-a4pR0QSm.js} +2 -2
  8. package/dist/{keet-identity-key-uq3scTiE.js.map → keet-identity-key-a4pR0QSm.js.map} +1 -1
  9. package/dist/{src-DytzSJB6.js → src-BZy4lDju.js} +2045 -164
  10. package/dist/src-BZy4lDju.js.map +1 -0
  11. package/dist/testing.js +3 -3
  12. package/dist/types/core/src/appStatements.d.ts +7 -0
  13. package/dist/types/core/src/chatFiles.d.ts +4 -1
  14. package/dist/types/core/src/communityRendezvous.d.ts +5 -1
  15. package/dist/types/core/src/contactRecords.d.ts +31 -0
  16. package/dist/types/core/src/ghostlink.d.ts +38 -2
  17. package/dist/types/core/src/groupCommunity.d.ts +84 -9
  18. package/dist/types/core/src/groupFiles.d.ts +15 -0
  19. package/dist/types/core/src/groupMeta.d.ts +3 -2
  20. package/dist/types/core/src/groupSession.d.ts +96 -11
  21. package/dist/types/core/src/http.d.ts +13 -0
  22. package/dist/types/core/src/identityProofs.d.ts +7 -3
  23. package/dist/types/core/src/index.d.ts +1 -0
  24. package/dist/types/core/src/pairedAppRanges.d.ts +17 -9
  25. package/dist/types/core/src/pairedEdits.d.ts +4 -1
  26. package/dist/types/core/src/storeForward.d.ts +2 -1
  27. package/dist/types/core/src/text.d.ts +9 -0
  28. package/dist/types/core/src/turnRecord.d.ts +2 -2
  29. package/dist/types/core/src/videoMetadata.d.ts +33 -0
  30. package/dist/{verify-BC1Eu1lE.js → verify-Bcd7K4q-.js} +3 -3
  31. package/dist/verify-Bcd7K4q-.js.map +1 -0
  32. package/package.json +1 -1
  33. package/dist/src-DytzSJB6.js.map +0 -1
  34. package/dist/verify-BC1Eu1lE.js.map +0 -1
package/dist/core.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","names":[],"sources":["../../core/src/pictureMetadata.ts","../../core/src/paymentUri.ts","../../core/src/version.ts","../../core/src/clockWatch.ts"],"sourcesContent":["/**\n * What a picture leaves with. A photo's file says more than its pixels: its Exif and XMP hold where it was taken, the\n * device, the time, often a thumbnail of the uncropped original. The sender removes them before the file is stored and\n * its digest computed, so what the contact (or anyone in a community) receives is the picture alone: JPEG, PNG, WebP\n * and HEIF (HEIC, AVIF), without decoding or re-encoding a pixel.\n *\n * Fail-closed: a file that is one of these pictures, by its bytes or by its type, and whose metadata cannot be removed\n * (truncated, malformed, a part this does not know) is refused with `NO_PICTURE_METADATA`, never sent as it was. Any\n * other file goes as it is.\n */\nimport { exifOrientation } from \"./image\";\n\nexport const PICTURE_METADATA_LIMITS = {\n /** The largest picture read whole to remove its metadata: past this it is refused. */\n maxBytes: 256 * 1024 * 1024,\n /** Bytes read first to tell a picture from another file. */\n headBytes: 64,\n} as const;\n\n/** Why a picture is refused: its metadata could not be removed, so it does not go at all. */\nexport const NO_PICTURE_METADATA = \"This picture cannot be sent: Ghostly could not remove the details saved in it, like where it was taken\";\n\n/** The types of the pictures stripped here: a file of one of them whose bytes are not that picture is refused. */\nconst STRIPPED_TYPES = new Set([\n \"image/jpeg\", \"image/jpg\", \"image/pjpeg\", \"image/png\", \"image/apng\", \"image/webp\",\n \"image/heic\", \"image/heif\", \"image/heic-sequence\", \"image/heif-sequence\", \"image/avif\", \"image/gif\", \"image/tiff\", \"image/tiff-fx\",\n]);\n\n/** HEIF brands (HEIC, AVIF, the generic `mif1`): an MP4 video's `ftyp` names none of them. */\nconst HEIF_BRANDS = new Set([\"heic\", \"heix\", \"heim\", \"heis\", \"hevc\", \"hevx\", \"mif1\", \"mif2\", \"msf1\", \"avif\", \"avis\"]);\n\ntype Kind = \"jpeg\" | \"png\" | \"webp\" | \"heif\" | \"gif\" | \"tiff\";\n\nconst u16be = (b: Uint8Array, at: number) => (b[at]! << 8) | b[at + 1]!;\nconst u32be = (b: Uint8Array, at: number) => ((b[at]! << 24) >>> 0) + (b[at + 1]! << 16) + (b[at + 2]! << 8) + b[at + 3]!;\nconst u32le = (b: Uint8Array, at: number) => (b[at]! | (b[at + 1]! << 8) | (b[at + 2]! << 16) | (b[at + 3]! << 24)) >>> 0;\nconst text = (b: Uint8Array, at: number, length: number) => String.fromCharCode(...b.subarray(at, at + length));\nconst starts = (b: Uint8Array, at: number, prefix: string) => at + prefix.length <= b.length && text(b, at, prefix.length) === prefix;\n\n/** A picture this strips, by its first bytes. */\nfunction kindOf(b: Uint8Array): Kind | undefined {\n if (b.length >= 3 && b[0] === 0xff && b[1] === 0xd8 && b[2] === 0xff) return \"jpeg\";\n if (b.length >= 8 && b[0] === 0x89 && starts(b, 1, \"PNG\\r\\n\\x1a\\n\")) return \"png\";\n if (b.length >= 12 && starts(b, 0, \"RIFF\") && starts(b, 8, \"WEBP\")) return \"webp\";\n if (starts(b, 0, \"GIF87a\") || starts(b, 0, \"GIF89a\")) return \"gif\";\n // TIFF, and BigTIFF (refused): camera raw files (DNG, CR2, NEF, ARW) are TIFF too.\n if (starts(b, 0, \"II*\\0\") || starts(b, 0, \"MM\\0*\") || starts(b, 0, \"II+\\0\") || starts(b, 0, \"MM\\0+\")) return \"tiff\";\n if (b.length >= 16 && starts(b, 4, \"ftyp\")) {\n const end = Math.min(b.length, u32be(b, 0));\n for (let at = 8; at + 4 <= end; at += 4) if (at !== 12 && HEIF_BRANDS.has(text(b, at, 4))) return \"heif\";\n }\n return undefined;\n}\n\n/** Refuses the picture where its bytes are not what this expects. */\nfunction check(ok: boolean): asserts ok {\n if (!ok) throw new Error(NO_PICTURE_METADATA);\n}\n\n// JPEG: the segments that draw the picture stay (frames, tables, scans, restart intervals, JFIF, the ICC profile,\n// Adobe's colour transform) and the camera's Orientation, alone in an Exif of its own; every other APPn (Exif, XMP,\n// IPTC, MPF), comments, and whatever follows the image's end (a gain map, a motion photo's video) go. As Android's\n// Camera strips its photos (CameraPhoto.kt).\n\n/** SOFn markers: every frame type but DHT (C4), JPG (C8) and DAC (CC). */\nconst JPEG_FRAME = new Set([0xc0, 0xc1, 0xc2, 0xc3, 0xc5, 0xc6, 0xc7, 0xc9, 0xca, 0xcb, 0xcd, 0xce, 0xcf]);\n\nfunction jpegKeeps(marker: number, b: Uint8Array, payload: number): boolean {\n if ((marker >= 0xc0 && marker <= 0xcf) || (marker >= 0xda && marker <= 0xdf)) return true;\n if (marker === 0xe0) return starts(b, payload, \"JFIF\\0\");\n if (marker === 0xe2) return starts(b, payload, \"ICC_PROFILE\\0\");\n if (marker === 0xee) return starts(b, payload, \"Adobe\");\n return false;\n}\n\n/** An APP1 Exif, big-endian, whose IFD0 holds `orientation` alone. */\nconst orientationOnly = (orientation: number) => Uint8Array.of(\n 0xff, 0xe1, 0, 34, 0x45, 0x78, 0x69, 0x66, 0, 0, 0x4d, 0x4d, 0, 42, 0, 0, 0, 8,\n 0, 1, 0x01, 0x12, 0, 3, 0, 0, 0, 1, 0, orientation, 0, 0, 0, 0, 0, 0,\n);\n\nfunction stripJpeg(b: Uint8Array): Uint8Array[] {\n const parts = [b.subarray(0, 2)];\n let at = 2, framed = false, scanned = false, exif = false;\n for (;;) {\n check(at < b.length && b[at] === 0xff);\n while (at < b.length && b[at] === 0xff) at++;\n check(at < b.length);\n const marker = b[at++]!;\n if (marker === 0xd9) {\n check(framed && scanned);\n parts.push(Uint8Array.of(0xff, 0xd9));\n return parts;\n }\n // TEM and restarts stand alone.\n if (marker === 0x01 || (marker >= 0xd0 && marker <= 0xd7)) { parts.push(Uint8Array.of(0xff, marker)); continue; }\n check(marker !== 0x00 && marker !== 0xd8 && at + 2 <= b.length);\n const length = u16be(b, at);\n check(length >= 2 && at + length <= b.length);\n if (jpegKeeps(marker, b, at + 2)) {\n parts.push(Uint8Array.of(0xff, marker), b.subarray(at, at + length));\n if (JPEG_FRAME.has(marker)) framed = true;\n } else if (marker === 0xe1 && !scanned && !exif && starts(b, at + 2, \"Exif\\0\\0\")) {\n exif = true;\n const orientation = exifOrientation(b, at + 8, at + length);\n if (orientation >= 2) parts.push(orientationOnly(orientation));\n }\n at += length;\n if (marker !== 0xda) continue;\n check(framed);\n scanned = true;\n // The scan's image data, where FF 00 is a data byte and FF D0 to D7 a restart, up to the marker that ends it.\n let end = at;\n for (;;) {\n end = b.indexOf(0xff, end);\n check(end >= 0);\n let next = end + 1;\n while (next < b.length && b[next] === 0xff) next++;\n check(next < b.length);\n if (b[next] !== 0x00 && !(b[next]! >= 0xd0 && b[next]! <= 0xd7)) break;\n end = next + 1;\n }\n parts.push(b.subarray(at, end));\n at = end;\n }\n}\n\n// PNG: the critical chunks and the ancillary ones that change how it is drawn (transparency, colour, animation)\n// stay; text (tEXt, iTXt, zTXt), eXIf, tIME and every other chunk go, and anything after IEND.\n\nconst PNG_CRITICAL = new Set([\"IHDR\", \"PLTE\", \"IDAT\", \"IEND\"]);\nconst PNG_DRAWS = new Set([\"tRNS\", \"gAMA\", \"cHRM\", \"sRGB\", \"iCCP\", \"sBIT\", \"bKGD\", \"pHYs\", \"cICP\", \"mDCV\", \"cLLI\", \"acTL\", \"fcTL\", \"fdAT\"]);\n\nfunction stripPng(b: Uint8Array): Uint8Array[] {\n const parts = [b.subarray(0, 8)];\n let at = 8;\n for (;;) {\n check(at + 12 <= b.length);\n const length = u32be(b, at), type = text(b, at + 4, 4);\n check(at + 12 + length <= b.length && (at > 8 || type === \"IHDR\"));\n // A critical chunk this does not know (its first letter upper case) may hold anything a decoder needs.\n const critical = (b[at + 4]! & 0x20) === 0;\n check(!critical || PNG_CRITICAL.has(type));\n if (critical || PNG_DRAWS.has(type)) parts.push(b.subarray(at, at + 12 + length));\n at += 12 + length;\n if (type === \"IEND\") return parts;\n }\n}\n\n// WebP: the image, its alpha, animation and ICC profile stay; EXIF, XMP and unknown chunks go, and VP8X no longer\n// says it has them.\n\nconst WEBP_KEEPS = new Set([\"VP8 \", \"VP8L\", \"VP8X\", \"ALPH\", \"ANIM\", \"ANMF\", \"ICCP\"]);\n\nfunction stripWebp(b: Uint8Array): Uint8Array[] {\n check(b.length >= 20);\n const riffEnd = 8 + u32le(b, 4);\n check(riffEnd <= b.length && riffEnd % 2 === 0);\n const parts: Uint8Array[] = [];\n let at = 12, size = 4, drawn = false;\n while (at < riffEnd) {\n check(at + 8 <= riffEnd);\n const type = text(b, at, 4), length = u32le(b, at + 4), end = at + 8 + length + (length & 1);\n check(end <= riffEnd && (at > 12 || type === \"VP8 \" || type === \"VP8L\" || type === \"VP8X\"));\n if (WEBP_KEEPS.has(type)) {\n let chunk = b.subarray(at, end);\n if (type === \"VP8X\") {\n check(length >= 10);\n // Its flags: EXIF (0x08) and XMP (0x04) are gone.\n chunk = chunk.slice();\n chunk[8] = chunk[8]! & ~0x0c;\n }\n if (type === \"VP8 \" || type === \"VP8L\" || type === \"ANMF\") drawn = true;\n parts.push(chunk);\n size += chunk.length;\n }\n at = end;\n }\n check(drawn);\n const header = new Uint8Array(12);\n header.set(b.subarray(0, 12));\n new DataView(header.buffer).setUint32(4, size, true);\n return [header, ...parts];\n}\n\n// HEIF (HEIC, AVIF): its Exif and XMP are items of the `meta` box whose bytes sit elsewhere in the file. They are\n// overwritten with zeros where they are, so no offset in the file moves. A part this does not know, at the top or in\n// `meta` (a video track, an XML box, a `uuid` box), refuses the picture.\n\nconst HEIF_TOP = new Set([\"ftyp\", \"meta\", \"mdat\", \"free\", \"skip\"]);\nconst HEIF_META = new Set([\"hdlr\", \"dinf\", \"pitm\", \"iloc\", \"iinf\", \"iref\", \"iprp\", \"idat\", \"grpl\", \"free\", \"skip\"]);\n/** Items that hold metadata: Exif, and XMP (or any other document) as a MIME item. */\nconst HEIF_METADATA_ITEMS = new Set([\"Exif\", \"mime\", \"uri \"]);\n\ninterface Box { type: string; start: number; body: number; end: number }\n\nfunction boxes(b: Uint8Array, start: number, end: number): Box[] {\n const found: Box[] = [];\n for (let at = start; at < end;) {\n check(at + 8 <= end);\n let size = u32be(b, at), body = at + 8;\n const type = text(b, at + 4, 4);\n if (size === 1) {\n check(at + 16 <= end);\n size = u32be(b, at + 8) * 2 ** 32 + u32be(b, at + 12);\n body = at + 16;\n } else if (size === 0) size = end - at;\n if (type === \"uuid\") body += 16;\n check(size >= body - at && at + size <= end);\n found.push({ type, start: at, body, end: at + size });\n at += size;\n }\n return found;\n}\n\nfunction stripHeif(b: Uint8Array): Uint8Array[] {\n const top = boxes(b, 0, b.length);\n check(top[0]?.type === \"ftyp\" && top.every((box) => HEIF_TOP.has(box.type)));\n const metas = top.filter((box) => box.type === \"meta\");\n check(metas.length === 1);\n const meta = metas[0]!;\n // A FullBox: version and flags first.\n const children = boxes(b, meta.body + 4, meta.end);\n check(children.every((box) => HEIF_META.has(box.type)));\n const one = (type: string) => {\n const of = children.filter((box) => box.type === type);\n check(of.length <= 1);\n return of[0];\n };\n const iinf = one(\"iinf\"), iloc = one(\"iloc\"), idat = one(\"idat\");\n check(!!iinf && !!iloc);\n\n // The metadata items, by id.\n const metadata = new Set<number>();\n const infeVersion = b[iinf.body]!;\n const entries = boxes(b, iinf.body + 4 + (infeVersion === 0 ? 2 : 4), iinf.end);\n for (const infe of entries) {\n check(infe.type === \"infe\" && infe.body + 4 <= infe.end);\n const version = b[infe.body]!;\n // Versions 0 and 1 have no item type: this cannot tell what they hold.\n check(version === 2 || version === 3);\n let at = infe.body + 4;\n const id = version === 2 ? u16be(b, at) : u32be(b, at);\n at += version === 2 ? 2 : 4;\n check(at + 6 <= infe.end);\n if (HEIF_METADATA_ITEMS.has(text(b, at + 2, 4))) metadata.add(id);\n }\n\n // Where their bytes are (iloc), overwritten in a copy.\n const out = b.slice();\n const version = b[iloc.body]!;\n check(version <= 2);\n let at = iloc.body + 4;\n /** The next field of `size` bytes (0, 2, 4 or 8), big-endian. */\n const read = (size: number): number => {\n check(at + size <= iloc.end);\n const value = size === 0 ? 0 : size === 2 ? u16be(b, at) : size === 4 ? u32be(b, at) : size === 8 ? u32be(b, at) * 2 ** 32 + u32be(b, at + 4) : NaN;\n check(Number.isSafeInteger(value));\n at += size;\n return value;\n };\n const read2 = () => read(2);\n check(at + 2 <= iloc.end);\n const offsetSize = b[at]! >> 4, lengthSize = b[at]! & 15, baseSize = b[at + 1]! >> 4, indexSize = version > 0 ? b[at + 1]! & 15 : 0;\n check([offsetSize, lengthSize, baseSize, indexSize].every((size) => size === 0 || size === 4 || size === 8));\n at += 2;\n const count = read(version < 2 ? 2 : 4);\n for (let i = 0; i < count; i++) {\n const id = version < 2 ? read2() : read(4);\n const method = version > 0 ? read2() & 15 : 0;\n const reference = read2();\n const base = read(baseSize);\n const extents = read2();\n for (let e = 0; e < extents; e++) {\n if (indexSize) read(indexSize);\n const offset = read(offsetSize), length = read(lengthSize);\n if (!metadata.has(id)) continue;\n // Its bytes in this file (0) or in `idat` (1): a length of 0 (to the end) or another file, refused.\n check(reference === 0 && length > 0 && (method === 0 || (method === 1 && !!idat)));\n const start = (method === 1 ? idat!.body : 0) + base + offset, limit = method === 1 ? idat!.end : b.length;\n check(start + length <= limit);\n out.fill(0, start, start + length);\n }\n }\n return [out];\n}\n\n// GIF: the frames, their colour tables and timing (graphic control, plain text), the animation's loop (NETSCAPE2.0,\n// ANIMEXTS1.0) and its ICC profile stay byte for byte; comments, XMP and every other application extension go, and\n// whatever follows its end.\n\nconst GIF_APPS_KEPT = new Set([\"NETSCAPE2.0\", \"ANIMEXTS1.0\", \"ICCRGBG1012\"]);\n\nfunction stripGif(b: Uint8Array): Uint8Array[] {\n check(b.length >= 13);\n /** A colour table's bytes, from the flags that say it is there and its size. */\n const table = (flags: number) => (flags & 0x80 ? 3 << ((flags & 7) + 1) : 0);\n /** The end of the data sub-blocks at `at`, past their empty block. */\n const blocks = (at: number) => {\n for (;;) {\n check(at < b.length);\n const length = b[at]!;\n at += 1 + length;\n if (!length) return at;\n }\n };\n let at = 13 + table(b[10]!), framed = false;\n check(at <= b.length);\n const parts = [b.subarray(0, at)];\n for (;;) {\n check(at < b.length);\n const introducer = b[at]!;\n if (introducer === 0x3b) {\n check(framed);\n parts.push(Uint8Array.of(0x3b));\n return parts;\n }\n if (introducer === 0x2c) {\n // Image descriptor, its local colour table, the LZW code size, the image data.\n check(at + 10 <= b.length);\n const data = at + 10 + table(b[at + 9]!);\n check(data < b.length);\n const end = blocks(data + 1);\n parts.push(b.subarray(at, end));\n framed = true;\n at = end;\n continue;\n }\n check(introducer === 0x21 && at + 2 < b.length);\n const label = b[at + 1]!, end = blocks(at + 2);\n const app = label === 0xff && b[at + 2] === 11 && GIF_APPS_KEPT.has(text(b, at + 3, 11));\n if (label === 0xf9 || label === 0x01 || app) parts.push(b.subarray(at, end));\n else check(label === 0xfe || label === 0xff);\n at = end;\n }\n}\n\n// TIFF: what draws it stays where it is (size, strips or tiles, colour, Orientation, ICC profile); its text tags (Make,\n// Model, DateTime, Artist, Software, its description), XMP, IPTC and Photoshop's resources are overwritten with zeros\n// where they are, and the Exif and GPS IFDs left without an entry, so no offset in the file moves. A tag this does not\n// know, sub-images, JPEG-compressed data (whose own segments could hold an Exif) or a maker note refuses the picture:\n// so camera raw files (DNG, CR2, NEF, ARW), and BigTIFF, are refused.\n\nconst TIFF_DRAWS = new Set([\n 254, 255, 256, 257, 258, 259, 262, 263, 264, 265, 266, 273, 274, 277, 278, 279, 280, 281, 282, 283, 284, 286, 287, 290,\n 291, 292, 293, 296, 297, 301, 317, 318, 319, 320, 321, 322, 323, 324, 325, 332, 334, 336, 338, 339, 340, 341, 529, 530,\n 531, 532, 0x8773,\n]);\n/** Text and documents about the picture: DocumentName to HostComputer, InkNames, XMP, Copyright, IPTC, Photoshop, Windows' XP tags, PrintIM. */\nconst TIFF_METADATA = new Set([269, 270, 271, 272, 285, 305, 306, 315, 316, 333, 700, 0x8298, 0x83bb, 0x8649, 0x4746, 0x4749, 0x9c9b, 0x9c9c, 0x9c9d, 0x9c9e, 0x9c9f, 0xc4a5]);\n/** The IFDs of Exif, GPS and interoperability, emptied whole. */\nconst TIFF_METADATA_IFDS = new Set([0x8769, 0x8825, 0xa005]);\n/** Compression without JPEG: none, CCITT, LZW, Deflate, PackBits. */\nconst TIFF_COMPRESSION = new Set([1, 2, 3, 4, 5, 8, 32773, 32946]);\n/** Bytes per value of each field type. */\nconst TIFF_TYPE_BYTES = [0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4];\n\nfunction stripTiff(b: Uint8Array): Uint8Array[] {\n const little = b[0] === 0x49;\n const u16 = (at: number) => { check(at + 2 <= b.length); return little ? b[at]! | (b[at + 1]! << 8) : u16be(b, at); };\n const u32 = (at: number) => { check(at + 4 <= b.length); return little ? u32le(b, at) : u32be(b, at); };\n check(b.length >= 8 && u16(2) === 42);\n const out = b.slice(), seen = new Set<number>();\n /** An IFD's entries: tag, type, the value's first byte (in the entry or where it points) and its bytes. */\n const entries = (ifd: number) => {\n check(ifd >= 8 && !seen.has(ifd) && seen.size < 1024);\n seen.add(ifd);\n const count = u16(ifd), next = ifd + 2 + count * 12;\n u32(next);\n return {\n next,\n list: Array.from({ length: count }, (_, i) => {\n const at = ifd + 2 + i * 12, tag = u16(at), type = u16(at + 2);\n check(type >= 1 && type < TIFF_TYPE_BYTES.length);\n const bytes = TIFF_TYPE_BYTES[type]! * u32(at + 4);\n const value = bytes <= 4 ? at + 8 : u32(at + 8);\n check(Number.isSafeInteger(bytes) && value + bytes <= b.length);\n return { at, tag, type, value, bytes };\n }),\n };\n };\n /** An Exif, GPS or interoperability IFD: every value zeroed, then the IFD itself, so it holds no entry. */\n const empty = (ifd: number) => {\n const { next, list } = entries(ifd);\n for (const entry of list) {\n check(entry.tag !== 0x927c);\n if (TIFF_METADATA_IFDS.has(entry.tag)) empty(u32(entry.value));\n out.fill(0, entry.value, entry.value + entry.bytes);\n }\n out.fill(0, ifd, next + 4);\n };\n for (let ifd = u32(4); ifd;) {\n const { next, list } = entries(ifd);\n for (const { tag, value, bytes } of list) {\n if (tag === 259) check(TIFF_COMPRESSION.has(u16(value)));\n if (TIFF_METADATA_IFDS.has(tag)) empty(u32(value));\n else if (TIFF_METADATA.has(tag)) out.fill(0, value, value + bytes);\n else check(TIFF_DRAWS.has(tag));\n }\n ifd = u32(next);\n }\n return [out];\n}\n\nconst STRIP: Record<Kind, (b: Uint8Array) => Uint8Array[]> = { jpeg: stripJpeg, png: stripPng, webp: stripWebp, heif: stripHeif, gif: stripGif, tiff: stripTiff };\n\n/**\n * A picture's bytes without its metadata, as parts to put in a Blob; undefined when the file is not a picture this\n * strips (by its bytes and its type), so it goes as it is. Throws `NO_PICTURE_METADATA` when it is one but its\n * metadata cannot be removed.\n */\nexport function stripPictureMetadata(bytes: Uint8Array, mime: string): Uint8Array[] | undefined {\n const kind = kindOf(bytes);\n if (!kind) {\n if (STRIPPED_TYPES.has(mime.split(\";\")[0]!.trim().toLowerCase())) throw new Error(NO_PICTURE_METADATA);\n return undefined;\n }\n return STRIP[kind](bytes);\n}\n\n/**\n * Whether a file is a picture whose metadata goes before it is sent, by its first `PICTURE_METADATA_LIMITS.headBytes`\n * bytes or by its type: then it is read whole and stripped (`stripPictureMetadata`), else it goes as it is.\n */\nexport function isStrippedPicture(head: Uint8Array, mime: string): boolean {\n return !!kindOf(head) || STRIPPED_TYPES.has(mime.split(\";\")[0]!.trim().toLowerCase());\n}\n\n/**\n * `source` as it is sent: without its metadata when it is a picture (`stripPictureMetadata`), or undefined when it is\n * not one and goes as it is. Only its first bytes are read for any other file. Throws `NO_PICTURE_METADATA` for a\n * picture that cannot be stripped or is past `PICTURE_METADATA_LIMITS.maxBytes`; an error reading `source` as it is.\n */\nexport async function withoutPictureMetadata(source: Blob, mime: string): Promise<Blob | undefined> {\n const head = new Uint8Array(await source.slice(0, PICTURE_METADATA_LIMITS.headBytes).arrayBuffer());\n if (!isStrippedPicture(head, mime)) return undefined;\n if (source.size > PICTURE_METADATA_LIMITS.maxBytes) throw new Error(NO_PICTURE_METADATA);\n const parts = stripPictureMetadata(new Uint8Array(await source.arrayBuffer()), mime);\n return parts && new Blob(parts as BlobPart[], { type: mime });\n}\n","/**\n * Payment URIs for a wallet that is not Ghostly: what a QR code shows and what a `lightning:` or\n * `bitcoin:` link opens. Building them is all this does; whether the payment arrives is watched by the\n * payee's own source, never assumed from the link having been opened.\n *\n * - `lightning:<invoice>` ([BOLT 11](https://github.com/lightning/bolts/blob/master/11-payment-encoding.md)).\n * - `bitcoin:<address>?amount=<btc>&lightning=<invoice>` ([BIP 21](https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki)),\n * with the `lightning` parameter of the unified QR convention when an invoice exists too.\n * - `bitcoin:?ark=<address>&amount=<btc>` for an Ark address, the BIP 21 form Ark wallets read.\n */\nexport type PaymentUriInput =\n | { kind: \"lightning\"; invoice: string }\n | { kind: \"bitcoin\"; address: string; amountSat?: number; label?: string; message?: string; lightning?: string }\n | { kind: \"ark\"; address: string; amountSat?: number };\n\n/** Whole sats as the decimal BTC amount BIP 21 wants (`21` → `0.00000021`), never in exponent form. */\nexport function satsToBtc(sats: number): string {\n if (!Number.isSafeInteger(sats) || sats < 0) throw new Error(\"Amount must be a whole number of sats\");\n const whole = Math.floor(sats / 100_000_000);\n const fraction = String(sats % 100_000_000).padStart(8, \"0\").replace(/0+$/, \"\");\n return fraction ? `${whole}.${fraction}` : String(whole);\n}\n\nconst cleanInvoice = (invoice: string) => invoice.trim().toLowerCase().replace(/^lightning:/, \"\");\n\n/** The URI to open in another wallet. Throws on an input that cannot be one. */\nexport function paymentUri(input: PaymentUriInput): string {\n if (input.kind === \"lightning\") {\n const invoice = cleanInvoice(input.invoice);\n if (!/^ln[a-z0-9]+$/.test(invoice)) throw new Error(\"That is not a Lightning invoice\");\n return `lightning:${invoice}`;\n }\n const params = new URLSearchParams();\n if (input.kind === \"ark\") {\n if (!/^[a-z0-9]+$/i.test(input.address)) throw new Error(\"That is not an Ark address\");\n params.set(\"ark\", input.address);\n if (input.amountSat) params.set(\"amount\", satsToBtc(input.amountSat));\n return `bitcoin:?${params.toString()}`;\n }\n if (!/^[a-zA-Z0-9]+$/.test(input.address)) throw new Error(\"That is not a Bitcoin address\");\n if (input.amountSat) params.set(\"amount\", satsToBtc(input.amountSat));\n if (input.label) params.set(\"label\", input.label.slice(0, 140));\n if (input.message) params.set(\"message\", input.message.slice(0, 140));\n if (input.lightning) params.set(\"lightning\", cleanInvoice(input.lightning));\n // `+` would be read as a space by some wallets; BIP 21 wants percent-encoding.\n const query = params.toString().replace(/\\+/g, \"%20\");\n return query ? `bitcoin:${input.address}?${query}` : `bitcoin:${input.address}`;\n}\n\n/**\n * What to put in the QR code: a `lightning:` URI in upper case, so the code uses the smaller alphanumeric\n * mode every Lightning wallet reads; anything with characters outside that mode as it is.\n */\nexport function qrText(uri: string): string {\n const upper = uri.toUpperCase();\n return /^[A-Z0-9 $%*+\\-./:]*$/.test(upper) ? upper : uri;\n}\n","/**\n * Which of two released versions is newer. Every client asks this of whatever\n * it found published, so a malformed answer must never read as an update: the\n * numbers are the only thing trusted here, and anything else sorts as older.\n */\n\n/** `1.2.3`, with an optional `v` and an optional `-beta.1` this ignores. */\nconst RELEASE = /^v?(\\d{1,6})\\.(\\d{1,6})\\.(\\d{1,6})(?:[-+].*)?$/;\n\nfunction parse(version: string): [number, number, number] | null {\n const match = RELEASE.exec(version.trim());\n return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;\n}\n\n/** Negative when `a` is older, positive when it is newer, 0 when they match or either is not a version. */\nexport function compareVersions(a: string, b: string): number {\n const left = parse(a);\n const right = parse(b);\n if (!left || !right) return 0;\n for (let i = 0; i < 3; i++) {\n if (left[i] !== right[i]) return left[i] - right[i];\n }\n return 0;\n}\n\n/** Whether `latest` is worth updating to from `current`. Unparseable input is never an update. */\nexport function isNewerVersion(latest: string, current: string): boolean {\n return compareVersions(latest, current) > 0;\n}\n","/**\n * Whether this device's own clock seems to be off, and by how much, so the app can say so where people look at the\n * connection (the chat's connection panel, Settings → Network): \"This device's clock seems to be off by about 2 minutes.\n * Chats may be slow to connect.\"\n *\n * Ghostly dates what it publishes by this device's clock, and several of its checks hold a contact's dates against\n * it. A clock a few minutes off makes chats and groups slow to connect, or never connect with apps that have not been\n * updated, and nothing on screen says why. The app cannot set the clock; it can notice and say.\n *\n * What it hears (`ClockWatch`), each as \"this clock minus theirs is between `low` and `high`\":\n * - a **server**: the `Date` header of an HTTP answer (a Pkarr relay's), a time to the second read between the moment\n * the request went out and the moment its answer came. Where a browser may not read that header of another origin,\n * there is none.\n * - a **contact**: the time of a contact's packet that came between two close reads of its record. Its own clock dated\n * it, and this device knows within seconds when it was published.\n *\n * The rule, on purpose slow to say yes, and never on one contact's word (it is as likely that contact's clock):\n * - a source says \"off\" only when everything it allows is more than `CLOCK_OFF_MS` on one side;\n * - two servers that both say so, the same way, are enough: servers keep time;\n * - else one server and a contact that say so, with no contact saying otherwise;\n * - else three contacts that say so, the same way, and at least three for each one that does not.\n * The amount is the middle of what the sources that say so give (the servers', when two do). Evidence older than\n * `CLOCK_EVIDENCE_MS` says nothing: a clock that was set right is believed at the next answer, and the note goes away.\n */\n/** A clock closer than this to the others' is not said to be off: a minute is what apps up to 1.0.2 allow at their strictest. */\nexport const CLOCK_OFF_MS = 60_000;\n/** Evidence older than this says nothing about the clock now. */\nexport const CLOCK_EVIDENCE_MS = 30 * 60_000;\n/** Contacts that must say so when no server does. */\nexport const CLOCK_PEERS = 3;\n/** Servers that are enough by themselves. */\nexport const CLOCK_SERVERS = 2;\n/** A contact's packet says something only when the two reads around it were this close. */\nexport const CLOCK_PEER_READ_GAP_MS = 15_000;\n/** Sources kept of each kind: a profile has a few relays, and may have hundreds of contacts. */\nconst KEPT = 64;\n\nexport interface ClockSample { low: number; high: number; at: number }\n\n/** -1: everything the sample allows is behind by more than `CLOCK_OFF_MS`; 1: ahead; 0: it does not say. */\nconst says = (sample: ClockSample): -1 | 0 | 1 => (sample.low > CLOCK_OFF_MS ? 1 : sample.high < -CLOCK_OFF_MS ? -1 : 0);\nconst middle = (values: number[]): number => { const sorted = [...values].sort((a, b) => a - b); return sorted[Math.floor((sorted.length - 1) / 2)]; };\n\n/**\n * The rule alone: how far this clock is from the others' (ms, positive when it is ahead) when the samples fresh at\n * `now` say it is clearly off, else null.\n */\nexport function clockOffset(servers: ReadonlyMap<string, ClockSample>, peers: ReadonlyMap<string, ClockSample>, now: number): number | null {\n const fresh = (samples: ReadonlyMap<string, ClockSample>) => [...samples.values()].filter(s => now - s.at < CLOCK_EVIDENCE_MS);\n const s = fresh(servers), p = fresh(peers);\n const mid = (sample: ClockSample) => (sample.low + sample.high) / 2;\n for (const way of [1, -1] as const) {\n const serversOff = s.filter(x => says(x) === way), peersOff = p.filter(x => says(x) === way);\n const serversNot = s.length - serversOff.length, peersNot = p.length - peersOff.length;\n if (serversOff.length >= CLOCK_SERVERS && serversNot === 0) return Math.round(middle(serversOff.map(mid)));\n // A server that does not say so, when one could be read, outweighs any number of contacts.\n if (serversNot > 0) continue;\n if (serversOff.length === 1 && peersOff.length >= 1 && peersNot === 0) return Math.round(middle([...serversOff, ...peersOff].map(mid)));\n if (peersOff.length >= CLOCK_PEERS && peersOff.length >= 3 * peersNot) return Math.round(middle(peersOff.map(mid)));\n }\n return null;\n}\n\nexport class ClockWatch {\n private readonly servers = new Map<string, ClockSample>();\n private readonly peers = new Map<string, ClockSample>();\n private was: number | null = null;\n private timer: ReturnType<typeof setTimeout> | null = null;\n\n /** `onChange`: what `offset` says changed (it appeared, went away, or moved by a minute). */\n constructor(private readonly onChange: (offset: number | null) => void = () => {}, private readonly now: () => number = Date.now) {}\n\n /**\n * A server's time: `date` (ms, to the second) from an answer to a request that went out at `sent` and came back at\n * `received`, both by this clock.\n */\n server(source: string, date: number, sent: number, received: number): void {\n if (!Number.isFinite(date) || date <= 0 || received < sent) return;\n // The answer was made somewhere between the two, at a server time between `date` and the end of that second.\n this.keep(this.servers, source, { low: sent - date - 999, high: received - date, at: this.now() });\n }\n\n /**\n * A contact's packet, dated `packetAt` by its clock, that came between this device's reads of its record at\n * `readBefore` and `readAt` (this clock). Says nothing when the two reads were far apart.\n */\n peer(peer: string, packetAt: number, readBefore: number, readAt: number): void {\n if (!(readBefore > 0) || readAt < readBefore || readAt - readBefore > CLOCK_PEER_READ_GAP_MS || !Number.isFinite(packetAt)) return;\n this.keep(this.peers, peer, { low: readBefore - packetAt, high: readAt - packetAt, at: this.now() });\n }\n\n private keep(samples: Map<string, ClockSample>, source: string, sample: ClockSample): void {\n samples.delete(source);\n samples.set(source, sample);\n if (samples.size > KEPT) samples.delete(samples.keys().next().value!);\n this.settle();\n }\n\n /** This clock minus the others', in ms (positive: ahead), when it is clearly off; else null. */\n get offset(): number | null { return clockOffset(this.servers, this.peers, this.now()); }\n\n /** The clock was set, or the evidence is of another time: nothing is known until the next answers. */\n reset(): void {\n this.servers.clear();\n this.peers.clear();\n this.settle();\n }\n\n /** Stops the timer that lets the evidence age out. */\n close(): void {\n if (this.timer) clearTimeout(this.timer);\n this.timer = null;\n }\n\n private settle(): void {\n this.close();\n for (const samples of [this.servers, this.peers]) for (const [source, sample] of samples) if (this.now() - sample.at >= CLOCK_EVIDENCE_MS) samples.delete(source);\n const offset = this.offset;\n if (offset !== null) {\n // Looked at again when the oldest evidence ages out: what is left may no longer be enough.\n const oldest = Math.min(...[...this.servers.values(), ...this.peers.values()].map(s => s.at));\n this.timer = setTimeout(() => this.settle(), Math.max(1_000, oldest + CLOCK_EVIDENCE_MS - this.now()));\n (this.timer as { unref?: () => void }).unref?.();\n }\n // Told again only when it would read differently: the note says minutes.\n const reads = (value: number | null) => (value === null ? null : Math.round(value / 60_000));\n if (reads(offset) === reads(this.was)) return;\n this.was = offset;\n this.onChange(offset);\n }\n}\n"],"mappings":";;;;;;;;;;;;AAYA,IAAa,0BAA0B;;CAErC,UAAU;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K,OAAO;CACd;;CAGA,IAAI,SAAwB;EAAE,OAAO,YAAY,KAAK,SAAS,KAAK,OAAO,KAAK,IAAI,CAAC;CAAG;;CAGxF,QAAc;EACZ,KAAK,QAAQ,MAAM;EACnB,KAAK,MAAM,MAAM;EACjB,KAAK,OAAO;CACd;;CAGA,QAAc;EACZ,IAAI,KAAK,OAAO,aAAa,KAAK,KAAK;EACvC,KAAK,QAAQ;CACf;CAEA,SAAuB;EACrB,KAAK,MAAM;EACX,KAAK,MAAM,WAAW,CAAC,KAAK,SAAS,KAAK,KAAK,GAAG,KAAK,MAAM,CAAC,QAAQ,WAAW,SAAS,IAAI,KAAK,IAAI,IAAI,OAAO,MAAA,MAAyB,QAAQ,OAAO,MAAM;EAChK,MAAM,SAAS,KAAK;EACpB,IAAI,WAAW,MAAM;GAEnB,MAAM,SAAS,KAAK,IAAI,GAAG,CAAC,GAAG,KAAK,QAAQ,OAAO,GAAG,GAAG,KAAK,MAAM,OAAO,CAAC,CAAC,CAAC,KAAI,MAAK,EAAE,EAAE,CAAC;GAC5F,KAAK,QAAQ,iBAAiB,KAAK,OAAO,GAAG,KAAK,IAAI,KAAO,SAAS,oBAAoB,KAAK,IAAI,CAAC,CAAC;GACrG,KAAM,MAAiC,QAAQ;EACjD;EAEA,MAAM,SAAS,UAA0B,UAAU,OAAO,OAAO,KAAK,MAAM,QAAQ,GAAM;EAC1F,IAAI,MAAM,MAAM,MAAM,MAAM,KAAK,GAAG,GAAG;EACvC,KAAK,MAAM;EACX,KAAK,SAAS,MAAM;CACtB;AACF"}
1
+ {"version":3,"file":"core.js","names":[],"sources":["../../core/src/paymentUri.ts","../../core/src/version.ts","../../core/src/clockWatch.ts"],"sourcesContent":["/**\n * Payment URIs for a wallet that is not Ghostly: what a QR code shows and what a `lightning:` or\n * `bitcoin:` link opens. Building them is all this does; whether the payment arrives is watched by the\n * payee's own source, never assumed from the link having been opened.\n *\n * - `lightning:<invoice>` ([BOLT 11](https://github.com/lightning/bolts/blob/master/11-payment-encoding.md)).\n * - `bitcoin:<address>?amount=<btc>&lightning=<invoice>` ([BIP 21](https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki)),\n * with the `lightning` parameter of the unified QR convention when an invoice exists too.\n * - `bitcoin:?ark=<address>&amount=<btc>` for an Ark address, the BIP 21 form Ark wallets read.\n */\nexport type PaymentUriInput =\n | { kind: \"lightning\"; invoice: string }\n | { kind: \"bitcoin\"; address: string; amountSat?: number; label?: string; message?: string; lightning?: string }\n | { kind: \"ark\"; address: string; amountSat?: number };\n\n/** Whole sats as the decimal BTC amount BIP 21 wants (`21` → `0.00000021`), never in exponent form. */\nexport function satsToBtc(sats: number): string {\n if (!Number.isSafeInteger(sats) || sats < 0) throw new Error(\"Amount must be a whole number of sats\");\n const whole = Math.floor(sats / 100_000_000);\n const fraction = String(sats % 100_000_000).padStart(8, \"0\").replace(/0+$/, \"\");\n return fraction ? `${whole}.${fraction}` : String(whole);\n}\n\nconst cleanInvoice = (invoice: string) => invoice.trim().toLowerCase().replace(/^lightning:/, \"\");\n\n/** The URI to open in another wallet. Throws on an input that cannot be one. */\nexport function paymentUri(input: PaymentUriInput): string {\n if (input.kind === \"lightning\") {\n const invoice = cleanInvoice(input.invoice);\n if (!/^ln[a-z0-9]+$/.test(invoice)) throw new Error(\"That is not a Lightning invoice\");\n return `lightning:${invoice}`;\n }\n const params = new URLSearchParams();\n if (input.kind === \"ark\") {\n if (!/^[a-z0-9]+$/i.test(input.address)) throw new Error(\"That is not an Ark address\");\n params.set(\"ark\", input.address);\n if (input.amountSat) params.set(\"amount\", satsToBtc(input.amountSat));\n return `bitcoin:?${params.toString()}`;\n }\n if (!/^[a-zA-Z0-9]+$/.test(input.address)) throw new Error(\"That is not a Bitcoin address\");\n if (input.amountSat) params.set(\"amount\", satsToBtc(input.amountSat));\n if (input.label) params.set(\"label\", input.label.slice(0, 140));\n if (input.message) params.set(\"message\", input.message.slice(0, 140));\n if (input.lightning) params.set(\"lightning\", cleanInvoice(input.lightning));\n // `+` would be read as a space by some wallets; BIP 21 wants percent-encoding.\n const query = params.toString().replace(/\\+/g, \"%20\");\n return query ? `bitcoin:${input.address}?${query}` : `bitcoin:${input.address}`;\n}\n\n/**\n * What to put in the QR code: a `lightning:` URI in upper case, so the code uses the smaller alphanumeric\n * mode every Lightning wallet reads; anything with characters outside that mode as it is.\n */\nexport function qrText(uri: string): string {\n const upper = uri.toUpperCase();\n return /^[A-Z0-9 $%*+\\-./:]*$/.test(upper) ? upper : uri;\n}\n","/**\n * Which of two released versions is newer. Every client asks this of whatever\n * it found published, so a malformed answer must never read as an update: the\n * numbers are the only thing trusted here, and anything else sorts as older.\n */\n\n/** `1.2.3`, with an optional `v` and an optional `-beta.1` this ignores. */\nconst RELEASE = /^v?(\\d{1,6})\\.(\\d{1,6})\\.(\\d{1,6})(?:[-+].*)?$/;\n\nfunction parse(version: string): [number, number, number] | null {\n const match = RELEASE.exec(version.trim());\n return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;\n}\n\n/** Negative when `a` is older, positive when it is newer, 0 when they match or either is not a version. */\nexport function compareVersions(a: string, b: string): number {\n const left = parse(a);\n const right = parse(b);\n if (!left || !right) return 0;\n for (let i = 0; i < 3; i++) {\n if (left[i] !== right[i]) return left[i] - right[i];\n }\n return 0;\n}\n\n/** Whether `latest` is worth updating to from `current`. Unparseable input is never an update. */\nexport function isNewerVersion(latest: string, current: string): boolean {\n return compareVersions(latest, current) > 0;\n}\n","/**\n * Whether this device's own clock seems to be off, and by how much, so the app can say so where people look at the\n * connection (the chat's connection panel, Settings → Network): \"This device's clock seems to be off by about 2 minutes.\n * Chats may be slow to connect.\"\n *\n * Ghostly dates what it publishes by this device's clock, and several of its checks hold a contact's dates against\n * it. A clock a few minutes off makes chats and groups slow to connect, or never connect with apps that have not been\n * updated, and nothing on screen says why. The app cannot set the clock; it can notice and say.\n *\n * What it hears (`ClockWatch`), each as \"this clock minus theirs is between `low` and `high`\":\n * - a **server**: the `Date` header of an HTTP answer (a Pkarr relay's), a time to the second read between the moment\n * the request went out and the moment its answer came. Where a browser may not read that header of another origin,\n * there is none.\n * - a **contact**: the time of a contact's packet that came between two close reads of its record. Its own clock dated\n * it, and this device knows within seconds when it was published.\n *\n * The rule, on purpose slow to say yes, and never on one contact's word (it is as likely that contact's clock):\n * - a source says \"off\" only when everything it allows is more than `CLOCK_OFF_MS` on one side;\n * - two servers that both say so, the same way, are enough: servers keep time;\n * - else one server and a contact that say so, with no contact saying otherwise;\n * - else three contacts that say so, the same way, and at least three for each one that does not.\n * The amount is the middle of what the sources that say so give (the servers', when two do). Evidence older than\n * `CLOCK_EVIDENCE_MS` says nothing: a clock that was set right is believed at the next answer, and the note goes away.\n */\n/** A clock closer than this to the others' is not said to be off: a minute is what apps up to 1.0.2 allow at their strictest. */\nexport const CLOCK_OFF_MS = 60_000;\n/** Evidence older than this says nothing about the clock now. */\nexport const CLOCK_EVIDENCE_MS = 30 * 60_000;\n/** Contacts that must say so when no server does. */\nexport const CLOCK_PEERS = 3;\n/** Servers that are enough by themselves. */\nexport const CLOCK_SERVERS = 2;\n/** A contact's packet says something only when the two reads around it were this close. */\nexport const CLOCK_PEER_READ_GAP_MS = 15_000;\n/** Sources kept of each kind: a profile has a few relays, and may have hundreds of contacts. */\nconst KEPT = 64;\n\nexport interface ClockSample { low: number; high: number; at: number }\n\n/** -1: everything the sample allows is behind by more than `CLOCK_OFF_MS`; 1: ahead; 0: it does not say. */\nconst says = (sample: ClockSample): -1 | 0 | 1 => (sample.low > CLOCK_OFF_MS ? 1 : sample.high < -CLOCK_OFF_MS ? -1 : 0);\nconst middle = (values: number[]): number => { const sorted = [...values].sort((a, b) => a - b); return sorted[Math.floor((sorted.length - 1) / 2)]; };\n\n/**\n * The rule alone: how far this clock is from the others' (ms, positive when it is ahead) when the samples fresh at\n * `now` say it is clearly off, else null.\n */\nexport function clockOffset(servers: ReadonlyMap<string, ClockSample>, peers: ReadonlyMap<string, ClockSample>, now: number): number | null {\n const fresh = (samples: ReadonlyMap<string, ClockSample>) => [...samples.values()].filter(s => now - s.at < CLOCK_EVIDENCE_MS);\n const s = fresh(servers), p = fresh(peers);\n const mid = (sample: ClockSample) => (sample.low + sample.high) / 2;\n for (const way of [1, -1] as const) {\n const serversOff = s.filter(x => says(x) === way), peersOff = p.filter(x => says(x) === way);\n const serversNot = s.length - serversOff.length, peersNot = p.length - peersOff.length;\n if (serversOff.length >= CLOCK_SERVERS && serversNot === 0) return Math.round(middle(serversOff.map(mid)));\n // A server that does not say so, when one could be read, outweighs any number of contacts.\n if (serversNot > 0) continue;\n if (serversOff.length === 1 && peersOff.length >= 1 && peersNot === 0) return Math.round(middle([...serversOff, ...peersOff].map(mid)));\n if (peersOff.length >= CLOCK_PEERS && peersOff.length >= 3 * peersNot) return Math.round(middle(peersOff.map(mid)));\n }\n return null;\n}\n\nexport class ClockWatch {\n private readonly servers = new Map<string, ClockSample>();\n private readonly peers = new Map<string, ClockSample>();\n private was: number | null = null;\n private timer: ReturnType<typeof setTimeout> | null = null;\n\n /** `onChange`: what `offset` says changed (it appeared, went away, or moved by a minute). */\n constructor(private readonly onChange: (offset: number | null) => void = () => {}, private readonly now: () => number = Date.now) {}\n\n /**\n * A server's time: `date` (ms, to the second) from an answer to a request that went out at `sent` and came back at\n * `received`, both by this clock.\n */\n server(source: string, date: number, sent: number, received: number): void {\n if (!Number.isFinite(date) || date <= 0 || received < sent) return;\n // The answer was made somewhere between the two, at a server time between `date` and the end of that second.\n this.keep(this.servers, source, { low: sent - date - 999, high: received - date, at: this.now() });\n }\n\n /**\n * A contact's packet, dated `packetAt` by its clock, that came between this device's reads of its record at\n * `readBefore` and `readAt` (this clock). Says nothing when the two reads were far apart.\n */\n peer(peer: string, packetAt: number, readBefore: number, readAt: number): void {\n if (!(readBefore > 0) || readAt < readBefore || readAt - readBefore > CLOCK_PEER_READ_GAP_MS || !Number.isFinite(packetAt)) return;\n this.keep(this.peers, peer, { low: readBefore - packetAt, high: readAt - packetAt, at: this.now() });\n }\n\n private keep(samples: Map<string, ClockSample>, source: string, sample: ClockSample): void {\n samples.delete(source);\n samples.set(source, sample);\n if (samples.size > KEPT) samples.delete(samples.keys().next().value!);\n this.settle();\n }\n\n /** This clock minus the others', in ms (positive: ahead), when it is clearly off; else null. */\n get offset(): number | null { return clockOffset(this.servers, this.peers, this.now()); }\n\n /** The clock was set, or the evidence is of another time: nothing is known until the next answers. */\n reset(): void {\n this.servers.clear();\n this.peers.clear();\n this.settle();\n }\n\n /** Stops the timer that lets the evidence age out. */\n close(): void {\n if (this.timer) clearTimeout(this.timer);\n this.timer = null;\n }\n\n private settle(): void {\n this.close();\n for (const samples of [this.servers, this.peers]) for (const [source, sample] of samples) if (this.now() - sample.at >= CLOCK_EVIDENCE_MS) samples.delete(source);\n const offset = this.offset;\n if (offset !== null) {\n // Looked at again when the oldest evidence ages out: what is left may no longer be enough.\n const oldest = Math.min(...[...this.servers.values(), ...this.peers.values()].map(s => s.at));\n this.timer = setTimeout(() => this.settle(), Math.max(1_000, oldest + CLOCK_EVIDENCE_MS - this.now()));\n (this.timer as { unref?: () => void }).unref?.();\n }\n // Told again only when it would read differently: the note says minutes.\n const reads = (value: number | null) => (value === null ? null : Math.round(value / 60_000));\n if (reads(offset) === reads(this.was)) return;\n this.was = offset;\n this.onChange(offset);\n }\n}\n"],"mappings":";;;AAgBA,SAAgB,UAAU,MAAsB;CAC9C,IAAI,CAAC,OAAO,cAAc,IAAI,KAAK,OAAO,GAAG,MAAM,IAAI,MAAM,uCAAuC;CACpG,MAAM,QAAQ,KAAK,MAAM,OAAO,GAAW;CAC3C,MAAM,WAAW,OAAO,OAAO,GAAW,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,QAAQ,OAAO,EAAE;CAC9E,OAAO,WAAW,GAAG,MAAM,GAAG,aAAa,OAAO,KAAK;AACzD;AAEA,IAAM,gBAAgB,YAAoB,QAAQ,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,eAAe,EAAE;;AA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
1
+ import { Qw as utf8Encode, Ww as fromBase64Url, Yw as toBase64Url, Zw as utf8Decode, ka as decodeBolt11 } from "./src-BZy4lDju.js";
2
2
  import { t as NothingSpentError } from "./types-DvtCy3WB.js";
3
3
  import { ed25519 } from "@noble/curves/ed25519.js";
4
4
  import { sha256 } from "@noble/hashes/sha2.js";
@@ -537,4 +537,4 @@ var FAKE_IDENTITY_PROVIDERS = [
537
537
  //#endregion
538
538
  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 };
539
539
 
540
- //# sourceMappingURL=fakes-Cyfc_vXC.js.map
540
+ //# sourceMappingURL=fakes-BTB2ugB3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fakes-Cyfc_vXC.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\n/**\n * A suite's switch in the page's storage (`localStorage[\"ghostly-test-…\"]`), read only in a test build (`testBuild`): a\n * release build reads none, so a leftover or pasted key changes nothing there. Null when unset, unreadable or released.\n */\nexport const testSwitch = (key: string): string | null => {\n if (!testBuild()) return null;\n try { return globalThis.localStorage?.getItem(key) ?? null; } catch { return null; }\n};\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,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I,MAAM,4BAA4B;GAAG,OAAO;EAAG;CAAE;CACzM,UAAU;EAAE,aAAa;EAAI,SAAS;CAAI;CAC1C,SAAS,EAAE,cAAc,KAAK;CAC9B,SAAS;CACT,SAAS,CAAC;EAAE,IAAI;EAAgB,MAAM;EAAW,OAAO;EACtD,eAAc,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"}
1
+ {"version":3,"file":"fakes-BTB2ugB3.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\n/**\n * A suite's switch in the page's storage (`localStorage[\"ghostly-test-…\"]`), read only in a test build (`testBuild`): a\n * release build reads none, so a leftover or pasted key changes nothing there. Null when unset, unreadable or released.\n */\nexport const testSwitch = (key: string): string | null => {\n if (!testBuild()) return null;\n try { return globalThis.localStorage?.getItem(key) ?? null; } catch { return null; }\n};\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;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C5B,SAAS;EAAE,OAAO;EAAQ,aAAa;EAAS,YAAW,UAAS;GAAE,MAAM,IAAI,MAAM,KAAK,CAAC,CAAC,YAAY;GAAG,IAAI,CAAC,oBAAoB,KAAK,CAAC,GAAG,MAAM,IAAI,MAAM,4BAA4B;GAAG,OAAO;EAAG;CAAE;CACzM,UAAU;EAAE,aAAa;EAAI,SAAS;CAAI;CAC1C,SAAS,EAAE,cAAc,KAAK;CAC9B,SAAS;CACT,SAAS,CAAC;EAAE,IAAI;EAAgB,MAAM;EAAW,OAAO;EACtD,eAAc,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 CHANGED
@@ -1,2 +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-Cyfc_vXC.js";
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-BTB2ugB3.js";
2
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 };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { Bd as TRANSPORTS, Vu as IDENTITY_MAX_EVIDENCE, Wu as IDENTITY_MAX_VALIDITY, ad as newIdentityBinding, ia as isBitcoinAddress, ka as decodeBolt11, nd as identityStatement } from "./src-DytzSJB6.js";
1
+ import { $u as IDENTITY_MAX_VALIDITY, Xu as IDENTITY_MAX_EVIDENCE, Yd as TRANSPORTS, dd as identityStatement, ia as isBitcoinAddress, ka as decodeBolt11, md as newIdentityBinding } from "./src-BZy4lDju.js";
2
2
  import { a as describeProvider, c as offeredIn, i as PROVIDER_PLATFORMS, l as providerDescriptorProblems, n as PROVIDER_ID, o as isNothingSpentError, r as PROVIDER_NETWORKS, s as networkMode, t as NothingSpentError, u as redact } from "./types-DvtCy3WB.js";
3
- import { i as verifyIdentity, n as boundedIdentityFetch, r as descriptorProblems, t as availableSigners } from "./verify-BC1Eu1lE.js";
3
+ import { i as verifyIdentity, n as boundedIdentityFetch, r as descriptorProblems, t as availableSigners } from "./verify-Bcd7K4q-.js";
4
4
  //#region ../browser/src/proofs/contract.ts
5
5
  var IDENTITY_PLATFORMS = [
6
6
  "web",
@@ -1,4 +1,4 @@
1
- import { Bw as __require, Lw as __commonJSMin, Rw as __esmMin, Vw as __toCommonJS, zw as __exportAll } from "./src-DytzSJB6.js";
1
+ import { $w as __commonJSMin, eT as __esmMin, nT as __require, rT as __toCommonJS, tT as __exportAll } from "./src-BZy4lDju.js";
2
2
  //#region ../../node_modules/compact-encoding/endian.js
3
3
  var require_endian = /* @__PURE__ */ __commonJSMin(((exports) => {
4
4
  exports.BE = !(exports.LE = new Uint8Array(new Uint16Array([255]).buffer)[0] === 255);
@@ -76480,4 +76480,4 @@ var require_keet_identity_key = /* @__PURE__ */ __commonJSMin(((exports, module)
76480
76480
  //#endregion
76481
76481
  export default require_keet_identity_key();
76482
76482
 
76483
- //# sourceMappingURL=keet-identity-key-uq3scTiE.js.map
76483
+ //# sourceMappingURL=keet-identity-key-a4pR0QSm.js.map