@ghostlytools/sdk 1.11.0 → 1.11.2

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 (41) hide show
  1. package/dist/app.js +5 -2
  2. package/dist/app.js.map +1 -1
  3. package/dist/core.js +280 -2
  4. package/dist/core.js.map +1 -1
  5. package/dist/{fakes-Cu6mpUKs.js → fakes-DCH5oJMm.js} +3 -3
  6. package/dist/{fakes-Cu6mpUKs.js.map → fakes-DCH5oJMm.js.map} +1 -1
  7. package/dist/fakes.js +1 -1
  8. package/dist/index.js +3 -3
  9. package/dist/{keet-identity-key-DHlSH_39.js → keet-identity-key-3EEmDkxz.js} +2 -2
  10. package/dist/{keet-identity-key-DHlSH_39.js.map → keet-identity-key-3EEmDkxz.js.map} +1 -1
  11. package/dist/{src-i6IUh-ng.js → src-DA7T3Gvo.js} +1247 -269
  12. package/dist/src-DA7T3Gvo.js.map +1 -0
  13. package/dist/testing.js +4 -4
  14. package/dist/types/browser/src/engine/paymentAdapters/providers/types.d.ts +6 -1
  15. package/dist/types/core/src/audioMetadata.d.ts +23 -0
  16. package/dist/types/core/src/catchUp.d.ts +2 -0
  17. package/dist/types/core/src/chatFiles.d.ts +6 -0
  18. package/dist/types/core/src/clipboardGuard.d.ts +43 -0
  19. package/dist/types/core/src/dhtDelivery.d.ts +13 -0
  20. package/dist/types/core/src/didDht.d.ts +6 -4
  21. package/dist/types/core/src/frames.d.ts +11 -0
  22. package/dist/types/core/src/ghostlink.d.ts +20 -0
  23. package/dist/types/core/src/groupCommunity.d.ts +7 -1
  24. package/dist/types/core/src/groupSession.d.ts +18 -1
  25. package/dist/types/core/src/http.d.ts +16 -2
  26. package/dist/types/core/src/identity.d.ts +8 -1
  27. package/dist/types/core/src/identityProofs.d.ts +7 -0
  28. package/dist/types/core/src/index.d.ts +3 -0
  29. package/dist/types/core/src/miniApp.d.ts +4 -1
  30. package/dist/types/core/src/pairedAppRanges.d.ts +5 -0
  31. package/dist/types/core/src/relay.d.ts +7 -4
  32. package/dist/types/core/src/transport.d.ts +3 -1
  33. package/dist/types/core/src/videoMetadata.d.ts +8 -2
  34. package/dist/types/core/src/viewerGuard.d.ts +20 -7
  35. package/dist/{types-DvtCy3WB.js → types-DYLIIkU8.js} +2 -1
  36. package/dist/types-DYLIIkU8.js.map +1 -0
  37. package/dist/{verify-BoaDPIrS.js → verify-DsXR5sRX.js} +2 -2
  38. package/dist/{verify-BoaDPIrS.js.map → verify-DsXR5sRX.js.map} +1 -1
  39. package/package.json +1 -1
  40. package/dist/src-i6IUh-ng.js.map +0 -1
  41. package/dist/types-DvtCy3WB.js.map +0 -1
package/dist/testing.js CHANGED
@@ -1,7 +1,7 @@
1
- import { CT as createIdentity, Zu as IDENTITY_MAX_EVIDENCE, cd as IdentityExchange, dd as emptyIdentityLedger, hd as identityStatement, ia as isBitcoinAddress, ka as decodeBolt11, vd as newIdentityBinding } from "./src-i6IUh-ng.js";
2
- import { l as providerDescriptorProblems, o as isNothingSpentError } from "./types-DvtCy3WB.js";
3
- import { i as verifyIdentity, r as descriptorProblems } from "./verify-BoaDPIrS.js";
4
- 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-Cu6mpUKs.js";
1
+ import { Dd as newIdentityBinding, LT as createIdentity, Ma as decodeBolt11, _d as IdentityExchange, bd as emptyIdentityLedger, od as IDENTITY_MAX_EVIDENCE, sa as isBitcoinAddress, wd as identityStatement } from "./src-DA7T3Gvo.js";
2
+ import { l as providerDescriptorProblems, o as isNothingSpentError } from "./types-DYLIIkU8.js";
3
+ import { i as verifyIdentity, r as descriptorProblems } from "./verify-DsXR5sRX.js";
4
+ 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-DCH5oJMm.js";
5
5
  import { afterEach, describe, expect, it, vi } from "vitest";
6
6
  //#region ../browser/src/engine/paymentAdapters/providers/contractSuite.ts
7
7
  var WAIT = 1e4;
@@ -98,6 +98,11 @@ export interface ProviderDescriptor<P> {
98
98
  experimental?: boolean;
99
99
  /** Checks the form before anything is contacted; throws a message fit for the person. */
100
100
  validate?(settings: ProviderSettings, mode: WalletMode): void;
101
+ /**
102
+ * The wallet these (validated) settings reach, whatever their spelling: two sources with the same answer are one
103
+ * wallet, and the same balance. Absent: the same settings, byte for byte.
104
+ */
105
+ wallet?(settings: ProviderSettings): string;
101
106
  /** Connects. The engine then asks `info()` and refuses a network of the other mode. */
102
107
  create(settings: ProviderSettings, host: ProviderHost): Promise<P>;
103
108
  }
@@ -114,7 +119,7 @@ export declare const PROVIDER_ID: RegExp;
114
119
  */
115
120
  export declare function providerDescriptorProblems(d: ProviderDescriptor<unknown>): string[];
116
121
  /** The serializable part of a descriptor, for the UI (a function cannot cross the extension's port). */
117
- export type ProviderDescriptorView = Omit<ProviderDescriptor<unknown>, "create" | "validate">;
122
+ export type ProviderDescriptorView = Omit<ProviderDescriptor<unknown>, "create" | "validate" | "wallet">;
118
123
  /** Only these fields reach the UI, whatever else a provider module keeps on its descriptor. */
119
124
  export declare const describeProvider: ({ id, label, kind, description, networks, platforms, fields, custodial, experimental }: ProviderDescriptor<unknown>) => ProviderDescriptorView;
120
125
  /**
@@ -0,0 +1,23 @@
1
+ import { type VideoPatch, type VideoSource } from "./videoMetadata.js";
2
+ export declare const AUDIO_METADATA_LIMITS: {
3
+ /** The largest header, element or tag read whole (an Ogg comment header with a picture in it): past this the file is refused. */
4
+ readonly maxReadBytes: number;
5
+ /** The most pages, chunks, blocks or elements walked. */
6
+ readonly maxParts: 1000000;
7
+ /** Bytes read first to tell an audio file from another file. */
8
+ readonly headBytes: 64;
9
+ };
10
+ /** Why an audio file is refused: its tags could not be removed, so it does not go at all. */
11
+ export declare const NO_AUDIO_METADATA = "This audio cannot be sent: Ghostly could not remove the details saved in it, like where it was recorded";
12
+ /**
13
+ * What `withoutAudioMetadata` changes in an audio file read from `source` (one not held in a Blob: a file kept in
14
+ * storage): the parts replaced, in order and apart, the rest of its bytes going as they are; undefined when it goes as
15
+ * it is. Throws `NO_AUDIO_METADATA` for one whose tags cannot be removed; an error reading `source` as it is.
16
+ */
17
+ export declare function audioMetadataPatches(file: VideoSource, mime: string): Promise<VideoPatch[] | undefined>;
18
+ /**
19
+ * `source` as it is sent: an audio file without its tags, made of `source`'s own bytes but for the parts emptied;
20
+ * undefined when it goes as it is (not one of these, or one with nothing to remove). Throws `NO_AUDIO_METADATA` for
21
+ * one whose tags cannot be removed; an error reading `source` as it is.
22
+ */
23
+ export declare function withoutAudioMetadata(source: Blob, mime: string): Promise<Blob | undefined>;
@@ -53,6 +53,8 @@ export declare class CatchUpAnswers<F> {
53
53
  * good. A frame the edge did not take ends the answer (the member asks again when its edge opens).
54
54
  */
55
55
  handOut(to: string, frames: F[]): void;
56
+ /** Whether an answer to `to` still has frames to send, or sent ones its app has not said it handled yet (`hooks.handled`). */
57
+ busy(to: string): boolean;
56
58
  /** The next slice of `rest` to `to`, as sent: undefined, and nothing left, when the edge did not take one. */
57
59
  private sendSlice;
58
60
  /** A slice's frames (`keys`) are on their way to `to` until `done`: its app handled them, or cannot say (`false`). */
@@ -316,6 +316,12 @@ export declare class ChatFiles {
316
316
  private readonly moving;
317
317
  /** Files that stopped sending for the chat's window alone: they go on once another's bytes are confirmed. */
318
318
  private readonly held;
319
+ /**
320
+ * Files this side cancelled while no session carried the cancel (`pf-abort`), said on the next one. The session also
321
+ * goes for a moment when a move swaps it (its capabilities are agreed again): unsaid, the receiver showed the file
322
+ * moving, its bytes kept, until its idle nudge asked 30 s later.
323
+ */
324
+ private readonly unsaid;
319
325
  private attached;
320
326
  private peerRoomValue;
321
327
  /** What the chat's files may have in flight, sized by the path. */
@@ -0,0 +1,43 @@
1
+ /**
2
+ * A contact's shared app on the web writes the clipboard only in the person's own tap in it. Its frames allow no
3
+ * `clipboard-write`, but Chromium lets `document.execCommand("copy")` write the system clipboard for as long as a tap's
4
+ * activation lasts (seconds, from a timer too), and no sandbox token or permissions policy turns that off. So this
5
+ * script runs first in each of the app's pages (`guardViewerAnswer`) and in the bridge (apps/web/src/svc/bridge.ts):
6
+ * - `execCommand("copy")` and `execCommand("cut")` work only while one of the person's own inputs in that window is
7
+ * being dispatched (a trusted `pointerdown`, `pointerup`, `mousedown`, `mouseup`, `click`, `auxclick`, `dblclick`,
8
+ * `contextmenu`, `touchstart`, `touchend`, `keydown`, `keypress` or `keyup`; no script can fire one), or a trusted
9
+ * `submit` or `change` that began while such an input's window was open, and only within a second of that input
10
+ * (from its own `timeStamp`, or from its dispatch where that is later or on another clock): Chromium lets a copy
11
+ * write for seconds after a tap, and a page that spins in its own listener keeps the input being dispatched all
12
+ * that time, while the person may copy something of their own in Ghostly. That window opens as the input is
13
+ * dispatched and closes at the first callback the guard queued at any input that runs (a message on a channel of
14
+ * its own, a `user-blocking` task where `scheduler.postTask` exists, an animation frame), so it holds the input's
15
+ * own dispatch and its default action: the submit of a click on a submit button or of Enter in a field, the change
16
+ * of a checkbox. It also covers the rendering step right after the input: the animation frame callbacks the page
17
+ * asked for before the input run in the frame right after it, ahead of the guard's message and `user-blocking`
18
+ * task (and of its own frame callback, which closes the window there), so a `submit` or `change` one of them fires
19
+ * counts. A `submit` or `change` fired by script (`requestSubmit()`, `click()`) from a timer, a promise, a message
20
+ * or an animation frame asked for at or after the input, or outside any input, does not count. So a copy button, a
21
+ * form, a checkbox, a double click or the app's own context menu copies on the person's tap, and nothing else does
22
+ * (not on load, not from a timer or a promise after a tap). `execCommand("paste")` is refused. Every other command
23
+ * passes as it is. The wrapped `execCommand` is left fixed in place (not writable, not configurable), once per
24
+ * window;
25
+ * - runs in a frame's window before the page holds it, as the WebRTC guard does (`VIEWER_GUARD_SCRIPT`): what a frame
26
+ * element hands out is guarded first, the frames of the document and of its shadow trees are gone over as one loads
27
+ * (an empty frame's first load fires as it is put in the page) and as the page changes, each `srcdoc` frame gets
28
+ * this script first, a declarative shadow root the page's script would make is refused, and with `VIEWER_GUARD_CSP`
29
+ * a `javascript:` URL is refused (its own Trusted Types default policy; one passes every other string on as it is,
30
+ * or, once the page made its own `default` policy, to that one's rules: the page's `createPolicy("default")` gets the
31
+ * guard's policy back with them, and the copy of itself it puts in a `srcdoc` frame skips them).
32
+ * A frame's window keeps what was run in it on its first, empty page when the page it loads is of the same origin (the
33
+ * bridge's guard reaches the app's frame then): there this script only watches the new document. Each document it
34
+ * watches is marked (`ghostlyClipboardGuard`, fixed in place): the bridge reads that to know the guard ran in the page
35
+ * it shows. It uses nothing the page can change after it ran (the page's own code runs later, in the same realm).
36
+ *
37
+ * A fence, not a wall, as the WebRTC guard's own: a frame's window read by its index (`window[0]`) before it loads,
38
+ * inside a shadow tree written in the HTML the page itself sends, is out of its sight.
39
+ * No backslash, `${` or backtick in it.
40
+ */
41
+ export declare const CLIPBOARD_GUARD_SCRIPT = "(function noClipboardWrites(w) {\n \"use strict\";\n try {\n const apply = w.Reflect.apply;\n const describe = w.Object.getOwnPropertyDescriptor;\n const define = w.Object.defineProperty;\n const proto = w.Document.prototype;\n const home = w.document;\n const exec = describe(proto, \"execCommand\");\n const fresh = !!exec && exec.configurable === true && typeof exec.value === \"function\";\n const watched = !!describe(home, \"ghostlyClipboardGuard\");\n if (!fresh && watched) return;\n if (!watched) define(home, \"ghostlyClipboardGuard\", { value: true });\n const own = \"<script>(\" + noClipboardWrites + \")(window)<\" + \"/script>\";\n const close = \"<\" + \"/script>\";\n const webRtc = \"<script>(function noWebRtc(\";\n const text = w.String;\n const lower = text.prototype.toLowerCase;\n const slice = text.prototype.slice;\n const index = text.prototype.indexOf;\n const listen = w.EventTarget.prototype.addEventListener;\n const shut = (inner) => {\n try { if (inner && inner !== w) noClipboardWrites(inner); } catch (e) {}\n };\n const count = describe(w, \"length\").get;\n const view = describe(proto, \"defaultView\").get;\n const sweep = () => {\n try { for (let i = apply(count, w, []); i-- > 0;) shut(w[i]); } catch (e) {}\n };\n const elements = w.Element.prototype;\n const getAttribute = elements.getAttribute;\n const setAttribute = elements.setAttribute;\n const removeAttribute = elements.removeAttribute;\n const attachShadow = elements.attachShadow;\n const size = describe(w.NodeList.prototype, \"length\").get;\n let passing = false;\n const first = (frame) => {\n const doc = apply(getAttribute, frame, [\"srcdoc\"]);\n if (doc === null) return;\n let at = 0;\n if (apply(slice, doc, [0, webRtc.length]) === webRtc) {\n const end = apply(index, doc, [close]);\n if (end >= 0) at = end + close.length;\n }\n if (apply(slice, doc, [at, at + own.length]) === own) return;\n passing = true;\n try { apply(setAttribute, frame, [\"srcdoc\", own + doc]); } catch (e) { apply(removeAttribute, frame, [\"srcdoc\"]); }\n passing = false;\n };\n const Observer = w.MutationObserver;\n const observe = Observer.prototype.observe;\n const watch = (root, all) => {\n const scan = () => {\n try {\n const frames = apply(all, root, [\"iframe[srcdoc]\"]);\n for (let i = apply(size, frames, []); i-- > 0;) first(frames[i]);\n } catch (e) {}\n sweep();\n };\n apply(observe, new Observer(scan), [root, { subtree: true, childList: true, attributes: true, attributeFilter: [\"srcdoc\"] }]);\n apply(listen, root, [\"load\", sweep, true]);\n scan();\n return root;\n };\n if (fresh) {\n const run = exec.value;\n const phase = describe(w.Event.prototype, \"eventPhase\").get;\n const trust = (event) => {\n try {\n const found = describe(event, \"isTrusted\");\n if (found && found.get && apply(found.get, event, []) === true) return found.get;\n } catch (e) {}\n return null;\n };\n const dispatching = (event, trusted) => {\n try { return apply(trusted, event, []) === true && apply(phase, event, []) !== 0; } catch (e) { return false; }\n };\n const stamp = describe(w.Event.prototype, \"timeStamp\");\n const clock = w.performance;\n const tick = clock && clock.now;\n const time = () => { try { return apply(tick, clock, []); } catch (e) { return NaN; } };\n const recent = (at) => time() - at <= 1000;\n const shutters = [];\n try {\n const channel = new w.MessageChannel();\n const post = w.MessagePort.prototype.postMessage;\n const out = channel.port2;\n channel.port1.onmessage = () => settle();\n shutters[0] = () => apply(post, out, [0]);\n } catch (e) {}\n try {\n const tasks = w.scheduler;\n const postTask = tasks && tasks.postTask;\n const urgent = { __proto__: null, priority: \"user-blocking\" };\n if (typeof postTask === \"function\") shutters[shutters.length] = () => { apply(postTask, tasks, [settle, urgent]); };\n } catch (e) {}\n try {\n const frame = w.requestAnimationFrame;\n if (typeof frame === \"function\") shutters[shutters.length] = () => { apply(frame, w, [settle]); };\n } catch (e) {}\n let tap = null;\n let trusted = null;\n let tapped = NaN;\n let open = 0;\n let follows = null;\n const settle = () => { open = 0; follows = null; };\n const seen = (event) => {\n const found = trust(event);\n if (found === null) return;\n let at = time();\n try {\n const given = apply(stamp.get, event, []);\n if (given >= 0 && given < at) at = given;\n } catch (e) {}\n tap = event;\n trusted = found;\n tapped = at;\n if (shutters.length === 0) return;\n open = 1;\n for (let i = 0; i < shutters.length; i++) { try { shutters[i](); } catch (e) {} }\n };\n const taps = [\"pointerdown\", \"pointerup\", \"mousedown\", \"mouseup\", \"click\", \"auxclick\", \"dblclick\", \"contextmenu\", \"touchstart\", \"touchend\", \"keydown\", \"keypress\", \"keyup\"];\n for (let i = 0; i < taps.length; i++) apply(listen, w, [taps[i], seen, true]);\n const followed = (event) => {\n if (open === 0) return;\n const found = trust(event);\n if (found !== null) follows = { event: event, trusted: found, at: tapped, next: follows };\n };\n apply(listen, w, [\"submit\", followed, true]);\n apply(listen, w, [\"change\", followed, true]);\n const tapping = () => {\n if (tap !== null && dispatching(tap, trusted) && recent(tapped)) return true;\n for (let f = follows; f !== null; f = f.next) if (dispatching(f.event, f.trusted) && recent(f.at)) return true;\n return false;\n };\n const guarded = function execCommand(command) {\n const name = apply(lower, text(command), []);\n if (name === \"paste\" || ((name === \"copy\" || name === \"cut\") && !tapping())) return false;\n const args = [name];\n for (let i = 1; i < arguments.length; i++) args[i] = arguments[i];\n return apply(run, this, args);\n };\n define(proto, \"execCommand\", { value: guarded, writable: false, enumerable: exec.enumerable, configurable: false });\n const types = w.trustedTypes;\n if (types && !types.defaultPolicy) {\n try {\n let rules = null;\n const rule = (kind) => (input, type, sink) => {\n if (kind === \"createScript\" && sink === \"Location href\") return null;\n if (passing || rules === null) return input;\n return rules[kind] ? apply(rules[kind], undefined, [input, type, sink]) : null;\n };\n const members = [\"createHTML\", \"createScript\", \"createScriptURL\"];\n const create = types.createPolicy;\n const policy = apply(create, types, [\"default\", { createHTML: rule(members[0]), createScript: rule(members[1]), createScriptURL: rule(members[2]) }]);\n const Mistyped = w.TypeError;\n w.Object.getPrototypeOf(types).createPolicy = function createPolicy(name, options) {\n if (this !== types || rules !== null || text(name) !== \"default\") return apply(create, this, arguments);\n const given = { createHTML: null, createScript: null, createScriptURL: null };\n for (let i = 0; i < members.length; i++) {\n const found = options ? options[members[i]] : undefined;\n if (found === undefined || found === null) continue;\n if (typeof found !== \"function\") throw new Mistyped(\"The policy's \" + members[i] + \" is not a function\");\n given[members[i]] = found;\n }\n rules = given;\n return policy;\n };\n } catch (e) {}\n }\n const reopen = proto.open;\n proto.open = function () {\n const got = apply(reopen, this, arguments);\n try { if (apply(view, this, []) === w) apply(listen, this, [\"load\", sweep, true]); } catch (e) {}\n return got;\n };\n const shadowed = (html) => apply(index, apply(lower, html, []), [\"shadowrootmode\"]) >= 0;\n const Refused = w.TypeError;\n const refuse = () => { throw new Refused(\"A declarative shadow root is not allowed here\"); };\n const parsers = [[elements, \"setHTMLUnsafe\"], [w.ShadowRoot && w.ShadowRoot.prototype, \"setHTMLUnsafe\"], [w.Document, \"parseHTMLUnsafe\"]];\n for (let i = 0; i < parsers.length; i++) {\n const owner = parsers[i][0];\n const name = parsers[i][1];\n const real = owner && owner[name];\n if (typeof real !== \"function\") continue;\n owner[name] = function (html) {\n const checked = text(html);\n if (shadowed(checked)) refuse();\n return apply(real, this, arguments.length > 1 ? [checked, arguments[1]] : [checked]);\n };\n }\n let tail = \"\";\n const writes = [\"write\", \"writeln\"];\n for (let i = 0; i < writes.length; i++) {\n const real = proto[writes[i]];\n if (typeof real !== \"function\") continue;\n proto[writes[i]] = function () {\n let checked = \"\";\n for (let j = 0; j < arguments.length; j++) checked += text(arguments[j]);\n if (shadowed(tail + checked)) refuse();\n tail = apply(slice, tail + checked, [-16]);\n return apply(real, this, [checked]);\n };\n }\n const kinds = [\"HTMLIFrameElement\", \"HTMLFrameElement\", \"HTMLObjectElement\", \"HTMLEmbedElement\"];\n const reads = [\"contentWindow\", \"contentDocument\", \"getSVGDocument\"];\n for (let k = 0; k < kinds.length; k++) {\n const owner = w[kinds[k]] && w[kinds[k]].prototype;\n for (let r = 0; r < reads.length; r++) {\n const name = reads[r];\n const found = owner && describe(owner, name);\n const key = found && found.get ? \"get\" : \"value\";\n if (!found || typeof found[key] !== \"function\") continue;\n const read = found[key];\n found[key] = function () {\n const got = apply(read, this, arguments);\n try { shut(name === \"contentWindow\" ? got : apply(view, got, [])); } catch (e) {}\n return got;\n };\n try { define(owner, name, found); } catch (e) {}\n }\n }\n const inShadow = w.DocumentFragment.prototype.querySelectorAll;\n if (attachShadow) {\n elements.attachShadow = function () {\n const root = apply(attachShadow, this, arguments);\n try { watch(root, inShadow); } catch (e) {}\n return root;\n };\n }\n }\n if (!watched) watch(home, proto.querySelectorAll);\n } catch (e) {}\n})(window)";
42
+ /** `CLIPBOARD_GUARD_SCRIPT`'s hash, as a CSP source: the bridge's policy and a contact's own are given it. */
43
+ export declare const CLIPBOARD_GUARD_HASH = "'sha256-ay9kpYD2BIflB8W9w+iAbo1krsFBwIJunUmXTACfhao='";
@@ -522,6 +522,19 @@ export declare class DhtDelivery {
522
522
  private publishOnTick;
523
523
  /** How long until the next read of the contact's mailbox (WISP 403, poll pace). */
524
524
  get pollMs(): number;
525
+ /**
526
+ * The contact is on DHT only and this side is not: a live link waits on the contact's envelope saying it left, and
527
+ * nothing else of the contact's shows before it (no offer is read, no dial taken, while its mailbox says DHT only). Its
528
+ * reads that are not background ones (the chat open, a text awaiting its receipt) then say `departed`: a few may go over
529
+ * the relays' minute (`DEPARTED_READS` in relay.ts, per mailbox, every relay together, 6 at the open chat's 10 s pace).
530
+ * As plain reads, an extension that stayed on Automatic, its minute spent by what it did before, read nothing of its
531
+ * contact for 40 s after the contact left DHT only, and the matrix's chat stayed "On DHT · retrying live" (E2E full,
532
+ * 2026-11-07 and 11-08). No more reads than before: those it made anyway, the minute spent, go within the allowance.
533
+ * Not while this side is leaving DHT only itself (`signalReads` left, `leavingRead`): its read at the switch stays a
534
+ * plain one, the rest are signaling, so the few requests past a spent minute stay for the dialling side's read of the
535
+ * answer. As a departed read, the switch's took one, and both sides leaving went live in 34 s, against 10.
536
+ */
537
+ private departedRead;
525
538
  /**
526
539
  * This side is DHT only, and nothing waits on the contact's mailbox: the contact, pinned, is away (nothing new of its
527
540
  * own in `PRESENCE_WINDOW`; it puts a keep-alive every four minutes while there), no text of ours awaits its receipt,
@@ -124,7 +124,7 @@ export type DidDhtFetch = (url: string, options?: {
124
124
  }) => Promise<DidDhtFetchResponse>;
125
125
  export interface ResolveDidDhtOptions {
126
126
  fetch: DidDhtFetch;
127
- /** Pkarr relays (or did:dht gateways, which answer the same GET) to ask in turn. Default: `DEFAULT_RELAYS`. */
127
+ /** Pkarr relays (or did:dht gateways, which answer the same GET) to ask, all of them. Default: `DEFAULT_RELAYS`. */
128
128
  relays?: string[];
129
129
  signal?: AbortSignal;
130
130
  }
@@ -147,9 +147,11 @@ export declare function openDidDhtPayload(did: string, payload: Uint8Array): Dec
147
147
  seq: bigint;
148
148
  };
149
149
  /**
150
- * Resolves a did:dht through Pkarr relays: one GET per relay, in turn, the next only when one has
151
- * nothing, fails or serves a packet that does not check out. The answer is bounded to a BEP44 item,
152
- * its signature checked against the DID's key and its records parsed strictly. A deactivated DID
150
+ * Resolves a did:dht through Pkarr relays: one GET to each, all at once, and the newest packet that
151
+ * checks out wins (the highest sequence number; on a tie, the relay listed first), so a relay holding
152
+ * an older version cannot bring back a removed key or undo a deactivation. Each answer is bounded to
153
+ * a BEP44 item, its signature checked against the DID's key and its records parsed strictly; a relay
154
+ * that has nothing, fails or serves a packet that does not check out does not count. A deactivated DID
153
155
  * resolves (`metadata.deactivated`); everything else that goes wrong throws a `DidDhtError`.
154
156
  */
155
157
  export declare function resolveDidDht(did: string, options: ResolveDidDhtOptions): Promise<DidDhtResolution>;
@@ -22,6 +22,12 @@ export declare const LIMITS: {
22
22
  readonly maxPathBytes: number;
23
23
  /** Requests a host serves at once for one peer. */
24
24
  readonly maxConcurrentRequestsPerPeer: 32;
25
+ /**
26
+ * Request-body bytes a host holds for one peer at once, from a body's first chunk until its local fetch settles.
27
+ * Past it a request is refused (`busy`). As much as a client's in-flight requests can carry, so only a peer that
28
+ * ignores that limit reaches it.
29
+ */
30
+ readonly maxHostBodyBytesPerPeer: number;
25
31
  /** Requests a client keeps in flight; the rest wait in a queue. */
26
32
  readonly maxClientInFlight: 16;
27
33
  /**
@@ -38,6 +44,11 @@ export declare const LIMITS: {
38
44
  readonly maxStoredIncomingBytesPerPeer: number;
39
45
  readonly requestTimeoutMs: 60000;
40
46
  readonly bodyIdleTimeoutMs: 30000;
47
+ /**
48
+ * What a request body must bring in each `bodyIdleTimeoutMs` (unless it ends) to count as moving: a peer that sends a
49
+ * few bytes at a time is let go like one that stalls.
50
+ */
51
+ readonly minRequestBodyBytesPerIdle: number;
41
52
  /** Stop writing to the channel above this many buffered bytes. */
42
53
  readonly sendHighWaterMark: number;
43
54
  readonly sendLowWaterMark: number;
@@ -205,6 +205,17 @@ export interface IncomingMessage {
205
205
  }
206
206
  /** Largest `paired-message` frame sent with a preview: a session fails on a frame over 60 KiB (`PairedSession`). */
207
207
  export declare const MAX_PAIRED_MESSAGE_FRAME: number;
208
+ /**
209
+ * Texts a contact's link takes: a burst per short window (a reconnect flushes every queued text at once) and a total
210
+ * per hour, both well above what a person or a bot sends. The rest go unconfirmed and come again (the sender's outbox
211
+ * resends with backoff), so a catch-up only slows.
212
+ */
213
+ export declare const MESSAGE_RECEIVE_LIMITS: {
214
+ readonly burst: 200;
215
+ readonly burstWindowMs: 10000;
216
+ readonly hourly: 1800;
217
+ readonly hourWindowMs: 3600000;
218
+ };
208
219
  /**
209
220
  * A `paired-message` frame. The preview (`pv`) is left out when the frame would pass `MAX_PAIRED_MESSAGE_FRAME`
210
221
  * with it: the text matters, the card does not. A reply (`r`, WISP 401 § Replies) is a few hundred bytes at most
@@ -788,6 +799,8 @@ export declare class GhostLink {
788
799
  private readonly pinsReceived;
789
800
  /** Edit frames the contact may send per window; the rest go unconfirmed and come again. */
790
801
  private readonly editsReceived;
802
+ /** Text frames the contact may send per window (`MESSAGE_RECEIVE_LIMITS`); the rest go unconfirmed and come again. */
803
+ private readonly messagesReceived;
791
804
  /** Call signals the contact may send per window; the rest are dropped. */
792
805
  private readonly callsReceived;
793
806
  /** WebRTC signals the contact may send on the session (`paired-rtc`) per window; the rest are dropped. */
@@ -1068,6 +1081,13 @@ export declare class GhostLink {
1068
1081
  private open;
1069
1082
  /** Closes what a switch replaced once the contact has had time to move too. */
1070
1083
  private retire;
1084
+ /**
1085
+ * Where the receipt of a frame read on `channel` goes: that session while it carries the chat, the one now when a move
1086
+ * replaced it (or moved while the frame was shown), or nowhere.
1087
+ */
1088
+ private answerOn;
1089
+ /** Counts one text the contact sent; false (and not counted) when either of `messagesReceived` is full. */
1090
+ private takeMessage;
1071
1091
  /**
1072
1092
  * The WebRTC session a switch moved off is still retiring (`SWITCH_RETIRE_MS`): its data link is open, and a new offer
1073
1093
  * cannot go until it closes. Resolves once it has (at once when none is).
@@ -563,7 +563,7 @@ export declare class CommunitySession {
563
563
  /** My frames said again in this run (`e:h16:n`) → the id of the message they first were. In memory only. */
564
564
  private resealedFrom;
565
565
  private saveTimer;
566
- /** One metadata frame naming a commit or a secret I do not have yet: tried again when the chain or my secrets move. */
566
+ /** Metadata frames naming a commit or a secret I do not have yet, one signed by the admin and one by anyone else (`waitMeta`): tried again when the chain or my secrets move. */
567
567
  private pendingMeta;
568
568
  /** The store's frames the app holds with their messages (`storeKey` → message id): in memory here, not in what is saved. */
569
569
  private readonly onRows;
@@ -1095,6 +1095,12 @@ export declare class CommunitySession {
1095
1095
  * whether it was new, so a hub relays it. One naming what I do not have yet waits for the chain.
1096
1096
  */
1097
1097
  private receiveMeta;
1098
+ /**
1099
+ * A statement that waits for the chain: only one its signer signed, so an altered copy cannot push out the one
1100
+ * waiting. The admin I know has a place of their own, which another member's statement cannot take, and in each
1101
+ * place only a later statement takes the one waiting.
1102
+ */
1103
+ private waitMeta;
1098
1104
  /**
1099
1105
  * Who made the change a statement brings me (`at`: its commit's place on my main branch): its signer, when they were
1100
1106
  * the admin all along since the statement I held (or, with none, since I got in). A new admin signs again what the
@@ -488,6 +488,12 @@ export declare class GroupSession {
488
488
  * said it (`heardName`). In memory only; the records held start it.
489
489
  */
490
490
  private readonly nickAt;
491
+ /**
492
+ * Member → the name an edge's empty one took away a moment ago (`setNick`), and when. The admin that removed me while
493
+ * I was away says no name on the edge it kept to tell me, as its app opens it, and the commit that removes me comes
494
+ * right after on that edge: that name comes back for the history I keep (`nameKept`). In memory only.
495
+ */
496
+ private readonly unnamed;
491
497
  /** The version of my name record last said to every member (`sayName`). In memory only: said again once per start. */
492
498
  private nameSaid;
493
499
  /** New name records taken per member, a few a minute (`GROUP_LIMITS.namesPerMember`). In memory only. */
@@ -496,7 +502,7 @@ export declare class GroupSession {
496
502
  private messagePace;
497
503
  private editPace;
498
504
  private queue;
499
- /** One metadata frame that names a commit or an epoch I do not have yet: tried again when the chain moves. */
505
+ /** Metadata frames that name a commit or an epoch I do not have yet, one signed by the admin and one by anyone else (`waitMeta`): tried again when the chain moves. */
500
506
  private pendingMeta;
501
507
  /** While `handle` runs: the frames it took that a hub passes on (`handle`'s result). */
502
508
  private passOn;
@@ -712,6 +718,11 @@ export declare class GroupSession {
712
718
  /** Told out of band (the admin's contact chat) that I was removed, before or instead of the commit. */
713
719
  markRemoved(): Promise<void>;
714
720
  private out;
721
+ /**
722
+ * Out of the group: a name an edge took away a moment before comes back, as the history I keep still shows it. The
723
+ * edge the admin kept to tell me I was removed says no name as it opens, just before the commit that removed me.
724
+ */
725
+ private nameKept;
715
726
  /**
716
727
  * Encrypts and signs a text, keeps it for catch-up and sends it to every other member. `mentions`: places of the
717
728
  * text that name members (everyone: the admin only); what does not hold is left out. `reply`: the message it
@@ -1010,6 +1021,12 @@ export declare class GroupSession {
1010
1021
  * it names into metadata Ghostly shows. One naming what I do not have yet waits for the chain.
1011
1022
  */
1012
1023
  private receiveMeta;
1024
+ /**
1025
+ * A statement that waits for the chain: only one its signer signed, so an altered copy cannot push out the one
1026
+ * waiting. The admin I know has a place of their own, which another member's statement cannot take, and in each
1027
+ * place only a later statement takes the one waiting.
1028
+ */
1029
+ private waitMeta;
1013
1030
  /**
1014
1031
  * Who made the change a statement brings me: its signer, when they were the admin all along since the statement I
1015
1032
  * held (or, with none, since I got in). A new admin signs again what the last one set (`metaFollowsChain`): to a
@@ -58,9 +58,18 @@ export declare const VIEWER_SERVICE_CSP = "default-src 'self' https: data: blob:
58
58
  export declare const VIEWER_SERVICE_CSP_RELAY_ONLY = "default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval'; connect-src 'self'; form-action 'self'";
59
59
  /** Ghostly's policy for a contact's app, by whether Hide my IP from contacts is on. */
60
60
  export declare function viewerServicePolicy(relayOnly: boolean): string;
61
+ /**
62
+ * The browser features a contact's app in the extension's viewer tab may not use. Its tab is a site of its own, so
63
+ * what the person granted it (camera, microphone, location, a device) would be a site setting of the browser's, which
64
+ * no Delete chat, Clear all data or Delete profile reaches; denied here, the browser never asks and ignores a grant
65
+ * made before. The web app's view is a frame of another site, which gets none of them, and Desktop's window grants none.
66
+ */
67
+ export declare const VIEWER_PERMISSIONS_POLICY: string;
61
68
  /**
62
69
  * `headers` with Ghostly's policy after the contact's own, all in one `content-security-policy` joined by commas: a
63
- * browser enforces every policy of the list, so the contact's can narrow Ghostly's but never widen it.
70
+ * browser enforces every policy of the list, so the contact's can narrow Ghostly's but never widen it. The page's
71
+ * features are Ghostly's alone (`VIEWER_PERMISSIONS_POLICY`): a contact's permissions policy could allow them, and one
72
+ * the browser cannot read would void the whole header, Ghostly's part with it.
64
73
  */
65
74
  export declare function withViewerPolicy(headers: HeaderList, relayOnly?: boolean): HeaderList;
66
75
  /**
@@ -104,16 +113,21 @@ export declare class HttpHost {
104
113
  * so a stream counts toward the limit until its fetch has settled.
105
114
  */
106
115
  private readonly live;
116
+ /** Body bytes of the streams in `live`: a peer cannot make the host hold more than `maxHostBodyBytesPerPeer`. */
117
+ private heldBodyBytes;
107
118
  constructor(channel: FrameChannel, getService: (id: string) => HostedHttpService | undefined, localFetch: LocalFetch);
108
119
  get activeRequests(): number;
109
120
  handleRequest(frame: HttpRequestFrame): void;
110
121
  handleChunk(chunk: ChunkFrame): void;
111
122
  handleReset(frame: ResetFrame): void;
112
123
  closeAll(): void;
113
- private armIdleTimer;
124
+ /** A body that brings less than `minRequestBodyBytesPerIdle` in a `bodyIdleTimeoutMs` is let go, even if it trickles. */
125
+ private watchPace;
114
126
  /** Ids are reused after a reset, so a stream is current only if it is the one in the map. */
115
127
  private isCurrent;
116
128
  private end;
129
+ /** The stream no longer counts toward the limits: its body is dropped, or its local fetch has settled. */
130
+ private release;
117
131
  private fail;
118
132
  private run;
119
133
  }
@@ -9,8 +9,15 @@ export interface Identity {
9
9
  publicKey: Uint8Array;
10
10
  pubKeyZ32: string;
11
11
  }
12
- /** How many public keys `identityFromSeed` keeps: a start with 50 chats and 20 groups derives about 400 distinct ones. */
12
+ /** How many public keys `identityFromSeed` keeps however long ago they were used: a start with 50 chats and 20 groups derives about 400 distinct ones. */
13
13
  export declare const IDENTITY_MEMO_SIZE = 1024;
14
+ /**
15
+ * Past `IDENTITY_MEMO_SIZE`, a key is let go only once it has not been asked for this long: a start asks for all of a
16
+ * profile's keys within seconds (a 600-chat one, ~4,000 of them), then asks again for the running links' ones.
17
+ */
18
+ export declare const IDENTITY_MEMO_IDLE_MS: number;
19
+ /** The most keys kept, used or not: ~410 bytes each in V8 (its id, its key and when it was used), ~6.7 MB in all. */
20
+ export declare const IDENTITY_MEMO_MAX = 16384;
14
21
  export declare function identityFromSeed(seed: Uint8Array): Identity;
15
22
  export declare function identityFromSeedB64(seedB64: string): Identity;
16
23
  export declare function createIdentity(): Identity;
@@ -140,6 +140,11 @@ export interface SharedIdentity {
140
140
  id: string;
141
141
  provider: string;
142
142
  subject: string;
143
+ /**
144
+ * The identity the contact keeps it under (the provider's verified subject: an OIDC binding names the issuer, its
145
+ * account is the issuer and `sub`). Absent in older ledgers.
146
+ */
147
+ account?: string;
143
148
  /** queued: the person chose to share, the contact is not connected yet. */
144
149
  status: "queued" | "pending" | "accepted" | "rejected" | "withdrawal-pending" | "withdrawn";
145
150
  /** Seconds. When the status last changed. */
@@ -184,10 +189,12 @@ export interface IdentityLedger {
184
189
  timeline?: IdentityTimelineEntry[];
185
190
  }
186
191
  export declare const emptyIdentityLedger: () => IdentityLedger;
192
+ /** `account`: the subject its provider verified (`VerifiedIdentity.subject`); the binding's subject when not given. */
187
193
  export interface LocalIdentityProof {
188
194
  statement: IdentityStatement;
189
195
  evidence: unknown;
190
196
  seed: Uint8Array;
197
+ account?: string;
191
198
  }
192
199
  export interface IdentityExchangeOptions {
193
200
  /** This side's view of the authenticated channel; throws when there is none. */
@@ -27,6 +27,7 @@ export * from "./signal.js";
27
27
  export * from "./frames.js";
28
28
  export * from "./http.js";
29
29
  export * from "./viewerGuard.js";
30
+ export * from "./clipboardGuard.js";
30
31
  export * from "./link.js";
31
32
  export * from "./datalink.js";
32
33
  export * from "./ghostlink.js";
@@ -37,6 +38,7 @@ export * from "./video.js";
37
38
  export * from "./image.js";
38
39
  export * from "./pictureMetadata.js";
39
40
  export * from "./videoMetadata.js";
41
+ export * from "./audioMetadata.js";
40
42
  export * from "./linkPreview.js";
41
43
  export * from "./messageTime.js";
42
44
  export * from "./payments.js";
@@ -82,6 +84,7 @@ export * from './sshsig.js';
82
84
  export * from "./groupCrypto.js";
83
85
  export * from "./groupCommits.js";
84
86
  export * from "./groupSession.js";
87
+ export * from "./catchUp.js";
85
88
  export * from "./groupMentions.js";
86
89
  export * from "./groupWake.js";
87
90
  export * from "./groupEdits.js";
@@ -196,7 +196,10 @@ export type MiniAppEvent = {
196
196
  };
197
197
  /** Limits the broker enforces (and an app can plan for). */
198
198
  export declare const MINI_APP_LIMITS: {
199
- /** One request, serialized. */
199
+ /**
200
+ * One request, serialized: a stored value's 64 KiB with room for its key (256 bytes, at most six times that as JSON)
201
+ * and `{"id", "type", "args"}` around them.
202
+ */
200
203
  readonly requestBytes: number;
201
204
  /** Requests per second, per app. */
202
205
  readonly requestsPerSecond: 50;
@@ -32,6 +32,11 @@ export declare const APP_RANGE_LIMITS: {
32
32
  * are asked, so a cancelled one counts as the read it started. Twice the asking app's own budget (16 MiB a second).
33
33
  */
34
34
  readonly bytesPerSecond: number;
35
+ /**
36
+ * The least one ask counts in `bytesPerSecond`, however few bytes it asked or the file held from its offset: each is
37
+ * a read on this device, so a contact gets at most 512 a second.
38
+ */
39
+ readonly askFloorBytes: number;
35
40
  };
36
41
  /**
37
42
  * What an `ar-err` says. `not-served`: no serve of that id (never given, or ended); `changed` and
@@ -94,7 +94,7 @@ export declare const DEPARTED_READS = 6;
94
94
  /**
95
95
  * A 1:1 chat's reads of an invite this side made, while its joiner is due and has not shown (`awaited`, `AWAITING_PEER_MS`
96
96
  * in link.ts), may go over a relay's minute within the chat's allowance (`SIGNALING_ALLOWANCE_SHARE`) the same way: at
97
- * most this many of each invite's in a minute, every relay together. And while one asked in the last minute, the departed
97
+ * most this many in a minute, every invite and every relay together. And while one asked in the last minute, the departed
98
98
  * reads leave them half of that on each relay: the last `AWAITED_READS / 2` of the allowance's reads (`DEPARTED_READS`
99
99
  * then take at most 3 on a relay of 30, against 5). Read every 2 to 4 s, they cover the seconds in which a joiner that
100
100
  * opened the link at once knocks. Within the chats' allowance, they add nothing to what a relay may see in a minute
@@ -102,6 +102,9 @@ export declare const DEPARTED_READS = 6;
102
102
  * another on relays of 30 spent the minute on both 12 s in (two pairings, about 15 requests a relay each), the departed
103
103
  * reads of the contact that had just left took the allowance, and the third invite's key was read once, then not until
104
104
  * the minute freed: the joiner's knock 48 s late, and join to live in 60 s, against 2.6 and 4.6 s (CLI lab, 2026-11-07).
105
+ * Not this many per invite: a web profile with 150 chats added from old sessions, each an invite awaited from that start,
106
+ * had their reads take the whole allowance at every refill, and a live contact's reads after a reload went once a
107
+ * minute: the chat came back in 2 to 7 min, against 41 to 69 s before (2026-11-07).
105
108
  */
106
109
  export declare const AWAITED_READS = 4;
107
110
  /**
@@ -350,8 +353,8 @@ export declare class RelayTransport implements PkarrTransport {
350
353
  private readonly spentAnswerAllowance;
351
354
  /** Per contact, its departed reads past the limit in the last minute, every relay together (`DEPARTED_READS`). */
352
355
  private readonly departedOver;
353
- /** Per invite, its awaited reads past the limit in the last minute, every relay together (`AWAITED_READS`). */
354
- private readonly awaitedOver;
356
+ /** The awaited reads past the limit in the last minute, every invite and every relay together (`AWAITED_READS`). */
357
+ private awaitedOver;
355
358
  /** When an awaited invite's read last asked: the departed reads leave it room for a minute (`AWAITED_READS`). */
356
359
  private awaitedAt;
357
360
  /**
@@ -632,7 +635,7 @@ export declare class RelayTransport implements PkarrTransport {
632
635
  private turnAhead;
633
636
  /** A 1:1 chat's read of `key` the budget has held back for `READ_STARVED_MS` without a break. */
634
637
  private starved;
635
- /** This key's departed or awaited reads past the limit in the last minute (`DEPARTED_READS`, `AWAITED_READS`). */
638
+ /** This key's departed reads past the limit in the last minute (`DEPARTED_READS`). */
636
639
  private overReads;
637
640
  /** One more, the keys with none in the last minute dropped. */
638
641
  private overAdd;
@@ -52,7 +52,9 @@ export interface PkarrRequestOptions {
52
52
  watch?: boolean;
53
53
  /**
54
54
  * A 1:1 chat's read of a contact that went away from a live session within `DEPARTED_READ_MS` (link.ts): an app that
55
- * restarts publishes its offer then. A few may go over the relay's minute (`DEPARTED_READS` in relay.ts).
55
+ * restarts publishes its offer then. So is a chat's read of the mailbox of a contact on DHT only, this side not, out of
56
+ * the background (`DhtDelivery.departedRead`): its envelope saying it left is what the live link waits on. A few may go
57
+ * over the relay's minute (`DEPARTED_READS` in relay.ts).
56
58
  */
57
59
  departed?: boolean;
58
60
  /**
@@ -15,6 +15,12 @@ export interface VideoSource {
15
15
  size: number;
16
16
  read(offset: number, length: number): Promise<Uint8Array>;
17
17
  }
18
+ /**
19
+ * `source` read a window at a time: a read that fits in `readAhead` bytes reads that many from where it starts, and
20
+ * the reads after it within them (the next boxes' headers, a fragment's `moof`) are served from it, as copies (they
21
+ * are changed in place). A Blob's read costs about the same whatever its size, so a fragment costs one, not three.
22
+ */
23
+ export declare function readingAhead(source: VideoSource): VideoSource;
18
24
  /** A part of a video replaced as it is sent, `start` to `end` of the file: by `bytes`, or by zeros. */
19
25
  export interface VideoPatch {
20
26
  start: number;
@@ -30,6 +36,6 @@ export declare function withoutVideoMetadata(source: Blob, mime: string): Promis
30
36
  /**
31
37
  * What `withoutVideoMetadata` changes in a video read from `source` (one not held in a Blob: a file kept in storage):
32
38
  * the parts replaced, in order and apart, the rest of its bytes going as they are; undefined when it goes as it is.
33
- * Throws `NO_VIDEO_METADATA` as it does.
39
+ * Throws `NO_VIDEO_METADATA` as it does. With `audio`, a movie without a video track (an M4A) is stripped too.
34
40
  */
35
- export declare function videoMetadataPatches(file: VideoSource, mime: string): Promise<VideoPatch[] | undefined>;
41
+ export declare function videoMetadataPatches(file: VideoSource, mime: string, audio?: boolean): Promise<VideoPatch[] | undefined>;
@@ -33,11 +33,24 @@ export declare const VIEWER_GUARD_HASH = "'sha256-P3jYgJwfoJ/cAS31rQz7Tk99bBwsSe
33
33
  */
34
34
  export declare const VIEWER_GUARD_CSP = "frame-src 'self'; object-src 'self'; require-trusted-types-for 'script'";
35
35
  /**
36
- * A contact's `Content-Security-Policy` value (one policy or several, joined by commas), each given the guard's hash
36
+ * `VIEWER_GUARD_CSP` for a worker's own script: no Trusted Types. A worker has no `javascript:` URL, no `execCommand`
37
+ * and no WebRTC for a guard to keep, and no guard runs in it to make the `default` policy, so Trusted Types there
38
+ * would refuse its every `importScripts`, `eval` and `new Function`.
39
+ */
40
+ export declare const VIEWER_WORKER_GUARD_CSP = "frame-src 'self'; object-src 'self'";
41
+ /** A script `guardViewerAnswer` puts first in each page, and its hash, as a CSP source. */
42
+ export interface PageGuard {
43
+ script: string;
44
+ hash: string;
45
+ }
46
+ /** The WebRTC guard, the one `guardViewerAnswer` puts in when it is given none. */
47
+ export declare const WEBRTC_GUARD: PageGuard;
48
+ /**
49
+ * A contact's `Content-Security-Policy` value (one policy or several, joined by commas), each given the guards' hashes
37
50
  * where it would refuse an inline script: in the directive that governs `<script>` elements (`script-src-elem`, else
38
51
  * `script-src`, else `default-src`), unless it lets every inline script run already. Nothing else of it changes.
39
52
  */
40
- export declare function allowingViewerGuard(value: string): string;
53
+ export declare function allowingViewerGuard(value: string, hashes?: readonly string[]): string;
41
54
  /**
42
55
  * Where the guard goes in an HTML page that starts with `head`: after a byte order mark, blank space, comments and the
43
56
  * doctype (before them the page would turn to quirks mode), so before anything that can run or set a policy. Null when
@@ -45,14 +58,14 @@ export declare function allowingViewerGuard(value: string): string;
45
58
  */
46
59
  export declare function viewerGuardOffset(head: Uint8Array, done: boolean): number | null;
47
60
  /**
48
- * A contact's answer as a viewer serves it while Hide my IP from contacts is on, where the viewer cannot run the guard
49
- * in every frame itself (the web runner): the contact's policies take the guard's hash
50
- * (`allowingViewerGuard`) and `VIEWER_GUARD_CSP` goes along. A page (`destination`, null when the browser did not say)
51
- * that is HTML gets the guard first in it; one the guard cannot be put in (another type, more than one type, a
61
+ * A contact's answer as a viewer serves it where it cannot run `guards` in every frame itself (the web runner; the
62
+ * WebRTC guard while Hide my IP from contacts is on, unless it is given others): the contact's policies take the guards'
63
+ * hashes (`allowingViewerGuard`) and `VIEWER_GUARD_CSP` goes along. A page (`destination`, null when the browser did not say)
64
+ * that is HTML gets the guards first in it, in their order; one they cannot be put in (another type, more than one type, a
52
65
  * compressed, UTF-16 or ISO-2022-JP body, a type with a quote or a backslash in it, an escape byte before the guard's
53
66
  * place) runs no script at all. Anything that is not a page passes as it was. The caller adds Ghostly's own policy as before.
54
67
  */
55
- export declare function guardViewerAnswer(headers: HeaderList, body: AsyncIterable<Uint8Array>, destination: string | null): Promise<{
68
+ export declare function guardViewerAnswer(headers: HeaderList, body: AsyncIterable<Uint8Array>, destination: string | null, guards?: readonly PageGuard[]): Promise<{
56
69
  headers: HeaderList;
57
70
  body: AsyncIterable<Uint8Array>;
58
71
  }>;
@@ -52,6 +52,7 @@ function providerDescriptorProblems(d) {
52
52
  }
53
53
  if (typeof d.create !== "function") problems.push("create is not a function");
54
54
  if (d.validate !== void 0 && typeof d.validate !== "function") problems.push("validate is not a function");
55
+ if (d.wallet !== void 0 && typeof d.wallet !== "function") problems.push("wallet is not a function");
55
56
  return problems;
56
57
  }
57
58
  /** Only these fields reach the UI, whatever else a provider module keeps on its descriptor. */
@@ -96,4 +97,4 @@ function redact(error, secrets = {}) {
96
97
  //#endregion
97
98
  export { describeProvider as a, offeredIn as c, PROVIDER_PLATFORMS as i, providerDescriptorProblems as l, PROVIDER_ID as n, isNothingSpentError as o, PROVIDER_NETWORKS as r, networkMode as s, NothingSpentError as t, redact as u };
98
99
 
99
- //# sourceMappingURL=types-DvtCy3WB.js.map
100
+ //# sourceMappingURL=types-DYLIIkU8.js.map