@ghostlytools/sdk 0.0.0-stage → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -2
- package/dist/app.js +67 -0
- package/dist/app.js.map +1 -0
- package/dist/core.js +207 -0
- package/dist/core.js.map +1 -0
- package/dist/fakes-CBIuqo5e.js +536 -0
- package/dist/fakes-CBIuqo5e.js.map +1 -0
- package/dist/fakes.js +2 -0
- package/dist/index.js +179 -0
- package/dist/index.js.map +1 -0
- package/dist/keet-identity-key-BylxCPl4.js +76483 -0
- package/dist/keet-identity-key-BylxCPl4.js.map +1 -0
- package/dist/src-DCeLPsi-.js +31056 -0
- package/dist/src-DCeLPsi-.js.map +1 -0
- package/dist/testing.js +330 -0
- package/dist/testing.js.map +1 -0
- package/dist/types/browser/src/engine/paymentAdapters/providers/contractSuite.d.ts +41 -0
- package/dist/types/browser/src/engine/paymentAdapters/providers/lightning.d.ts +103 -0
- package/dist/types/browser/src/engine/paymentAdapters/providers/onchain.d.ts +88 -0
- package/dist/types/browser/src/engine/paymentAdapters/providers/testing.d.ts +89 -0
- package/dist/types/browser/src/engine/paymentAdapters/providers/types.d.ts +151 -0
- package/dist/types/browser/src/plugins/bundled.d.ts +8 -0
- package/dist/types/browser/src/plugins/registry.d.ts +57 -0
- package/dist/types/browser/src/proofs/contract.d.ts +262 -0
- package/dist/types/browser/src/proofs/contractSuite.d.ts +27 -0
- package/dist/types/browser/src/proofs/testing.d.ts +36 -0
- package/dist/types/browser/src/proofs/verify.d.ts +23 -0
- package/dist/types/browser/src/shared/mints.d.ts +50 -0
- package/dist/types/core/src/appBundle.d.ts +173 -0
- package/dist/types/core/src/appStatements.d.ts +142 -0
- package/dist/types/core/src/appStore.d.ts +133 -0
- package/dist/types/core/src/appUpdates.d.ts +88 -0
- package/dist/types/core/src/atprotoIdentity.d.ts +49 -0
- package/dist/types/core/src/atprotoRepo.d.ts +101 -0
- package/dist/types/core/src/avatar.d.ts +19 -0
- package/dist/types/core/src/bip322.d.ts +57 -0
- package/dist/types/core/src/bitcoinAddress.d.ts +5 -0
- package/dist/types/core/src/bitcoinMessage.d.ts +15 -0
- package/dist/types/core/src/bitcoinScript.d.ts +69 -0
- package/dist/types/core/src/bolt11.d.ts +30 -0
- package/dist/types/core/src/bytes.d.ts +11 -0
- package/dist/types/core/src/callSignal.d.ts +232 -0
- package/dist/types/core/src/canonicalJson.d.ts +22 -0
- package/dist/types/core/src/capsRecord.d.ts +234 -0
- package/dist/types/core/src/catchUp.d.ts +45 -0
- package/dist/types/core/src/chatFiles.d.ts +271 -0
- package/dist/types/core/src/clockWatch.d.ts +72 -0
- package/dist/types/core/src/communityRendezvous.d.ts +113 -0
- package/dist/types/core/src/crypto.d.ts +10 -0
- package/dist/types/core/src/datalink.d.ts +187 -0
- package/dist/types/core/src/deviceInvite.d.ts +51 -0
- package/dist/types/core/src/deviceLink.d.ts +70 -0
- package/dist/types/core/src/dhtDelivery.d.ts +403 -0
- package/dist/types/core/src/dhtFiles.d.ts +46 -0
- package/dist/types/core/src/did.d.ts +134 -0
- package/dist/types/core/src/didDht.d.ts +155 -0
- package/dist/types/core/src/directPath.d.ts +63 -0
- package/dist/types/core/src/dns.d.ts +41 -0
- package/dist/types/core/src/domainProofs.d.ts +88 -0
- package/dist/types/core/src/engineErrors.d.ts +90 -0
- package/dist/types/core/src/enroll.d.ts +98 -0
- package/dist/types/core/src/files.d.ts +73 -0
- package/dist/types/core/src/forwards.d.ts +12 -0
- package/dist/types/core/src/frames.d.ts +211 -0
- package/dist/types/core/src/ghostlink.d.ts +1510 -0
- package/dist/types/core/src/groupCommits.d.ts +103 -0
- package/dist/types/core/src/groupCommunity.d.ts +714 -0
- package/dist/types/core/src/groupCrypto.d.ts +60 -0
- package/dist/types/core/src/groupEdits.d.ts +67 -0
- package/dist/types/core/src/groupEntry.d.ts +61 -0
- package/dist/types/core/src/groupFiles.d.ts +106 -0
- package/dist/types/core/src/groupHubs.d.ts +61 -0
- package/dist/types/core/src/groupMentions.d.ts +27 -0
- package/dist/types/core/src/groupMeta.d.ts +162 -0
- package/dist/types/core/src/groupSession.d.ts +710 -0
- package/dist/types/core/src/groupSignals.d.ts +167 -0
- package/dist/types/core/src/groupTyping.d.ts +56 -0
- package/dist/types/core/src/groupWake.d.ts +68 -0
- package/dist/types/core/src/handoff.d.ts +255 -0
- package/dist/types/core/src/http.d.ts +125 -0
- package/dist/types/core/src/identity.d.ts +17 -0
- package/dist/types/core/src/identityProofs.d.ts +243 -0
- package/dist/types/core/src/identityTimeline.d.ts +72 -0
- package/dist/types/core/src/image.d.ts +33 -0
- package/dist/types/core/src/index.d.ts +100 -0
- package/dist/types/core/src/invite.d.ts +128 -0
- package/dist/types/core/src/link.d.ts +353 -0
- package/dist/types/core/src/linkPreview.d.ts +60 -0
- package/dist/types/core/src/linkTrace.d.ts +12 -0
- package/dist/types/core/src/lnurl.d.ts +99 -0
- package/dist/types/core/src/messageTime.d.ts +28 -0
- package/dist/types/core/src/miniApp.d.ts +141 -0
- package/dist/types/core/src/pairedApps.d.ts +151 -0
- package/dist/types/core/src/pairedCalls.d.ts +59 -0
- package/dist/types/core/src/pairedCapabilities.d.ts +101 -0
- package/dist/types/core/src/pairedEdits.d.ts +83 -0
- package/dist/types/core/src/pairedFiles.d.ts +30 -0
- package/dist/types/core/src/pairedHttp.d.ts +15 -0
- package/dist/types/core/src/pairedSession.d.ts +163 -0
- package/dist/types/core/src/pairedSignal.d.ts +17 -0
- package/dist/types/core/src/pairedTransports.d.ts +76 -0
- package/dist/types/core/src/pairedTyping.d.ts +130 -0
- package/dist/types/core/src/pairedWake.d.ts +109 -0
- package/dist/types/core/src/pairingProgress.d.ts +107 -0
- package/dist/types/core/src/paymentIntent.d.ts +111 -0
- package/dist/types/core/src/paymentUri.d.ts +34 -0
- package/dist/types/core/src/payments.d.ts +97 -0
- package/dist/types/core/src/peerProofs.d.ts +98 -0
- package/dist/types/core/src/pins.d.ts +73 -0
- package/dist/types/core/src/pkarr.d.ts +48 -0
- package/dist/types/core/src/pkdns.d.ts +35 -0
- package/dist/types/core/src/pubkyProofs.d.ts +25 -0
- package/dist/types/core/src/pubkyRing.d.ts +21 -0
- package/dist/types/core/src/reactions.d.ts +108 -0
- package/dist/types/core/src/records.d.ts +89 -0
- package/dist/types/core/src/relay.d.ts +437 -0
- package/dist/types/core/src/relayBreaker.d.ts +99 -0
- package/dist/types/core/src/replies.d.ts +41 -0
- package/dist/types/core/src/services.d.ts +35 -0
- package/dist/types/core/src/setUpdate.d.ts +53 -0
- package/dist/types/core/src/signal.d.ts +53 -0
- package/dist/types/core/src/signer.d.ts +13 -0
- package/dist/types/core/src/sparkAddress.d.ts +37 -0
- package/dist/types/core/src/sshsig.d.ts +74 -0
- package/dist/types/core/src/statusCards.d.ts +253 -0
- package/dist/types/core/src/storeForward.d.ts +144 -0
- package/dist/types/core/src/text.d.ts +20 -0
- package/dist/types/core/src/transport.d.ts +151 -0
- package/dist/types/core/src/transportSwitch.d.ts +160 -0
- package/dist/types/core/src/turnRead.d.ts +145 -0
- package/dist/types/core/src/turnRecord.d.ts +165 -0
- package/dist/types/core/src/version.d.ts +9 -0
- package/dist/types/core/src/video.d.ts +44 -0
- package/dist/types/core/src/voice.d.ts +88 -0
- package/dist/types/core/src/webPush.d.ts +58 -0
- package/dist/types/sdk/src/app.d.ts +23 -0
- package/dist/types/sdk/src/core.d.ts +7 -0
- package/dist/types/sdk/src/fakes.d.ts +6 -0
- package/dist/types/sdk/src/index.d.ts +26 -0
- package/dist/types/sdk/src/testing.d.ts +7 -0
- package/dist/types-DvtCy3WB.js +99 -0
- package/dist/types-DvtCy3WB.js.map +1 -0
- package/dist/verify-DBGw6wYt.js +106 -0
- package/dist/verify-DBGw6wYt.js.map +1 -0
- package/package.json +70 -4
package/README.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ghostlytools/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Build a wallet source (Lightning or on-chain), an identity proof, a mini-app or a minimal client for
|
|
4
|
+
[Ghostly](https://github.com/MiguelMedeiros/ghostly) without reading its internals. The adapter
|
|
5
|
+
contracts, the fakes and contract test suites the app tests itself with, the plugin registry, the
|
|
6
|
+
protocol library, and the mini-app API types (`@ghostlytools/sdk/app`, which imports nothing at run time).
|
|
7
|
+
Apps run in Ghostly from release 1.2: an earlier client does not open them.
|
|
8
|
+
|
|
9
|
+
Read [docs/SDK.md](https://github.com/MiguelMedeiros/ghostly/blob/dev/docs/SDK.md): the rules about
|
|
10
|
+
money and secrets, the trust model (an adapter runs with the app's privileges), how a plugin gets into
|
|
11
|
+
the app, and how the package is versioned. A complete example lives in `packages/sdk/examples/adapter`, and a
|
|
12
|
+
mini-app typed with `@ghostlytools/sdk/app` in `packages/sdk/examples/mini-app`.
|
|
13
|
+
|
|
14
|
+
Not on npm yet: `npm pack --workspace @ghostlytools/sdk` from a checkout builds and packs it.
|
package/dist/app.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
//#region ../core/src/miniApp.ts
|
|
2
|
+
/**
|
|
3
|
+
* Every code a refused request answers with (WISP 1200, "The runner and the broker"). In the sandbox every failed
|
|
4
|
+
* `ghostly.*` call rejects with an `Error` whose `message` is one of these codes; `miniAppErrorCode` reads it back. The
|
|
5
|
+
* runner turns its own failures (no answer from the client, a lost broker) into `failed`, and arguments that are not
|
|
6
|
+
* JSON into `bad-request`.
|
|
7
|
+
*
|
|
8
|
+
* - `bad-key`: a storage key that is not a string of 1 to 256 bytes.
|
|
9
|
+
* - `bad-path`: a `file` path that is not a string of 1 to 1024 characters.
|
|
10
|
+
* - `bad-request`: a request that is not `{id, type, args}` with JSON arguments.
|
|
11
|
+
* - `failed`: anything else; the client's own words never reach the app.
|
|
12
|
+
* - `full`: a storage write would take the scope past 5 MiB (each key counts 128 bytes beside its own and its value's),
|
|
13
|
+
* so the app can make room.
|
|
14
|
+
* - `no-file`: the bundle has no such file.
|
|
15
|
+
* - `not-allowed`: `chat.send` without the `chat` permission, or with the app opened alone.
|
|
16
|
+
* - `not-open`: `chat.send` before this side's chat has the app open.
|
|
17
|
+
* - `offline`: `chat.send` while the chat's session is not live. Nothing is kept to send later.
|
|
18
|
+
* - `peer-closed`: `chat.send` while the contact has not opened the app (or its client does not offer `apps/1`).
|
|
19
|
+
* - `stopped`: a store removed or the publisher revoked the version running.
|
|
20
|
+
* - `too-fast`: past 50 requests a second, or past 48 `chat.send` frames a second.
|
|
21
|
+
* - `too-large`: a request, a stored value or a `chat.send` value past its bound (`MINI_APP_LIMITS`).
|
|
22
|
+
* - `unknown-type`: a request `type` the broker does not answer.
|
|
23
|
+
*
|
|
24
|
+
* A later client may add a code: treat one you do not know as `failed`.
|
|
25
|
+
*/
|
|
26
|
+
var MINI_APP_ERROR_CODES = [
|
|
27
|
+
"bad-key",
|
|
28
|
+
"bad-path",
|
|
29
|
+
"bad-request",
|
|
30
|
+
"failed",
|
|
31
|
+
"full",
|
|
32
|
+
"no-file",
|
|
33
|
+
"not-allowed",
|
|
34
|
+
"not-open",
|
|
35
|
+
"offline",
|
|
36
|
+
"peer-closed",
|
|
37
|
+
"stopped",
|
|
38
|
+
"too-fast",
|
|
39
|
+
"too-large",
|
|
40
|
+
"unknown-type"
|
|
41
|
+
];
|
|
42
|
+
/** The code of a refused `ghostly.*` call (the rejection's `Error`), or null for anything that is not one. */
|
|
43
|
+
function miniAppErrorCode(error) {
|
|
44
|
+
const code = error instanceof Error ? error.message : void 0;
|
|
45
|
+
return MINI_APP_ERROR_CODES.includes(code) ? code : null;
|
|
46
|
+
}
|
|
47
|
+
/** Limits the broker enforces (and an app can plan for). */
|
|
48
|
+
var MINI_APP_LIMITS = {
|
|
49
|
+
/** One request, serialized. */
|
|
50
|
+
requestBytes: 65536,
|
|
51
|
+
/** Requests per second, per app. */
|
|
52
|
+
requestsPerSecond: 50,
|
|
53
|
+
/** A storage key, UTF-8. */
|
|
54
|
+
storageKeyBytes: 256,
|
|
55
|
+
/** One stored JSON value, serialized. */
|
|
56
|
+
storageValueBytes: 65536,
|
|
57
|
+
/** Counted for each stored key beside its own bytes and its value's: what keeping the key costs the device. */
|
|
58
|
+
storageRowBytes: 128,
|
|
59
|
+
/** Everything an app keeps in one scope (per app and per chat, or alone): each key, its value and `storageRowBytes`. */
|
|
60
|
+
storageScopeBytes: 5242880,
|
|
61
|
+
/** One `chat.send` value, serialized: the `paired-app` data cap (decision D5 of the plan). */
|
|
62
|
+
chatDataBytes: 32768
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
export { MINI_APP_ERROR_CODES, MINI_APP_LIMITS, miniAppErrorCode };
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=app.js.map
|
package/dist/app.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","names":[],"sources":["../../core/src/miniApp.ts"],"sourcesContent":["/**\n * The mini-app API: what an app in the runner's sandbox can ask the client's broker for, and nothing more.\n *\n * Matches the broker table of WISP 1200 (docs/wisps/1200-marketplace.md, \"The runner and the broker\"). Types, limits and refusal codes only, with no imports: the broker (apps/ui) and\n * the apps (apps/mini/*) import this one module, so neither side can drift from the other, and app developers get it as\n * `@ghostlytools/sdk/app`. It is imported as `@ghostly/core/miniApp`, outside the\n * core barrel, because apps bundle it into their single HTML file.\n */\n\n/** A JSON value: what `storage` keeps and what `chat.send` carries. */\nexport type MiniAppJson = null | boolean | number | string | MiniAppJson[] | { [key: string]: MiniAppJson };\n\n/** `ghostly.context()`. */\nexport interface MiniAppContext {\n /** This app's version (its manifest's `version`). */\n version: string;\n /** Opened in a chat (true) or alone (false). */\n inChat: boolean;\n /** The same app on the contact's side, while it is open there; null when it is not. */\n peer: { version: string } | null;\n /** The person's display name in this chat, only with the `name` permission. */\n name?: string;\n /** The client's theme, so the app can match it. An app may fall back to `prefers-color-scheme` when it is missing. */\n theme?: \"light\" | \"dark\";\n /** The client's language (BCP 47, for example \"pt-BR\"). An app may fall back to `navigator.language` when it is missing. */\n locale?: string;\n}\n\n/** `chat.peer`: the peer opened the app (again, or in another version) or closed it. */\nexport type MiniAppPeerEvent = { open: true; version: string } | { open: false };\n\n/** `window.ghostly` inside the sandbox. */\nexport interface MiniAppApi {\n context(): Promise<MiniAppContext>;\n /** The bytes of a file of the bundle. */\n file(path: string): Promise<ArrayBuffer>;\n /** The app's storage in its scope: this app in this chat, or this app alone. */\n storage: {\n /** The value, or undefined when the key is not set. */\n get(key: string): Promise<MiniAppJson | undefined>;\n set(key: string, value: MiniAppJson): Promise<void>;\n delete(key: string): Promise<void>;\n keys(): Promise<string[]>;\n };\n chat: {\n /** One `apps/1` data frame to the same app on the contact's side. Refused unless the chat is live and the peer has the app open. */\n send(value: MiniAppJson): Promise<void>;\n /** A data frame from the peer, as the peer's app sent it: untrusted. Returns a function that removes the listener. */\n on(event: \"message\", listener: (data: MiniAppJson) => void): () => void;\n on(event: \"peer\", listener: (peer: MiniAppPeerEvent) => void): () => void;\n };\n /** Ends the app. */\n close(): Promise<void>;\n}\n\n/** The message types on the port (web, extension) or through `app_broker` (Desktop). */\nexport type MiniAppRequestType =\n | \"context\"\n | \"file\"\n | \"storage.get\"\n | \"storage.set\"\n | \"storage.delete\"\n | \"storage.keys\"\n | \"chat.send\"\n | \"close\";\n\n/** A request from the app: `{id, type, args}`. The broker refuses an unknown `type`. */\nexport interface MiniAppRequest {\n id: number;\n type: MiniAppRequestType;\n args: MiniAppJson[];\n}\n\n/**\n * Every code a refused request answers with (WISP 1200, \"The runner and the broker\"). In the sandbox every failed\n * `ghostly.*` call rejects with an `Error` whose `message` is one of these codes; `miniAppErrorCode` reads it back. The\n * runner turns its own failures (no answer from the client, a lost broker) into `failed`, and arguments that are not\n * JSON into `bad-request`.\n *\n * - `bad-key`: a storage key that is not a string of 1 to 256 bytes.\n * - `bad-path`: a `file` path that is not a string of 1 to 1024 characters.\n * - `bad-request`: a request that is not `{id, type, args}` with JSON arguments.\n * - `failed`: anything else; the client's own words never reach the app.\n * - `full`: a storage write would take the scope past 5 MiB (each key counts 128 bytes beside its own and its value's),\n * so the app can make room.\n * - `no-file`: the bundle has no such file.\n * - `not-allowed`: `chat.send` without the `chat` permission, or with the app opened alone.\n * - `not-open`: `chat.send` before this side's chat has the app open.\n * - `offline`: `chat.send` while the chat's session is not live. Nothing is kept to send later.\n * - `peer-closed`: `chat.send` while the contact has not opened the app (or its client does not offer `apps/1`).\n * - `stopped`: a store removed or the publisher revoked the version running.\n * - `too-fast`: past 50 requests a second, or past 48 `chat.send` frames a second.\n * - `too-large`: a request, a stored value or a `chat.send` value past its bound (`MINI_APP_LIMITS`).\n * - `unknown-type`: a request `type` the broker does not answer.\n *\n * A later client may add a code: treat one you do not know as `failed`.\n */\nexport const MINI_APP_ERROR_CODES = [\n \"bad-key\", \"bad-path\", \"bad-request\", \"failed\", \"full\", \"no-file\", \"not-allowed\", \"not-open\", \"offline\", \"peer-closed\", \"stopped\",\n \"too-fast\", \"too-large\", \"unknown-type\",\n] as const;\nexport type MiniAppErrorCode = typeof MINI_APP_ERROR_CODES[number];\n\n/** The code of a refused `ghostly.*` call (the rejection's `Error`), or null for anything that is not one. */\nexport function miniAppErrorCode(error: unknown): MiniAppErrorCode | null {\n const code = error instanceof Error ? error.message : undefined;\n return (MINI_APP_ERROR_CODES as readonly string[]).includes(code as string) ? code as MiniAppErrorCode : null;\n}\n\n/**\n * The broker's answer to one request. `value` is JSON, or an `ArrayBuffer` for `file` on the port (web, extension). On\n * Desktop `app_broker` answers `file` with `bytes` instead, the file in base64, and the runner hands the app an\n * `ArrayBuffer` either way.\n *\n * `error` is one of `MINI_APP_ERROR_CODES` from this client; a later client may send a code this list does not have yet,\n * which an app reads as `failed`.\n */\nexport type MiniAppAnswer =\n | { id: number; ok: true; value?: MiniAppJson | ArrayBuffer }\n | { id: number; ok: true; bytes: string }\n | { id: number; ok: false; error: MiniAppErrorCode | (string & {}) };\n\n/** An event from the broker. */\nexport type MiniAppEvent = { event: \"chat.message\"; data: MiniAppJson } | { event: \"chat.peer\"; data: MiniAppPeerEvent };\n\n/** Limits the broker enforces (and an app can plan for). */\nexport const MINI_APP_LIMITS = {\n /** One request, serialized. */\n requestBytes: 64 * 1024,\n /** Requests per second, per app. */\n requestsPerSecond: 50,\n /** A storage key, UTF-8. */\n storageKeyBytes: 256,\n /** One stored JSON value, serialized. */\n storageValueBytes: 64 * 1024,\n /** Counted for each stored key beside its own bytes and its value's: what keeping the key costs the device. */\n storageRowBytes: 128,\n /** Everything an app keeps in one scope (per app and per chat, or alone): each key, its value and `storageRowBytes`. */\n storageScopeBytes: 5 * 1024 * 1024,\n /** One `chat.send` value, serialized: the `paired-app` data cap (decision D5 of the plan). */\n chatDataBytes: 32 * 1024,\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiGA,IAAa,uBAAuB;CAClC;CAAW;CAAY;CAAe;CAAU;CAAQ;CAAW;CAAe;CAAY;CAAW;CAAe;CACxH;CAAY;CAAa;AAC3B;;AAIA,SAAgB,iBAAiB,OAAyC;CACxE,MAAM,OAAO,iBAAiB,QAAQ,MAAM,UAAU,KAAA;CACtD,OAAQ,qBAA2C,SAAS,IAAc,IAAI,OAA2B;AAC3G;;AAmBA,IAAa,kBAAkB;;CAE7B,cAAc;;CAEd,mBAAmB;;CAEnB,iBAAiB;;CAEjB,mBAAmB;;CAEnB,iBAAiB;;CAEjB,mBAAmB;;CAEnB,eAAe;AACjB"}
|
package/dist/core.js
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { $ as rosterHash, $_ as enrollMessage, $a as GROUP_HAVE_FRAME, $b as sanitizeAvatar, $c as isHoldUrl, $d as parseEditedFrame, $f as cardEditNumber, $g as handoffFileRequestFrame, $h as emptyLinkRecords, $i as invoiceCallbackUrl, $l as emptyIdentityLedger, $m as WATCH_PEER_MS, $n as ATPROTO_FULL_SCOPE, $o as ChatFiles, $p as commitUntaggedHash, $r as DID_DHT_VERSION, $s as wakeRequest, $t as groupDisplayName, $u as DhtDelivery, $v as TURN_RAISE_READ_TIMEOUT_MS, $y as PREVIOUS_DEFAULT_RELAYS, A as isAppLicense, A_ as sortParts, Aa as MAX_PAIRED_MESSAGE_FRAME, Ab as measureRecords, Ac as EDIT_CAPABILITY, Ad as voiceFileName, Af as readReaction, Ag as HANDOFF_PIECE_OVERHEAD, Ah as parseRtcSignal, Ai as isSparkAddress, Al as CapsExchange, Am as STALLED_EVIDENCE_MS, An as BIP322_REVISION, Ao as wireHubPolicy, Ap as readAppRevocation, Ar as DID_METHODS, As as parsePinnedFrame, At as chainPieces, Au as verifyPeerProof, Av as DEVICES_CAPABILITY, Ay as turnInstance, B as COMMUNITY_PROFILE, B_ as DEVICE_KINDS, Ba as SWITCH_RETIRE_MS, Bb as identityFromSeed, Bc as UPGRADE_CAPABILITY, Bd as EDITED_FRAME, Bf as wireReply, Bg as handoffAckFrame, Bh as decompressSdp, Bi as newPubkyProofFolder, Bl as IDENTITY_CHECK_UNAVAILABLE, Bm as EXPECT_PEER_MS, Bn as decodeAnyBitcoinAddress, Bo as mergeLobby, Bp as canonicalJsonBytes, Br as didWebFileUrl, Bs as WAKE_FRAME, Bt as parseCommunityEdit, Bu as automaticTransport, Bv as deviceLinkPairing, By as BACKGROUND_REQUESTS_PER_MINUTE, C as APP_VIEWS, C_ as readHandoffManifest, Ca as EARLY_DIAL_JOIN_MS, Cb as isDiscoveryBudgetError, Cc as isAppVersion, Cd as downsamplePeaks, Cf as parseReactionFrame, Cg as HANDOFF_HELLO, Ch as DATA_CHANNEL_ID, Ci as formatPaymentAmount, Cl as validDomainRecord, Cm as CONNECT_TIMEOUT_MS, Cn as sshFingerprint, Co as MESH_HUBS, Cp as appRevocationId, Cr as verifyAtprotoSignature, Cs as PINNED_FRAME, Ct as mentionedMembers, Cu as proofHash, Cv as encodeInviteCode, Cy as openTurnValue, D as buildAppBundle, D_ as readHandoffVerified, Da as INVITE_TAKEN, Db as PacketTooLargeError, Dc as APPS_CAPABILITY, Dd as parseVoiceMeta, Df as reactionFrame, Dg as HANDOFF_OFFER, Dh as buildDataSdp, Di as walletNetworkOf, Dl as CAPS_LIMITS, Dm as GATHER_STALL_MS, Dn as isLegacySignature, Do as meshRendezvous, Dp as isAppKey, Dr as DID_JWS_ALGS, Ds as mayPin, Dt as GROUP_READ_NOTE, Du as storageProofPath, Dv as inviteQrText, Dy as signTurnBody, E as assembleAppBundle, E_ as readHandoffTurnFrame, Ea as INVITER_DIAL_GRACE_MS, Eb as PKARR_FUTURE_SKEW_MS, Ec as readAppFrame, Ed as isPlayableAudioType, Ef as reactionEmoji, Eg as HANDOFF_MANIFEST, Eh as RTC_SIGNAL_MAX_AGE_MS, Ei as validatePaymentTarget, El as CAPS_LABEL, Em as GATHER_ATTEMPTS, En as verifySshSignature, Eo as meshHubs, Ep as isAppHash, Er as DID_GHOSTLY_SERVICE, Es as PIN_LIMITS, Et as GROUP_REACTED_FRAME, Eu as storageProofBody, Ev as inviteQrSegments, Ey as sealTurnBody, F as GroupTypingBoard, F_ as setAckFrame, Fa as RACE_DIRECT_MS, Fb as decodeDnsAnswers, Fc as SERVICES_CAPABILITY, Fd as VIDEO_LIMITS, Ff as REPLY_LIMITS, Fg as HANDOFF_VERSION, Fh as answersOffer, Fi as isBitcoinAddress, Fl as dialDescriptors, Fm as directBlocked, Fn as decodeBase64, Fo as freshHubs, Fp as signAppRevocation, Fr as didJwsAlg, Fs as readPin, Ft as GROUP_EDIT_TEXT_BYTES, Fu as validRingKey, Fv as HANDOFF_CAPABILITY, Fy as turnReleaseMessage, G as communityHasFrame, G_ as ENROLL_HELLO, Ga as publishFailure, Gb as decrypt, Gc as PairedSession, Gd as EDIT_RECEIVE_LIMIT, Gf as PR_CHECKS, Gg as handoffCancelFrame, Gh as pickCallCandidates, Gi as decodeSvcbRecords, Gl as IDENTITY_PROOF_CAPABILITY, Gm as OFFER_FAST_MS, Gn as encodeWitness, Go as readBeaconHead, Gp as GROUP_VERSION_LARGE, Gr as parseDidJws, Gs as deviceWakeRequest, Gt as mentionsMember, Gu as relayedTransports, Gv as devicePingFrame, Gy as FRESH_READ_MS, H as GROUP_READ_NOTE_COMMUNITY, H_ as ENROLL_CANCEL_REASONS, Ha as WAKE_LOST_MS, Hb as publicKeyFromZ32, Hc as parseSessionCapabilities, Hd as EDIT_BUFFER_MS, Hf as BUTTON_ID, Hg as handoffAttemptFailed, Hh as heardCallSignal, Hi as pubkyProofCapability, Hl as IDENTITY_MAX_EVIDENCE, Hm as IDLE_THRESHOLD, Hn as decodeTx, Ho as pickHubs, Hp as GROUP_ADMIN_OFF_ERROR, Hr as normalizeDid, Hs as WAKE_SUBJECT, Ht as MENTION_EVERYONE, Hu as irohDescriptor, Hv as deviceLinkRendezvousSeed, Hy as CHAT_RESERVE, I as groupTypingEpoch, I_ as setUpdateFrame, Ia as RACE_RELAYED_MS, Ib as decodeTxtPacket, Ic as SESSION_CAPABILITIES_FRAME, Id as formatVideoDuration, If as groupReplyAuthor, Ig as HANDOFF_WINDOW, Ih as buildSdpFromSignal, Ii as PUBKY_PROOF_MAX_BYTES, Il as emptyCapsState, Im as symmetricNat, In as verifyBip322, Io as hubRank, Ip as verifyAppRevocation, Ir as didSignedMessages, Is as DEVICE_WAKE_TTL_SECONDS, It as carryMentions, Iu as verifyRingAuthorization, Iv as deviceEchoFrame, Iy as turnSequence, J as communityUntaggedHash, J_ as enrollCancelReason, Ja as engineError, Jb as sealedLength, Jc as HOLD_CAPABILITY, Jd as RateWindow, Jf as RUN_RESULTS, Jg as handoffDataFrame, Jh as waitForIceGathering, Ji as pubkyHomeserverOf, Jl as IDENTITY_STATEMENT_PREFIX, Jm as PRESENCE_HEARTBEAT, Jn as txHash, Jo as validHead, Jp as MAX_GROUP_MEMBERS, Jr as staticDidDocument, Js as readWake, Jt as MAX_GROUP_META_BODY, Ju as DHT_FILE_REFUSED, Jv as unsignedDeviceTransports, Jy as GROUP_OVER_PACE_MS, K as communityMessageId, K_ as ENROLL_PROOF, Ka as ENGINE_ERRORS, Kb as encrypt, Kc as SESSION_FRAME_MAX, Kd as EDIT_SEND_LIMIT, Kf as PR_STATES, Kg as handoffContext, Kh as sdpHasCandidates, Ki as encodeSvcbPacket, Kl as IDENTITY_PROVIDER_ID, Km as OFFER_LOOK_MS, Kn as hash160, Ko as readLobby, Kp as LEGACY_GROUP_MEMBERS, Kr as parseDidSignaturePaste, Ks as newWakeToken, Kt as validMentions, Ku as transportOrder, Kv as newDeviceSetSecret, Ky as GROUP_BURST_MS, L as openGroupTyping, L_ as setUpdateMessage, La as REDESCRIBED_GRACE_MS, Lb as encodeTxtPacket, Lc as STATUS_CARD_CAPABILITY, Ld as isPlayableVideoType, Lf as pairedReplyAuthor, Lg as NO_ATTEMPTS, Lh as callRtcConfig, Li as PUBKY_PROOF_ROOT, Ll as encodePacketTransports, Lm as AWAITING_PEER_MS, Ln as BitcoinAddressError, Lo as lobbyKeys, Lp as verifyAppSignature, Lr as didWebDocumentUrl, Ls as WAKE_CALL_INTERVAL_MS, Lt as communityEditFrame, Lu as verifyRingEvidence, Lv as deviceEchoNonce, Ly as turnSignedMessage, M as isAppUrl, M_ as SET_UPDATE, Ma as PAIRING_RETRY_MS, Mb as openRelayPayload, Mc as KNOWN_SESSION_CAPABILITIES, Md as voiceLevelsOf, Mf as wireReaction, Mg as HANDOFF_REQUEST, Mh as CALL_SIGNAL_MAX_AGE_MS, Mi as sparkInvoiceDetails, Ml as CapsRefusedError, Mm as DIRECT_OWN_ATTEMPTS, Mn as bip322MessageHash, Mo as beaconKeys, Mp as readAppRevocations, Mr as checkDidJws, Ms as pinIsNewer, Mt as groupMessageId, Mu as ringAuthorization, Mv as DEVICE_ECHO_FRAME, My as turnName, N as readAppBundle, N_ as encodeSetSlots, Na as PONG_WAIT_MS, Nb as parseRelayPayload, Nc as PIN_CAPABILITY, Nd as voicePeaksOf, Nf as PAIRED_REPLY_AUTHORS, Ng as HANDOFF_TIMINGS, Nh as PAIRED_CALL_CANDIDATES, Ni as sparkNetworkOf, Nl as DHT_TEXT_CAPABILITY, Nm as DIRECT_PEERS, Nn as bip322ToSign, No as beaconRecords, Np as readAppSignature, Nr as checkDidSignature, Ns as pinNumberHolds, Nt as COMMUNITY_EDIT_FRAME, Nu as ringClaims, Nv as DEVICE_PING_FRAME, Ny as turnPacket, O as checkAppManifest, O_ as sameDigest, Oa as LIVENESS_MISSED_PINGS, Ob as RELAY_PAYLOAD_MAX_BYTES, Oc as BUTTONS_CAPABILITY, Od as recordingMime, Of as reactionIsNewer, Og as HANDOFF_PAKE, Oh as extractRtcParams, Oi as SPARK_NETWORKS, Ol as CAPS_PUBLISH_SPACING_MS, Om as OFFER_HOST_GATHER_MS, On as legacyMessageHash, Oo as parseHubPolicy, Op as isAppRef, Or as DID_JWS_MAX_LENGTH, Os as nextPinNumber, Ot as GroupSession, Ou as validExternalKey, Ov as ownInviteRefusal, Oy as signTurnPacket, P as GROUP_TYPING_FRAME, P_ as readSetUpdate, Pa as RACE_ANSWERED_MS, Pb as signRelayPayload, Pc as REACTIONS_CAPABILITY, Pd as PLAYABLE_VIDEO, Pf as REPLY_ID, Pg as HANDOFF_VERIFIED, Ph as RTC_CONFIG, Pi as BITCOIN_NETWORKS, Pl as capsDescriptors, Pm as DirectPathWatch, Pn as bip322ToSpend, Po as doorHubs, Pp as signAppObject, Pr as didGhostlyServiceEntry, Ps as pinnedFrame, Pt as GROUP_EDIT_FRAME, Pu as ringEvidence, Pv as ENROLL_CAPABILITY, Py as turnPayloadSequence, Q as leaveStatement, Q_ as enrollHelloFrame, Qa as GROUP_FILE_LIMITS, Qb as jpegSize, Qc as HoldRefusedError, Qd as parseEditFrame, Qf as buttonLabelClash, Qg as handoffFileMissingFrame, Qh as buildLinkRecords, Qi as findLightningDestination, Ql as boundVerifiedIdentity, Qm as TRANSPORTS_GONE_MS, Qn as ATPROTO_DECLARED_SCOPE, Qo as parsePairedCallFrame, Qp as commitHash, Qr as DID_DHT_TTL, Qs as wakePayload, Qt as encodeGroupMetaBody, Qu as DHT_TEXT_REFUSED, Qv as TURN_PUT_WINDOW_MS, Qy as HEDGE_MS, R as sealGroupTyping, R_ as signTombstone, Ra as RESUME_WAIT_MS, Rb as readDnsName, Rc as SessionCapabilities, Rd as isVideoMime, Rf as readReply, Rg as filePartDigest, Rh as callSignalHeardAt, Ri as isPubkyKey, Rl as parsePacketTransports, Rm as DEPARTED_READ_MS, Rn as ByteReader, Ro as lobbyRecords, Rp as verifyAppStatementBytes, Rr as didWebFile, Rs as WAKE_CALL_TTL_SECONDS, Rt as communityMessageAuthor, Ru as RELAY_URL, Rv as deviceFrameCapability, Ry as turnStatedVerifier, S as APP_SCREENSHOTS_DIR, S_ as readHandoffHello, Sa as DHT_PIN_GRACE_MS, Sb as heldBackError, Sc as chatAppId, Sd as baseMime, Sf as parseReactedFrame, Sg as HANDOFF_HAVE, Sh as wrapDataChannel, Si as assertWholeSats, Sl as txtValue, Sm as ANSWER_REFUSED_REDIALS, Sn as sameSshKey, So as GROUP_VERSION_HUBS, Sp as appRefPublisher, Sr as verifyAtprotoRecordProof, Ss as GROUP_PIN_FRAME, St as groupWakes, Su as proofCapability, Sv as encodeGhostlyInvite, Sy as nextTurnPosition, T as appViewOf, T_ as readHandoffRelease, Ta as HANDLED_WAIT_MS, Tb as MAX_DNS_PACKET_BYTES, Tc as parseAppFrame, Td as formatVoiceDuration, Tf as reactedFrame, Tg as HANDOFF_LIST_PER_FRAME, Th as RTC_SIGNAL_FUTURE_MS, Ti as parsePaymentAmount, Tl as CAPS_ISSUED_BACK_MS, Tm as DataLink, Tn as sshSignCommand, To as mayBeHub, Tp as checkAppRevokeStatement, Tr as DID_FILE_MAX_BYTES, Ts as PIN_FRAME, Tt as GROUP_LIMITS, Tu as storageProof, Tv as inviteOwnership, Ty as readTurnPacket, U as communityCommitHash, U_ as ENROLL_DONE, Ua as pairedMessageFrame, Ub as sign, Uc as sessionCapabilitiesFrame, Ud as EDIT_FRAME, Uf as BUTTON_STYLES, Ug as handoffAttemptSucceeded, Uh as isGlobalIpv4Host, Ui as pubkyProofFile, Ul as IDENTITY_MAX_FRAME, Um as LinkSession, Un as decodeWitness, Uo as rankHubs, Up as GROUP_ID, Ur as parseDid, Us as WAKE_TTL_SECONDS, Ut as MENTION_LIMITS, Uu as irohRelayUrl, Uv as deviceLinkSealKey, Uy as DEFAULT_RELAYS, V as CommunitySession, V_ as ENROLL_CANCEL, Va as UNPROVEN_AUTH_MS, Vb as identityFromSeedB64, Vc as WAKE_SESSION_CAPABILITY, Vd as EDIT_BUFFER_MAX, Vf as ACTIVE_TASK_STATUSES, Vg as handoffAttemptAllowed, Vh as extractParamsFromSdp, Vi as normalizePubkyKey, Vl as IDENTITY_CLOCK_SKEW, Vm as FIRST_PUBLISH_MAX_MS, Vn as decodeBitcoinAddress, Vo as newerHead, Vp as readCanonicalJson, Vr as didWebHost, Vs as WAKE_INTERVAL_MS, Vt as validEditText, Vu as checkedDescriptors, Vv as deviceLinkParams, Vy as BACKGROUND_WHILE_SIGNALING, W as communityGroupId, W_ as ENROLL_GRANT, Wa as parsePaymentNetworks, Wb as verify, Wc as PAIRED_PROFILE, Wd as EDIT_RATE_WINDOW_MS, Wf as ITEM_STATES, Wg as handoffBusyFrame, Wh as parseCallSignal, Wi as pubkyProofPath, Wl as IDENTITY_MAX_VALIDITY, Wm as MAX_DHT_TEXT_BYTES, Wn as encodeTx, Wo as readBeacon, Wp as GROUP_MEMBER_CAP, Wr as parseDidDocument, Ws as WakeLimiter, Wt as mentionsBytes, Wu as rankTransports, Wv as deviceLinkSecret, Wy as DEPARTED_READS, X as derivedSecret, X_ as enrollDoneFrame, Xa as parseEngineError, Xb as MAX_AVATAR_LENGTH, Xc as HOLD_LIMITS, Xd as editFrame, Xf as TASK_STATUSES, Xg as handoffDoneFrame, Xh as MAX_MSGS_PAYLOAD_B64, Xi as LNURL_LIMITS, Xl as IdentityCheckUnavailable, Xm as RELAY_POLL_INTERVALS, Xn as u64, Xo as PAIRED_CALL_FRAME, Xp as OWN_FRAME_LIMIT, Xr as DID_DHT_MAX_PAYLOAD, Xs as relayRequest, Xt as MAX_GROUP_NAME_LENGTH, Xu as DHT_MESSAGE_TTL, Xv as seedSigner, Xy as GROUP_SIGNALING_ALLOWANCE_SHARE, Y as decodeCommunityLink, Y_ as enrollDigits, Ya as engineText, Yb as tryDecrypt, Yc as HOLD_DATED_BACK_MS, Yd as dhtEditId, Yf as STATUS_CARD_LIMITS, Yg as handoffDigest, Yh as LABEL, Yi as LIGHTNING_DESTINATION_PATTERN, Yl as IDENTITY_SUBJECT, Ym as PRESENCE_WINDOW, Yn as u32, Yo as MAX_PAIRED_CALL_SIGNAL, Yp as MEMBER_KEY, Yr as strictBase64Url, Ys as readWakePayload, Yt as MAX_GROUP_NAME_BYTES, Yu as DHT_FILE_TOO_LARGE, Yv as verifyDeviceTransports, Yy as GROUP_RATION_WINDOW_MS, Z as encodeCommunityLink, Z_ as enrollGrantFrame, Za as PairingTracker, Zb as MAX_AVATAR_SIDE, Zc as HoldKeys, Zd as editedFrame, Zf as appCardId, Zg as handoffEphemeral, Zh as RECORD_TTL, Zi as fetchLnurlJson, Zl as IdentityExchange, Zm as STALLED_LOOK_MS, Zn as varBytes, Zo as PairedCalls, Zp as SAID_AGAIN, Zr as DID_DHT_PREFIX, Zs as wakeFrame, Zt as MAX_GROUP_PICTURE_LENGTH, Zu as DHT_TEXT_BYTES, Zv as webCryptoSigner, Zy as HEDGE_MISSING_MS, _ as APP_CLIENTS, __ as readHandoffCancel, _a as BLOCKED_DIAL_WAIT_MS, _b as BREAKER_MAX_MS, _c as AppSessions, _d as sanitizeMime, _f as REACTED_FRAME, _g as HANDOFF_CANCEL_REASONS, _h as decodeChunk, _i as SEPOLIA_TEST_USDT_FAUCET, _l as normalizeDomain, _m as openPair, _n as SSH_KEY_TYPES, _o as SIGNAL_HOLD_MS, _p as APP_NAME, _r as parseAtprotoCar, _s as sanitizeTypingStatus, _t as GROUP_WAKE_GROUP_WINDOW_MS, _u as STORAGE_ROOT, _v as INVITE_VERSION, _y as TURN_TTL, a as checkAppBeforeRun, a_ as handoffReleaseFrame, aa as BOLT11_PATTERN, ab as SLOW_DEMOTE_MS, ac as generateVapidKeys, ad as dhtFileId, af as linkEnd, ag as SERVICES_VERSION, ah as parseLocalTarget, ai as didDhtRecords, al as DOMAIN_MAX_RECORDS, am as sortRoster, an as groupName, ao as isGroupMessageId, ap as readStatusCard, ar as checkAtprotoProofRecord, as as TYPING_FRAME, at as KNOCK_TTL_MS, au as newIdentityBinding, av as DEVICE_INVITE_BYTES, ax as trimEndOf, ay as TOMBSTONE_SEQUENCE, b as APP_ICON_PATH, b_ as readHandoffFileFrame, ba as DEMOTE_AFTER_FAILURES, bb as DiscoveryBudgetError, bc as appDataFrame, bd as VOICE_LIMITS, bf as ReactionWindow, bg as HANDOFF_FILE_MISSING, bh as encodeControl, bi as WALLET_NETWORKS, bl as recordsFromWellKnown, bm as sealSecret, bn as parseSshPublicKey, bo as groupSignalFrame, bp as appFingerprint, br as readAtprotoCid, bs as typingKindOf, bt as GroupWakeLimiter, bu as isProofAdapter, bv as createLink, by as encodeTurnFields, c as APP_STORE_LIMITS, c_ as handoffStreamKey, ca as ENDPOINT, cb as WATCH_SHARE, cc as vapidKeysMatch, cd as imageSize, cf as previewImageSize, cg as isValidServiceId, ch as sanitizeRequestHeaders, ci as jwkThumbprint, cl as NIP05_PATH, cm as verifyCommitSignature, cn as parseGroupMetaBody, co as readGroupWant, cp as statusCardText, cr as parseAtprotoDidDocument, cs as TYPING_RATE_WINDOW_MS, ct as encodeGroupEntryLink, cu as signIdentityPresentation, cv as createDeviceInvite, cx as fromBase64, cy as TURN_LABEL, d as readAppListing, d_ as handoffVersions, da as findEndpoint, db as normalizeRelayUrl, dc as APP_PEER_OPEN_MAX, dd as readImageMeta, df as forwardedAgain, dg as servicesToWire, dh as webLocalFetch, di as signDidDhtPacket, dl as dnsProofName, dm as confirmationTag, dn as parseGroupMetaTag, do as CarriedTransport, dp as MESSAGE_CLOCK_SKEW_MS, dr as AtprotoProofError, ds as TYPING_STATUS_MAX, dt as knockIdentity, du as applyIdentityEvent, dv as encodeDeviceInvite, dx as randomBytes, dy as TURN_NAME_BYTES, e_ as handoffHaveFrames, ea as parseInvoiceCallback, eb as RELAY_REQUESTS_PER_MINUTE, ec as PUSH_SERVICE_HOSTS, ed as LIVE_POLL_MS, ef as validEditMessage, eg as isEmptyLinkPacket, eh as presenceSeenAt, ei as DidDhtError, el as newMailbox, em as expectedRoster, en as groupMetaBody, eo as GROUP_VERSION_FILES, ep as cardLine, er as ATPROTO_PROOF_COLLECTION, es as FILE_FRAMES, et as shortHash, eu as identityPresentationBytes, ev as enrollProofFrame, ex as MAX_NICK_LENGTH, ey as TURN_SETTLE_MS, f as readAppStore, f_ as isHandoffPartName, fa as isFederationId, fb as readRelayBody, fc as APP_RATE_LIMIT, fd as FileTransfers, ff as forwardedMany, fg as HANDOFF_ACK, fh as CHUNK_FLAG_END, fi as ETHEREUM_USDT, fl as domainTxtRecord, fm as decryptText, fn as signGroupMeta, fo as GROUP_SIGNAL_FRAME, fp as arrivalKey, fr as atprotoCidFor, fs as TYPING_TIMEOUT_MS, ft as knockRecords, fu as lastSharedWithMe, fv as readDeviceInvite, fx as toBase64, fy as TURN_NO_ACTIVE, g as APP_BUNDLE_MAGIC, g_ as readHandoffBusy, ga as ANSWERS_REFUSED_PAUSE_MS, gb as BREAKER_BASE_MS, gc as APP_VERSION_MAX, gd as sanitizeFileName, gf as QUICK_REACTIONS, gg as HANDOFF_CANCEL, gh as PROTOCOL_VERSION, gi as SEPOLIA_TEST_USDT, gl as nip05RootKey, gm as newEpochSecret, gn as SSHSIG_NAMESPACE, go as SIGNAL_FRESH_MS, gp as shownTime, gr as findInMst, gs as parseTypingFrame, gt as GROUP_WAKE_GROUP_LIMIT, gu as STORAGE_LIFETIME, gv as INVITE_MAX_LENGTH, gx as utf8Encode, gy as TURN_SLOTS, h as APP_BUNDLE_LIMITS, h_ as readHandoffAck, ha as ANSWERS_REFUSED_PAUSES, hb as BREAKER_ALL_DOWN_PROBE_MS, hc as APP_SEND_LIMIT, hd as safeBlobType, hf as GROUP_REACTION_FRAME, hg as HANDOFF_BUSY_REASONS, hh as MAX_CHUNK_PAYLOAD_BYTES, hi as PaymentPreflightError, hl as isPublicAddress, hm as epochKeys, hn as SSHSIG_MAX_ARMOR, ho as SIGNAL_CARRIERS, hp as receivedTimestamp, hr as encodeDagCbor, hs as parseTypingActivity, ht as GROUP_WAKE_FRAME, hu as PeerProofs, hv as INVITE_LINK_ORIGIN, hx as utf8Decode, hy as TURN_SIGNED_BYTES, i as appUpdateDecision, i_ as handoffPakeFrame, ia as resolveLightningDestination, ib as SIGNALING_WINDOW_MS, ic as encryptPushPayload, id as dhtFileElements, if as canonicalUrl, ig as MAX_SERVICES, ih as formatLocalTarget, ii as didDhtKey, il as DOMAIN_FILE_MAX_BYTES, im as signCommit, in as groupMetaTag, io as groupFileFallback, ip as checkStatusCard, ir as atprotoProofRkey, is as transferStalled, it as GROUP_ENTRY_PROFILE, iu as isIdentityBinding, iv as verifyEnrollProof, ix as stripHidden, iy as turnPutSummary, j as isAppPath, j_ as SET_ACK, ja as PAIRING_ATTEMPT_MS, jb as newerPacket, jc as FILES_CAPABILITY, jd as voiceLevel, jf as validReactionNumber, jg as HANDOFF_RELEASE, jh as CALL_SIGNAL_FUTURE_MS, ji as sparkAddressKind, jl as CapsKeys, jm as DIRECT_EVIDENCE_MS, jn as MessageRefusal, jo as COMMUNITY_TOPOLOGY, jp as readAppRevocationShape, jr as DidError, js as pinFrame, jt as frameBytes, ju as RING_LIFETIME, jv as DEVICE_CAPABILITIES, jy as turnKeys, k as findAppForbiddenKey, k_ as sealHandoffPiece, ka as LIVENESS_PING_MS, kb as createRelayPayload, kc as CALLS_CAPABILITY, kd as voiceDownloadName, kf as readDhtReactions, kg as HANDOFF_PIECE_BYTES, kh as offerIsFresh, ki as SPARK_PROVIDER, kl as CAPS_REFRESH_MS, km as REANSWERS, kn as verifyBitcoinMessage, ko as pickMeshHubs, kp as isAppSignature, kr as DID_MAX_LENGTH, ks as parsePinFrame, kt as asWritten, ku as verifyNostrProof, kv as readInviteCode, ky as signTurnRelease, l as checkAppListing, l_ as handoffVerifiedFrame, la as cashuRequestPayload, lb as WRITE_FIRST_MS, lc as APP_DATA_MAX_BYTES, ld as isImageMime, lf as sanitizePreviewImage, lg as serviceIdFromName, lh as sanitizeResponseHeaders, li as openDidDhtPayload, ll as WELL_KNOWN_PATH, lm as GROUP_PROFILE, ln as parseGroupMetaFrame, lo as readGroupWantNo, lp as taskProgress, lr as shortAtprotoDid, ls as TYPING_REFRESH_MS, lt as entryParams, lu as verifyIdentityPresentation, lv as deviceInviteJoinerKeyZ32, lx as fromBase64Url, ly as TURN_LAST_SEQUENCE, m as signAppStore, m_ as openHandoffPiece, ma as parseFedimintRequestPayload, mb as traceLink, mc as APP_RESUME_GRACE_MS, md as formatFileSize, mf as COMMUNITY_REACTION_FRAME, mg as HANDOFF_BUSY, mh as LIMITS, mi as ONCHAIN_PROVIDER, ml as encodeDnsQuery, mm as encryptText, mn as wrapGroupMeta, mo as SIGNALS_PER_MINUTE, mp as heardTime, mr as decodeDagCbor, ms as TypingSender, mt as readKnocks, mu as PROOF_CAPABILITY, mv as INVITE_HRP, mx as toZ32, my as TURN_SEALED_BYTES, n as appRevocationFor, n_ as handoffManifestFrames, na as parsePayParams, nb as RelayTransport, nc as checkPushEndpoint, nd as peekDhtMailbox, nf as LINK_MAX_CHARS, ng as HTTP_SERVICE_PROTO, nh as HttpClient, ni as didDhtDocument, nl as DNS_LABEL, nm as rosterAdmin, nn as groupMetaNewer, no as GROUP_WANT_NO_FRAME, np as cardTimeUtc, nr as atprotoDidMethod, ns as refusalText, nt as verifyCommunityChain, nu as identityStatement, nv as readEnrollGrant, nx as sanitizeDisplayText, ny as classifyTurnRead, o as planAppUpdate, o_ as handoffRequestFrame, oa as decodeBolt11, ob as SLOW_MS, oc as pushRequest, od as readDhtFile, of as linksIn, og as decodeServices, oh as relativizeLocation, oi as encodeDidDhtDeactivated, ol as DOMAIN_METHODS, om as verifyChain, on as nextGroupMetaRevision, oo as readGroupFileMeta, op as sameButtonText, or as isAtprotoDid, os as TYPING_KINDS, ot as MAX_KNOCKS, ou as receivedIdentityStatus, ov as DEVICE_INVITE_LIFETIME_S, ox as bytesEqual, oy as TOMBSTONE_TURN, p as readAppStoreSteps, p_ as newHandoffId, pa as parseCashuRequestPayload, pb as setLinkTraceSink, pc as APP_RATE_WINDOW_MS, pd as PREVIEWABLE_IMAGE, pf as readForwarded, pg as HANDOFF_ATTEMPTS, ph as CHUNK_KIND, pi as EVM_TEST_CHAINS, pl as domainWellKnownFile, pm as edgeParams, pn as verifyGroupMetaSignature, po as GROUP_VERSION_SIGNALS, pp as claimedTime, pr as decodeAtprotoCommit, ps as TypingReceiver, pt as mergeKnocks, pu as PROOF_ADAPTERS, pv as DEVICE_INVITE_VERSION, px as toBase64Url, py as TURN_REV_LIMIT, q as communityRoster, q_ as enrollCancelFrame, qa as EngineError, qb as generateEncryptionKey, qc as SESSION_RECEIVE_PENDING, qd as MAX_EDITS_PER_MESSAGE, qf as ROUTINE_STATES, qg as handoffContextProof, qh as signalHasVideo, qi as homeserverWebEndpoint, ql as IDENTITY_REVOCATION_LABEL, qm as OFFER_STEP_MAX, qn as sha256d, qo as shouldBeHub, qp as MAX_GROUP_CHAIN, qr as signingKeys, qs as parseWakeFrame, qt as wireMentions, qu as ACTIVE_DHT_POLL_MS, qv as signDeviceTransports, qy as GROUP_BURST_ONE_LINK, r as appStoreDecision, r_ as handoffOfferFrame, ra as requestLnurlInvoice, rb as SIGNALING_ALLOWANCE_SHARE, rc as decryptPushPayload, rd as DHT_FILE_CAPABILITY, rf as LINK_PREVIEW_LIMITS, rg as LEGACY_SERVICES, rh as HttpHost, ri as didDhtFromPublicKey, rl as DNS_TYPE, rm as rosterHas, rn as groupMetaPicture, ro as fetchesByItself, rp as cardUrl, rr as atprotoProofRecord, rs as transferEnded, rt as verifyCommunityCommit, ru as identityStatementText, rv as readEnrollHello, rx as sanitizeNick, ry as keptAtEqualSequence, s as APP_STORE_KINDS, s_ as handoffRetryAfter, sa as findBolt11, sb as TURN_SOURCE_TIMEOUT_MS, sc as vapidAuthorization, sd as IMAGE_LIMITS, sf as parseLinkPreview, sg as encodeServices, sh as resolveTargetUrl, si as encodeDidDhtPacket, sl as DOMAIN_TXT_MAX_BYTES, sm as verifyCommit, sn as openGroupMeta, so as readGroupHave, sp as statusCardBytes, sr as normalizeAtprotoHandle, ss as TYPING_RATE_LIMIT, st as decodeGroupEntryLink, su as revokesIdentity, sv as DEVICE_INVITE_OWN_DEVICE, sx as concatBytes, sy as TURN_BODY_BYTES, t as addedAppPermissions, t_ as handoffHelloFrame, ta as parseLightningDestination, tb as REQUESTS_PER_MINUTE, tc as WebPushError, td as emptyDhtDeliveryState, tf as validEditNumber, tg as parseLinkRecords, th as GhostlyHttpError, ti as decodeDidDhtPacket, tl as readManifest, tm as rememberAlone, tn as groupMetaChange, to as GROUP_WANT_FRAME, tp as cardLinkHost, tr as ATPROTO_PROOF_SCOPE, ts as FILE_LIMITS, tt as signCommunity, tu as identityRevocationValue, tv as formatEnrollDigits, tx as hasVisible, ty as TURN_VISIBLE_MS, u as checkAppStoreIndex, u_ as handoffVerifiedMessage, ua as fedimintRequestPayload, ub as currentRelays, uc as APP_FRAME, ud as parseImageMeta, uf as FORWARD_LIMITS, ug as servicesFromWire, uh as viewerResponseHeaders, ui as resolveDidDht, ul as decodeDnsResponse, um as confirmationMatches, un as parseGroupMetaStatement, uo as CARRIED_DEFER_MS, up as usageLeft, ur as AtprotoCid, us as TYPING_SEND_LIMIT, ut as groupEntryUrl, uu as IDENTITY_TIMELINE_MAX, uv as deviceInviteJoinerParams, ux as fromZ32, uy as TURN_MAX, v as APP_CLIENT_NAME, v_ as readHandoffData, va as CROSSED_FRESH_MS, vb as BREAKER_THRESHOLD, vc as appCloseFrame, vd as PLAYABLE_AUDIO, vf as REACTION_FRAME, vg as HANDOFF_DATA, vh as decodeControl, vi as TEST_USDT_FAUCET_AMOUNT, vl as parseDomainTxt, vm as openSecret, vn as SSH_PUBLIC_KEY_MAX, vo as SIGNAL_PROVEN_MS, vp as APP_PREFIXES, vr as parseAtprotoDidKey, vs as typingActivity, vt as GROUP_WAKE_MEMBER_INTERVAL_MS, vu as emptyProofLedger, vv as OwnInviteError, vy as TURN_VERSION, w as appDigest, w_ as readHandoffPake, wa as GhostLink, wb as withRequestOptions, wc as isChatAppId, wd as fileMessageText, wf as queueReaction, wg as HANDOFF_LATER_BYTES, wh as DATA_CHANNEL_LABEL, wi as isWalletNetwork, wl as wellKnownUrl, wm as DATA_SETTLE_MS, wn as sshKeyDigestHex, wo as NO_HUB_POLICY, wp as appSignedBytes, wr as DID_DOCUMENT_MAX_BYTES, ws as PIN_CLOCK_SKEW_MS, wt as parseGroupWakeFrame, wu as proofStatement, wv as inviteLink, wy as readTurnBody, x as APP_PERMISSIONS, x_ as readHandoffHave, xa as DEMOTE_MS, xb as budgetRetryMs, xc as appOpenFrame, xd as VOICE_METER, xf as nextReactionNumber, xg as HANDOFF_FILE_REQUEST, xh as sendBody, xi as assertTokenUnits, xl as recordsName, xm as sha256Hex, xn as parseSshSignature, xo as readGroupSignal, xp as appRef, xr as unsignedCommitBytes, xs as COMMUNITY_PIN_FRAME, xt as groupWakeFrame, xu as nostrProofTemplate, xv as decodeInviteCode, xy as firstDeviceSetSecret, y as APP_FORBIDDEN_KEYS, y_ as readHandoffDone, ya as CROSSED_WAIT_MS, yb as RelayBreaker, yc as appDataBytes, yd as RECORDING_TYPES, yf as REACTION_LIMITS, yg as HANDOFF_DONE, yh as encodeChunk, yi as USDT_PUBLIC_RPC, yl as recordsFromTxt, ym as sealPair, yn as SshSigError, yo as SIGNAL_REPLY_MS, yp as APP_STATEMENT_LIMITS, yr as parseAtprotoVerificationKey, ys as typingFrame, yt as GROUP_WAKE_RECEIVE_LIMIT, yu as importedProof, yv as createChatInvite, yy as TurnRecordError, z as COMMUNITY_LIMITS, z_ as verifySetUpdate, za as RTC_UNSTARTED_MS, zb as createIdentity, zc as TYPING_CAPABILITY, zd as parseVideoMeta, zf as replySnippet, zg as filePartName, zh as compressSdp, zi as isPubkyProofFolder, zl as IDENTITY_CHALLENGE_WINDOW, zm as DHT_POLL_INTERVALS, zn as compactSize, zo as mergeBeacon, zp as canonicalJson, zr as didWebFileNames, zs as WAKE_CALL_WAIT_MS, zt as meshMessageRef, zu as TRANSPORTS, zv as deviceKeyZ32, zy as turnVerifierMark } from "./src-DCeLPsi-.js";
|
|
2
|
+
//#region ../core/src/paymentUri.ts
|
|
3
|
+
/** Whole sats as the decimal BTC amount BIP 21 wants (`21` → `0.00000021`), never in exponent form. */
|
|
4
|
+
function satsToBtc(sats) {
|
|
5
|
+
if (!Number.isSafeInteger(sats) || sats < 0) throw new Error("Amount must be a whole number of sats");
|
|
6
|
+
const whole = Math.floor(sats / 1e8);
|
|
7
|
+
const fraction = String(sats % 1e8).padStart(8, "0").replace(/0+$/, "");
|
|
8
|
+
return fraction ? `${whole}.${fraction}` : String(whole);
|
|
9
|
+
}
|
|
10
|
+
var cleanInvoice = (invoice) => invoice.trim().toLowerCase().replace(/^lightning:/, "");
|
|
11
|
+
/** The URI to open in another wallet. Throws on an input that cannot be one. */
|
|
12
|
+
function paymentUri(input) {
|
|
13
|
+
if (input.kind === "lightning") {
|
|
14
|
+
const invoice = cleanInvoice(input.invoice);
|
|
15
|
+
if (!/^ln[a-z0-9]+$/.test(invoice)) throw new Error("That is not a Lightning invoice");
|
|
16
|
+
return `lightning:${invoice}`;
|
|
17
|
+
}
|
|
18
|
+
const params = new URLSearchParams();
|
|
19
|
+
if (input.kind === "ark") {
|
|
20
|
+
if (!/^[a-z0-9]+$/i.test(input.address)) throw new Error("That is not an Ark address");
|
|
21
|
+
params.set("ark", input.address);
|
|
22
|
+
if (input.amountSat) params.set("amount", satsToBtc(input.amountSat));
|
|
23
|
+
return `bitcoin:?${params.toString()}`;
|
|
24
|
+
}
|
|
25
|
+
if (!/^[a-zA-Z0-9]+$/.test(input.address)) throw new Error("That is not a Bitcoin address");
|
|
26
|
+
if (input.amountSat) params.set("amount", satsToBtc(input.amountSat));
|
|
27
|
+
if (input.label) params.set("label", input.label.slice(0, 140));
|
|
28
|
+
if (input.message) params.set("message", input.message.slice(0, 140));
|
|
29
|
+
if (input.lightning) params.set("lightning", cleanInvoice(input.lightning));
|
|
30
|
+
const query = params.toString().replace(/\+/g, "%20");
|
|
31
|
+
return query ? `bitcoin:${input.address}?${query}` : `bitcoin:${input.address}`;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* What to put in the QR code: a `lightning:` URI in upper case, so the code uses the smaller alphanumeric
|
|
35
|
+
* mode every Lightning wallet reads; anything with characters outside that mode as it is.
|
|
36
|
+
*/
|
|
37
|
+
function qrText(uri) {
|
|
38
|
+
const upper = uri.toUpperCase();
|
|
39
|
+
return /^[A-Z0-9 $%*+\-./:]*$/.test(upper) ? upper : uri;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region ../core/src/version.ts
|
|
43
|
+
/**
|
|
44
|
+
* Which of two released versions is newer. Every client asks this of whatever
|
|
45
|
+
* it found published, so a malformed answer must never read as an update: the
|
|
46
|
+
* numbers are the only thing trusted here, and anything else sorts as older.
|
|
47
|
+
*/
|
|
48
|
+
/** `1.2.3`, with an optional `v` and an optional `-beta.1` this ignores. */
|
|
49
|
+
var RELEASE = /^v?(\d{1,6})\.(\d{1,6})\.(\d{1,6})(?:[-+].*)?$/;
|
|
50
|
+
function parse(version) {
|
|
51
|
+
const match = RELEASE.exec(version.trim());
|
|
52
|
+
return match ? [
|
|
53
|
+
Number(match[1]),
|
|
54
|
+
Number(match[2]),
|
|
55
|
+
Number(match[3])
|
|
56
|
+
] : null;
|
|
57
|
+
}
|
|
58
|
+
/** Negative when `a` is older, positive when it is newer, 0 when they match or either is not a version. */
|
|
59
|
+
function compareVersions(a, b) {
|
|
60
|
+
const left = parse(a);
|
|
61
|
+
const right = parse(b);
|
|
62
|
+
if (!left || !right) return 0;
|
|
63
|
+
for (let i = 0; i < 3; i++) if (left[i] !== right[i]) return left[i] - right[i];
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
/** Whether `latest` is worth updating to from `current`. Unparseable input is never an update. */
|
|
67
|
+
function isNewerVersion(latest, current) {
|
|
68
|
+
return compareVersions(latest, current) > 0;
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region ../core/src/clockWatch.ts
|
|
72
|
+
/**
|
|
73
|
+
* 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
|
|
74
|
+
* connection (the chat's connection panel, Settings → Network): "This device's clock seems to be off by about 2 minutes.
|
|
75
|
+
* Chats may be slow to connect."
|
|
76
|
+
*
|
|
77
|
+
* Ghostly dates what it publishes by this device's clock, and several of its checks hold a contact's dates against
|
|
78
|
+
* it. A clock a few minutes off makes chats and groups slow to connect, or never connect with apps that have not been
|
|
79
|
+
* updated, and nothing on screen says why. The app cannot set the clock; it can notice and say.
|
|
80
|
+
*
|
|
81
|
+
* What it hears (`ClockWatch`), each as "this clock minus theirs is between `low` and `high`":
|
|
82
|
+
* - a **server**: the `Date` header of an HTTP answer (a Pkarr relay's), a time to the second read between the moment
|
|
83
|
+
* the request went out and the moment its answer came. Where a browser may not read that header of another origin,
|
|
84
|
+
* there is none.
|
|
85
|
+
* - a **contact**: the time of a contact's packet that came between two close reads of its record. Its own clock dated
|
|
86
|
+
* it, and this device knows within seconds when it was published.
|
|
87
|
+
*
|
|
88
|
+
* The rule, on purpose slow to say yes, and never on one contact's word (it is as likely that contact's clock):
|
|
89
|
+
* - a source says "off" only when everything it allows is more than `CLOCK_OFF_MS` on one side;
|
|
90
|
+
* - two servers that both say so, the same way, are enough: servers keep time;
|
|
91
|
+
* - else one server and a contact that say so, with no contact saying otherwise;
|
|
92
|
+
* - else three contacts that say so, the same way, and at least three for each one that does not.
|
|
93
|
+
* The amount is the middle of what the sources that say so give (the servers', when two do). Evidence older than
|
|
94
|
+
* `CLOCK_EVIDENCE_MS` says nothing: a clock that was set right is believed at the next answer, and the note goes away.
|
|
95
|
+
*/
|
|
96
|
+
/** 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. */
|
|
97
|
+
var CLOCK_OFF_MS = 6e4;
|
|
98
|
+
/** Evidence older than this says nothing about the clock now. */
|
|
99
|
+
var CLOCK_EVIDENCE_MS = 18e5;
|
|
100
|
+
/** Contacts that must say so when no server does. */
|
|
101
|
+
var CLOCK_PEERS = 3;
|
|
102
|
+
/** Servers that are enough by themselves. */
|
|
103
|
+
var CLOCK_SERVERS = 2;
|
|
104
|
+
/** A contact's packet says something only when the two reads around it were this close. */
|
|
105
|
+
var CLOCK_PEER_READ_GAP_MS = 15e3;
|
|
106
|
+
/** Sources kept of each kind: a profile has a few relays, and may have hundreds of contacts. */
|
|
107
|
+
var KEPT = 64;
|
|
108
|
+
/** -1: everything the sample allows is behind by more than `CLOCK_OFF_MS`; 1: ahead; 0: it does not say. */
|
|
109
|
+
var says = (sample) => sample.low > 6e4 ? 1 : sample.high < -6e4 ? -1 : 0;
|
|
110
|
+
var middle = (values) => {
|
|
111
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
112
|
+
return sorted[Math.floor((sorted.length - 1) / 2)];
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* The rule alone: how far this clock is from the others' (ms, positive when it is ahead) when the samples fresh at
|
|
116
|
+
* `now` say it is clearly off, else null.
|
|
117
|
+
*/
|
|
118
|
+
function clockOffset(servers, peers, now) {
|
|
119
|
+
const fresh = (samples) => [...samples.values()].filter((s) => now - s.at < CLOCK_EVIDENCE_MS);
|
|
120
|
+
const s = fresh(servers), p = fresh(peers);
|
|
121
|
+
const mid = (sample) => (sample.low + sample.high) / 2;
|
|
122
|
+
for (const way of [1, -1]) {
|
|
123
|
+
const serversOff = s.filter((x) => says(x) === way), peersOff = p.filter((x) => says(x) === way);
|
|
124
|
+
const serversNot = s.length - serversOff.length, peersNot = p.length - peersOff.length;
|
|
125
|
+
if (serversOff.length >= 2 && serversNot === 0) return Math.round(middle(serversOff.map(mid)));
|
|
126
|
+
if (serversNot > 0) continue;
|
|
127
|
+
if (serversOff.length === 1 && peersOff.length >= 1 && peersNot === 0) return Math.round(middle([...serversOff, ...peersOff].map(mid)));
|
|
128
|
+
if (peersOff.length >= 3 && peersOff.length >= 3 * peersNot) return Math.round(middle(peersOff.map(mid)));
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
var ClockWatch = class {
|
|
133
|
+
onChange;
|
|
134
|
+
now;
|
|
135
|
+
servers = /* @__PURE__ */ new Map();
|
|
136
|
+
peers = /* @__PURE__ */ new Map();
|
|
137
|
+
was = null;
|
|
138
|
+
timer = null;
|
|
139
|
+
/** `onChange`: what `offset` says changed (it appeared, went away, or moved by a minute). */
|
|
140
|
+
constructor(onChange = () => {}, now = Date.now) {
|
|
141
|
+
this.onChange = onChange;
|
|
142
|
+
this.now = now;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* A server's time: `date` (ms, to the second) from an answer to a request that went out at `sent` and came back at
|
|
146
|
+
* `received`, both by this clock.
|
|
147
|
+
*/
|
|
148
|
+
server(source, date, sent, received) {
|
|
149
|
+
if (!Number.isFinite(date) || date <= 0 || received < sent) return;
|
|
150
|
+
this.keep(this.servers, source, {
|
|
151
|
+
low: sent - date - 999,
|
|
152
|
+
high: received - date,
|
|
153
|
+
at: this.now()
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* A contact's packet, dated `packetAt` by its clock, that came between this device's reads of its record at
|
|
158
|
+
* `readBefore` and `readAt` (this clock). Says nothing when the two reads were far apart.
|
|
159
|
+
*/
|
|
160
|
+
peer(peer, packetAt, readBefore, readAt) {
|
|
161
|
+
if (!(readBefore > 0) || readAt < readBefore || readAt - readBefore > 15e3 || !Number.isFinite(packetAt)) return;
|
|
162
|
+
this.keep(this.peers, peer, {
|
|
163
|
+
low: readBefore - packetAt,
|
|
164
|
+
high: readAt - packetAt,
|
|
165
|
+
at: this.now()
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
keep(samples, source, sample) {
|
|
169
|
+
samples.delete(source);
|
|
170
|
+
samples.set(source, sample);
|
|
171
|
+
if (samples.size > KEPT) samples.delete(samples.keys().next().value);
|
|
172
|
+
this.settle();
|
|
173
|
+
}
|
|
174
|
+
/** This clock minus the others', in ms (positive: ahead), when it is clearly off; else null. */
|
|
175
|
+
get offset() {
|
|
176
|
+
return clockOffset(this.servers, this.peers, this.now());
|
|
177
|
+
}
|
|
178
|
+
/** The clock was set, or the evidence is of another time: nothing is known until the next answers. */
|
|
179
|
+
reset() {
|
|
180
|
+
this.servers.clear();
|
|
181
|
+
this.peers.clear();
|
|
182
|
+
this.settle();
|
|
183
|
+
}
|
|
184
|
+
/** Stops the timer that lets the evidence age out. */
|
|
185
|
+
close() {
|
|
186
|
+
if (this.timer) clearTimeout(this.timer);
|
|
187
|
+
this.timer = null;
|
|
188
|
+
}
|
|
189
|
+
settle() {
|
|
190
|
+
this.close();
|
|
191
|
+
for (const samples of [this.servers, this.peers]) for (const [source, sample] of samples) if (this.now() - sample.at >= 18e5) samples.delete(source);
|
|
192
|
+
const offset = this.offset;
|
|
193
|
+
if (offset !== null) {
|
|
194
|
+
const oldest = Math.min(...[...this.servers.values(), ...this.peers.values()].map((s) => s.at));
|
|
195
|
+
this.timer = setTimeout(() => this.settle(), Math.max(1e3, oldest + CLOCK_EVIDENCE_MS - this.now()));
|
|
196
|
+
this.timer.unref?.();
|
|
197
|
+
}
|
|
198
|
+
const reads = (value) => value === null ? null : Math.round(value / 6e4);
|
|
199
|
+
if (reads(offset) === reads(this.was)) return;
|
|
200
|
+
this.was = offset;
|
|
201
|
+
this.onChange(offset);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
//#endregion
|
|
205
|
+
export { ACTIVE_DHT_POLL_MS, ACTIVE_TASK_STATUSES, ANSWERS_REFUSED_PAUSES, ANSWERS_REFUSED_PAUSE_MS, ANSWER_REFUSED_REDIALS, APPS_CAPABILITY, APP_BUNDLE_LIMITS, APP_BUNDLE_MAGIC, APP_CLIENTS, APP_CLIENT_NAME, APP_DATA_MAX_BYTES, APP_FORBIDDEN_KEYS, APP_FRAME, APP_ICON_PATH, APP_NAME, APP_PEER_OPEN_MAX, APP_PERMISSIONS, APP_PREFIXES, APP_RATE_LIMIT, APP_RATE_WINDOW_MS, APP_RESUME_GRACE_MS, APP_SCREENSHOTS_DIR, APP_SEND_LIMIT, APP_STATEMENT_LIMITS, APP_STORE_KINDS, APP_STORE_LIMITS, APP_VERSION_MAX, APP_VIEWS, ATPROTO_DECLARED_SCOPE, ATPROTO_FULL_SCOPE, ATPROTO_PROOF_COLLECTION, ATPROTO_PROOF_SCOPE, AWAITING_PEER_MS, AppSessions, AtprotoCid, AtprotoProofError, BACKGROUND_REQUESTS_PER_MINUTE, BACKGROUND_WHILE_SIGNALING, BIP322_REVISION, BITCOIN_NETWORKS, BLOCKED_DIAL_WAIT_MS, BOLT11_PATTERN, BREAKER_ALL_DOWN_PROBE_MS, BREAKER_BASE_MS, BREAKER_MAX_MS, BREAKER_THRESHOLD, BUTTONS_CAPABILITY, BUTTON_ID, BUTTON_STYLES, BitcoinAddressError, ByteReader, CALLS_CAPABILITY, CALL_SIGNAL_FUTURE_MS, CALL_SIGNAL_MAX_AGE_MS, CAPS_ISSUED_BACK_MS, CAPS_LABEL, CAPS_LIMITS, CAPS_PUBLISH_SPACING_MS, CAPS_REFRESH_MS, CARRIED_DEFER_MS, CHAT_RESERVE, CHUNK_FLAG_END, CHUNK_KIND, CLOCK_EVIDENCE_MS, CLOCK_OFF_MS, CLOCK_PEERS, CLOCK_PEER_READ_GAP_MS, CLOCK_SERVERS, COMMUNITY_EDIT_FRAME, COMMUNITY_LIMITS, COMMUNITY_PIN_FRAME, COMMUNITY_PROFILE, COMMUNITY_REACTION_FRAME, COMMUNITY_TOPOLOGY, CONNECT_TIMEOUT_MS, CROSSED_FRESH_MS, CROSSED_WAIT_MS, CapsExchange, CapsKeys, CapsRefusedError, CarriedTransport, ChatFiles, ClockWatch, CommunitySession, DATA_CHANNEL_ID, DATA_CHANNEL_LABEL, DATA_SETTLE_MS, DEFAULT_RELAYS, DEMOTE_AFTER_FAILURES, DEMOTE_MS, DEPARTED_READS, DEPARTED_READ_MS, DEVICES_CAPABILITY, DEVICE_CAPABILITIES, DEVICE_ECHO_FRAME, DEVICE_INVITE_BYTES, DEVICE_INVITE_LIFETIME_S, DEVICE_INVITE_OWN_DEVICE, DEVICE_INVITE_VERSION, DEVICE_KINDS, DEVICE_PING_FRAME, DEVICE_WAKE_TTL_SECONDS, DHT_FILE_CAPABILITY, DHT_FILE_REFUSED, DHT_FILE_TOO_LARGE, DHT_MESSAGE_TTL, DHT_PIN_GRACE_MS, DHT_POLL_INTERVALS, DHT_TEXT_BYTES, DHT_TEXT_CAPABILITY, DHT_TEXT_REFUSED, DID_DHT_MAX_PAYLOAD, DID_DHT_PREFIX, DID_DHT_TTL, DID_DHT_VERSION, DID_DOCUMENT_MAX_BYTES, DID_FILE_MAX_BYTES, DID_GHOSTLY_SERVICE, DID_JWS_ALGS, DID_JWS_MAX_LENGTH, DID_MAX_LENGTH, DID_METHODS, DIRECT_EVIDENCE_MS, DIRECT_OWN_ATTEMPTS, DIRECT_PEERS, DNS_LABEL, DNS_TYPE, DOMAIN_FILE_MAX_BYTES, DOMAIN_MAX_RECORDS, DOMAIN_METHODS, DOMAIN_TXT_MAX_BYTES, DataLink, DhtDelivery, DidDhtError, DidError, DirectPathWatch, DiscoveryBudgetError, EARLY_DIAL_JOIN_MS, EDITED_FRAME, EDIT_BUFFER_MAX, EDIT_BUFFER_MS, EDIT_CAPABILITY, EDIT_FRAME, EDIT_RATE_WINDOW_MS, EDIT_RECEIVE_LIMIT, EDIT_SEND_LIMIT, ENDPOINT, ENGINE_ERRORS, ENROLL_CANCEL, ENROLL_CANCEL_REASONS, ENROLL_CAPABILITY, ENROLL_DONE, ENROLL_GRANT, ENROLL_HELLO, ENROLL_PROOF, ETHEREUM_USDT, EVM_TEST_CHAINS, EXPECT_PEER_MS, EngineError, FILES_CAPABILITY, FILE_FRAMES, FILE_LIMITS, FIRST_PUBLISH_MAX_MS, FORWARD_LIMITS, FRESH_READ_MS, FileTransfers, GATHER_ATTEMPTS, GATHER_STALL_MS, GROUP_ADMIN_OFF_ERROR, GROUP_BURST_MS, GROUP_BURST_ONE_LINK, GROUP_EDIT_FRAME, GROUP_EDIT_TEXT_BYTES, GROUP_ENTRY_PROFILE, GROUP_FILE_LIMITS, GROUP_HAVE_FRAME, GROUP_ID, GROUP_LIMITS, GROUP_MEMBER_CAP, GROUP_OVER_PACE_MS, GROUP_PIN_FRAME, GROUP_PROFILE, GROUP_RATION_WINDOW_MS, GROUP_REACTED_FRAME, GROUP_REACTION_FRAME, GROUP_READ_NOTE, GROUP_READ_NOTE_COMMUNITY, GROUP_SIGNALING_ALLOWANCE_SHARE, GROUP_SIGNAL_FRAME, GROUP_TYPING_FRAME, GROUP_VERSION_FILES, GROUP_VERSION_HUBS, GROUP_VERSION_LARGE, GROUP_VERSION_SIGNALS, GROUP_WAKE_FRAME, GROUP_WAKE_GROUP_LIMIT, GROUP_WAKE_GROUP_WINDOW_MS, GROUP_WAKE_MEMBER_INTERVAL_MS, GROUP_WAKE_RECEIVE_LIMIT, GROUP_WANT_FRAME, GROUP_WANT_NO_FRAME, GhostLink, GhostlyHttpError, GroupSession, GroupTypingBoard, GroupWakeLimiter, HANDLED_WAIT_MS, HANDOFF_ACK, HANDOFF_ATTEMPTS, HANDOFF_BUSY, HANDOFF_BUSY_REASONS, HANDOFF_CANCEL, HANDOFF_CANCEL_REASONS, HANDOFF_CAPABILITY, HANDOFF_DATA, HANDOFF_DONE, HANDOFF_FILE_MISSING, HANDOFF_FILE_REQUEST, HANDOFF_HAVE, HANDOFF_HELLO, HANDOFF_LATER_BYTES, HANDOFF_LIST_PER_FRAME, HANDOFF_MANIFEST, HANDOFF_OFFER, HANDOFF_PAKE, HANDOFF_PIECE_BYTES, HANDOFF_PIECE_OVERHEAD, HANDOFF_RELEASE, HANDOFF_REQUEST, HANDOFF_TIMINGS, HANDOFF_VERIFIED, HANDOFF_VERSION, HANDOFF_WINDOW, HEDGE_MISSING_MS, HEDGE_MS, HOLD_CAPABILITY, HOLD_DATED_BACK_MS, HOLD_LIMITS, HTTP_SERVICE_PROTO, HoldKeys, HoldRefusedError, HttpClient, HttpHost, IDENTITY_CHALLENGE_WINDOW, IDENTITY_CHECK_UNAVAILABLE, IDENTITY_CLOCK_SKEW, IDENTITY_MAX_EVIDENCE, IDENTITY_MAX_FRAME, IDENTITY_MAX_VALIDITY, IDENTITY_PROOF_CAPABILITY, IDENTITY_PROVIDER_ID, IDENTITY_REVOCATION_LABEL, IDENTITY_STATEMENT_PREFIX, IDENTITY_SUBJECT, IDENTITY_TIMELINE_MAX, IDLE_THRESHOLD, IMAGE_LIMITS, INVITER_DIAL_GRACE_MS, INVITE_HRP, INVITE_LINK_ORIGIN, INVITE_MAX_LENGTH, INVITE_TAKEN, INVITE_VERSION, ITEM_STATES, IdentityCheckUnavailable, IdentityExchange, KNOCK_TTL_MS, KNOWN_SESSION_CAPABILITIES, LABEL, LEGACY_GROUP_MEMBERS, LEGACY_SERVICES, LIGHTNING_DESTINATION_PATTERN, LIMITS, LINK_MAX_CHARS, LINK_PREVIEW_LIMITS, LIVENESS_MISSED_PINGS, LIVENESS_PING_MS, LIVE_POLL_MS, LNURL_LIMITS, LinkSession, MAX_AVATAR_LENGTH, MAX_AVATAR_SIDE, MAX_CHUNK_PAYLOAD_BYTES, MAX_DHT_TEXT_BYTES, MAX_DNS_PACKET_BYTES, MAX_EDITS_PER_MESSAGE, MAX_GROUP_CHAIN, MAX_GROUP_MEMBERS, MAX_GROUP_META_BODY, MAX_GROUP_NAME_BYTES, MAX_GROUP_NAME_LENGTH, MAX_GROUP_PICTURE_LENGTH, MAX_KNOCKS, MAX_MSGS_PAYLOAD_B64, MAX_NICK_LENGTH, MAX_PAIRED_CALL_SIGNAL, MAX_PAIRED_MESSAGE_FRAME, MAX_SERVICES, MEMBER_KEY, MENTION_EVERYONE, MENTION_LIMITS, MESH_HUBS, MESSAGE_CLOCK_SKEW_MS, MessageRefusal, NIP05_PATH, NO_ATTEMPTS, NO_HUB_POLICY, OFFER_FAST_MS, OFFER_HOST_GATHER_MS, OFFER_LOOK_MS, OFFER_STEP_MAX, ONCHAIN_PROVIDER, OWN_FRAME_LIMIT, OwnInviteError, PAIRED_CALL_CANDIDATES, PAIRED_CALL_FRAME, PAIRED_PROFILE, PAIRED_REPLY_AUTHORS, PAIRING_ATTEMPT_MS, PAIRING_RETRY_MS, PINNED_FRAME, PIN_CAPABILITY, PIN_CLOCK_SKEW_MS, PIN_FRAME, PIN_LIMITS, PKARR_FUTURE_SKEW_MS, PLAYABLE_AUDIO, PLAYABLE_VIDEO, PONG_WAIT_MS, PRESENCE_HEARTBEAT, PRESENCE_WINDOW, PREVIEWABLE_IMAGE, PREVIOUS_DEFAULT_RELAYS, PROOF_ADAPTERS, PROOF_CAPABILITY, PROTOCOL_VERSION, PR_CHECKS, PR_STATES, PUBKY_PROOF_MAX_BYTES, PUBKY_PROOF_ROOT, PUSH_SERVICE_HOSTS, PacketTooLargeError, PairedCalls, PairedSession, PairingTracker, PaymentPreflightError, PeerProofs, QUICK_REACTIONS, RACE_ANSWERED_MS, RACE_DIRECT_MS, RACE_RELAYED_MS, REACTED_FRAME, REACTIONS_CAPABILITY, REACTION_FRAME, REACTION_LIMITS, REANSWERS, RECORDING_TYPES, RECORD_TTL, REDESCRIBED_GRACE_MS, RELAY_PAYLOAD_MAX_BYTES, RELAY_POLL_INTERVALS, RELAY_REQUESTS_PER_MINUTE, RELAY_URL, REPLY_ID, REPLY_LIMITS, REQUESTS_PER_MINUTE, RESUME_WAIT_MS, RING_LIFETIME, ROUTINE_STATES, RTC_CONFIG, RTC_SIGNAL_FUTURE_MS, RTC_SIGNAL_MAX_AGE_MS, RTC_UNSTARTED_MS, RUN_RESULTS, RateWindow, ReactionWindow, RelayBreaker, RelayTransport, SAID_AGAIN, SEPOLIA_TEST_USDT, SEPOLIA_TEST_USDT_FAUCET, SERVICES_CAPABILITY, SERVICES_VERSION, SESSION_CAPABILITIES_FRAME, SESSION_FRAME_MAX, SESSION_RECEIVE_PENDING, SET_ACK, SET_UPDATE, SIGNALING_ALLOWANCE_SHARE, SIGNALING_WINDOW_MS, SIGNALS_PER_MINUTE, SIGNAL_CARRIERS, SIGNAL_FRESH_MS, SIGNAL_HOLD_MS, SIGNAL_PROVEN_MS, SIGNAL_REPLY_MS, SLOW_DEMOTE_MS, SLOW_MS, SPARK_NETWORKS, SPARK_PROVIDER, SSHSIG_MAX_ARMOR, SSHSIG_NAMESPACE, SSH_KEY_TYPES, SSH_PUBLIC_KEY_MAX, STALLED_EVIDENCE_MS, STALLED_LOOK_MS, STATUS_CARD_CAPABILITY, STATUS_CARD_LIMITS, STORAGE_LIFETIME, STORAGE_ROOT, SWITCH_RETIRE_MS, SessionCapabilities, SshSigError, TASK_STATUSES, TEST_USDT_FAUCET_AMOUNT, TOMBSTONE_SEQUENCE, TOMBSTONE_TURN, TRANSPORTS, TRANSPORTS_GONE_MS, TURN_BODY_BYTES, TURN_LABEL, TURN_LAST_SEQUENCE, TURN_MAX, TURN_NAME_BYTES, TURN_NO_ACTIVE, TURN_PUT_WINDOW_MS, TURN_RAISE_READ_TIMEOUT_MS, TURN_REV_LIMIT, TURN_SEALED_BYTES, TURN_SETTLE_MS, TURN_SIGNED_BYTES, TURN_SLOTS, TURN_SOURCE_TIMEOUT_MS, TURN_TTL, TURN_VERSION, TURN_VISIBLE_MS, TYPING_CAPABILITY, TYPING_FRAME, TYPING_KINDS, TYPING_RATE_LIMIT, TYPING_RATE_WINDOW_MS, TYPING_REFRESH_MS, TYPING_SEND_LIMIT, TYPING_STATUS_MAX, TYPING_TIMEOUT_MS, TurnRecordError, TypingReceiver, TypingSender, UNPROVEN_AUTH_MS, UPGRADE_CAPABILITY, USDT_PUBLIC_RPC, VIDEO_LIMITS, VOICE_LIMITS, VOICE_METER, WAKE_CALL_INTERVAL_MS, WAKE_CALL_TTL_SECONDS, WAKE_CALL_WAIT_MS, WAKE_SESSION_CAPABILITY as WAKE_CAPABILITY, WAKE_SESSION_CAPABILITY, WAKE_FRAME, WAKE_INTERVAL_MS, WAKE_LOST_MS, WAKE_SUBJECT, WAKE_TTL_SECONDS, WALLET_NETWORKS, WATCH_PEER_MS, WATCH_SHARE, WELL_KNOWN_PATH, WRITE_FIRST_MS, WakeLimiter, WebPushError, addedAppPermissions, answersOffer, appCardId, appCloseFrame, appDataBytes, appDataFrame, appDigest, appFingerprint, appOpenFrame, appRef, appRefPublisher, appRevocationFor, appRevocationId, appSignedBytes, appStoreDecision, appUpdateDecision, appViewOf, applyIdentityEvent, arrivalKey, asWritten, assembleAppBundle, assertTokenUnits, assertWholeSats, atprotoCidFor, atprotoDidMethod, atprotoProofRecord, atprotoProofRkey, automaticTransport, baseMime, beaconKeys, beaconRecords, bip322MessageHash, bip322ToSign, bip322ToSpend, boundVerifiedIdentity, budgetRetryMs, buildAppBundle, buildDataSdp, buildLinkRecords, buildSdpFromSignal, buttonLabelClash, bytesEqual, callRtcConfig, callSignalHeardAt, canonicalJson, canonicalJsonBytes, canonicalUrl, capsDescriptors, cardEditNumber, cardLine, cardLinkHost, cardTimeUtc, cardUrl, carryMentions, cashuRequestPayload, chainPieces, chatAppId, checkAppBeforeRun, checkAppListing, checkAppManifest, checkAppRevokeStatement, checkAppStoreIndex, checkAtprotoProofRecord, checkDidJws, checkDidSignature, checkPushEndpoint, checkStatusCard, checkedDescriptors, claimedTime, classifyTurnRead, clockOffset, commitHash, commitUntaggedHash, communityCommitHash, communityEditFrame, communityGroupId, communityHasFrame, communityMessageAuthor, communityMessageId, communityRoster, communityUntaggedHash, compactSize, compareVersions, compressSdp, concatBytes, confirmationMatches, confirmationTag, createChatInvite, createDeviceInvite, createIdentity, createLink, createRelayPayload, currentRelays, decodeAnyBitcoinAddress, decodeAtprotoCommit, decodeBase64, decodeBitcoinAddress, decodeBolt11, decodeChunk, decodeCommunityLink, decodeControl, decodeDagCbor, decodeDidDhtPacket, decodeDnsAnswers, decodeDnsResponse, decodeGroupEntryLink, decodeInviteCode, decodeServices, decodeSvcbRecords, decodeTx, decodeTxtPacket, decodeWitness, decompressSdp, decrypt, decryptPushPayload, decryptText, derivedSecret, deviceEchoFrame, deviceEchoNonce, deviceFrameCapability, deviceInviteJoinerKeyZ32, deviceInviteJoinerParams, deviceKeyZ32, deviceLinkPairing, deviceLinkParams, deviceLinkRendezvousSeed, deviceLinkSealKey, deviceLinkSecret, devicePingFrame, deviceWakeRequest, dhtEditId, dhtFileElements, dhtFileId, dialDescriptors, didDhtDocument, didDhtFromPublicKey, didDhtKey, didDhtRecords, didGhostlyServiceEntry, didJwsAlg, didSignedMessages, didWebDocumentUrl, didWebFile, didWebFileNames, didWebFileUrl, didWebHost, directBlocked, dnsProofName, domainTxtRecord, domainWellKnownFile, doorHubs, downsamplePeaks, edgeParams, editFrame, editedFrame, emptyCapsState, emptyDhtDeliveryState, emptyIdentityLedger, emptyLinkRecords, emptyProofLedger, encodeChunk, encodeCommunityLink, encodeControl, encodeDagCbor, encodeDeviceInvite, encodeDidDhtDeactivated, encodeDidDhtPacket, encodeDnsQuery, encodeGhostlyInvite, encodeGroupEntryLink, encodeGroupMetaBody, encodeInviteCode, encodePacketTransports, encodeServices, encodeSetSlots, encodeSvcbPacket, encodeTurnFields, encodeTx, encodeTxtPacket, encodeWitness, encrypt, encryptPushPayload, encryptText, engineError, engineText, enrollCancelFrame, enrollCancelReason, enrollDigits, enrollDoneFrame, enrollGrantFrame, enrollHelloFrame, enrollMessage, enrollProofFrame, entryParams, epochKeys, expectedRoster, extractParamsFromSdp, extractRtcParams, fedimintRequestPayload, fetchLnurlJson, fetchesByItself, fileMessageText, filePartDigest, filePartName, findAppForbiddenKey, findBolt11, findEndpoint, findInMst, findLightningDestination, firstDeviceSetSecret, formatEnrollDigits, formatFileSize, formatLocalTarget, formatPaymentAmount, formatVideoDuration, formatVoiceDuration, forwardedAgain, forwardedMany, frameBytes, freshHubs, fromBase64, fromBase64Url, fromZ32, generateEncryptionKey, generateVapidKeys, groupDisplayName, groupEntryUrl, groupFileFallback, groupMessageId, groupMetaBody, groupMetaChange, groupMetaNewer, groupMetaPicture, groupMetaTag, groupName, groupReplyAuthor, groupSignalFrame, groupTypingEpoch, groupWakeFrame, groupWakes, handoffAckFrame, handoffAttemptAllowed, handoffAttemptFailed, handoffAttemptSucceeded, handoffBusyFrame, handoffCancelFrame, handoffContext, handoffContextProof, handoffDataFrame, handoffDigest, handoffDoneFrame, handoffEphemeral, handoffFileMissingFrame, handoffFileRequestFrame, handoffHaveFrames, handoffHelloFrame, handoffManifestFrames, handoffOfferFrame, handoffPakeFrame, handoffReleaseFrame, handoffRequestFrame, handoffRetryAfter, handoffStreamKey, handoffVerifiedFrame, handoffVerifiedMessage, handoffVersions, hasVisible, hash160, heardCallSignal, heardTime, heldBackError, homeserverWebEndpoint, hubRank, identityFromSeed, identityFromSeedB64, identityPresentationBytes, identityRevocationValue, identityStatement, identityStatementText, imageSize, importedProof, inviteLink, inviteOwnership, inviteQrSegments, inviteQrText, invoiceCallbackUrl, irohDescriptor, irohRelayUrl, isAppHash, isAppKey, isAppLicense, isAppPath, isAppRef, isAppSignature, isAppUrl, isAppVersion, isAtprotoDid, isBitcoinAddress, isChatAppId, isDiscoveryBudgetError, isEmptyLinkPacket, isFederationId, isGlobalIpv4Host, isGroupMessageId, isHandoffPartName, isHoldUrl, isIdentityBinding, isImageMime, isLegacySignature, isNewerVersion, isPlayableAudioType, isPlayableVideoType, isProofAdapter, isPubkyKey, isPubkyProofFolder, isPublicAddress, isSparkAddress, isValidServiceId, isVideoMime, isWalletNetwork, jpegSize, jwkThumbprint, keptAtEqualSequence, knockIdentity, knockRecords, lastSharedWithMe, leaveStatement, legacyMessageHash, linkEnd, linksIn, lobbyKeys, lobbyRecords, mayBeHub, mayPin, measureRecords, mentionedMembers, mentionsBytes, mentionsMember, mergeBeacon, mergeKnocks, mergeLobby, meshHubs, meshMessageRef, meshRendezvous, newDeviceSetSecret, newEpochSecret, newHandoffId, newMailbox as newHoldMailbox, newIdentityBinding, newPubkyProofFolder, newWakeToken, newerHead, newerPacket, nextGroupMetaRevision, nextPinNumber, nextReactionNumber, nextTurnPosition, nip05RootKey, normalizeAtprotoHandle, normalizeDid, normalizeDomain, normalizePubkyKey, normalizeRelayUrl, nostrProofTemplate, offerIsFresh, openDidDhtPayload, openGroupMeta, openGroupTyping, openHandoffPiece, openPair, openRelayPayload, openSecret, openTurnValue, ownInviteRefusal, pairedMessageFrame, pairedReplyAuthor, parseAppFrame, parseAtprotoCar, parseAtprotoDidDocument, parseAtprotoDidKey, parseAtprotoVerificationKey, parseCallSignal, parseCashuRequestPayload, parseCommunityEdit, parseDid, parseDidDocument, parseDidJws, parseDidSignaturePaste, parseDomainTxt, parseEditFrame, parseEditedFrame, parseEngineError, parseFedimintRequestPayload, parseGroupMetaBody, parseGroupMetaFrame, parseGroupMetaStatement, parseGroupMetaTag, parseGroupWakeFrame, parseHubPolicy, parseImageMeta, parseInvoiceCallback, parseLightningDestination, parseLinkPreview, parseLinkRecords, parseLocalTarget, parsePacketTransports, parsePairedCallFrame, parsePayParams, parsePaymentAmount, parsePaymentNetworks, parsePinFrame, parsePinnedFrame, parseReactedFrame, parseReactionFrame, parseRelayPayload, parseRtcSignal, parseSessionCapabilities, parseSshPublicKey, parseSshSignature, parseTypingActivity, parseTypingFrame, parseVideoMeta, parseVoiceMeta, parseWakeFrame, paymentUri, peekDhtMailbox, pickCallCandidates, pickHubs, pickMeshHubs, pinFrame, pinIsNewer, pinNumberHolds, pinnedFrame, planAppUpdate, presenceSeenAt, previewImageSize, proofCapability, proofHash, proofStatement, pubkyHomeserverOf, pubkyProofCapability, pubkyProofFile, pubkyProofPath, publicKeyFromZ32, publishFailure, pushRequest, qrText, queueReaction, randomBytes, rankHubs, rankTransports, reactedFrame, reactionEmoji, reactionFrame, reactionIsNewer, readAppBundle, readAppFrame, readAppListing, readAppRevocation, readAppRevocationShape, readAppRevocations, readAppSignature, readAppStore, readAppStoreSteps, readAtprotoCid, readBeacon, readBeaconHead, readCanonicalJson, readDeviceInvite, readDhtFile, readDhtReactions, readDnsName, readEnrollGrant, readEnrollHello, readForwarded, readGroupFileMeta, readGroupHave, readGroupSignal, readGroupWant, readGroupWantNo, readHandoffAck, readHandoffBusy, readHandoffCancel, readHandoffData, readHandoffDone, readHandoffFileFrame, readHandoffHave, readHandoffHello, readHandoffManifest, readHandoffPake, readHandoffRelease, readHandoffTurnFrame, readHandoffVerified, readImageMeta, readInviteCode, readKnocks, readLobby, readManifest, readPin, readReaction, readRelayBody, readReply, readSetUpdate, readStatusCard, readTurnBody, readTurnPacket, readWake, readWakePayload, receivedIdentityStatus, receivedTimestamp, recordingMime, recordsFromTxt, recordsFromWellKnown, recordsName, refusalText, relativizeLocation, relayRequest, relayedTransports, rememberAlone, replySnippet, requestLnurlInvoice, resolveDidDht, resolveLightningDestination, resolveTargetUrl, revokesIdentity, ringAuthorization, ringClaims, ringEvidence, rosterAdmin, rosterHas, rosterHash, safeBlobType, sameButtonText, sameDigest, sameSshKey, sanitizeAvatar, sanitizeDisplayText, sanitizeFileName, sanitizeMime, sanitizeNick, sanitizePreviewImage, sanitizeRequestHeaders, sanitizeResponseHeaders, sanitizeTypingStatus, satsToBtc, sdpHasCandidates, sealGroupTyping, sealHandoffPiece, sealPair, sealSecret, sealTurnBody, sealedLength, seedSigner, sendBody, serviceIdFromName, servicesFromWire, servicesToWire, sessionCapabilitiesFrame, setAckFrame, setLinkTraceSink, setUpdateFrame, setUpdateMessage, sha256Hex, sha256d, shortAtprotoDid, shortHash, shouldBeHub, shownTime, sign, signAppObject, signAppRevocation, signAppStore, signCommit, signCommunity, signDeviceTransports, signDidDhtPacket, signGroupMeta, signIdentityPresentation, signRelayPayload, signTombstone, signTurnBody, signTurnPacket, signTurnRelease, signalHasVideo, signingKeys, sortParts, sortRoster, sparkAddressKind, sparkInvoiceDetails, sparkNetworkOf, sshFingerprint, sshKeyDigestHex, sshSignCommand, staticDidDocument, statusCardBytes, statusCardText, storageProof, storageProofBody, storageProofPath, strictBase64Url, stripHidden, symmetricNat, taskProgress, toBase64, toBase64Url, toZ32, traceLink, transferEnded, transferStalled, transportOrder, trimEndOf, tryDecrypt, turnInstance, turnKeys, turnName, turnPacket, turnPayloadSequence, turnPutSummary, turnReleaseMessage, turnSequence, turnSignedMessage, turnStatedVerifier, turnVerifierMark, txHash, txtValue, typingActivity, typingFrame, typingKindOf, u32, u64, unsignedCommitBytes, unsignedDeviceTransports, usageLeft, utf8Decode, utf8Encode, validDomainRecord, validEditMessage, validEditNumber, validEditText, validExternalKey, validHead, validMentions, validReactionNumber, validRingKey, validatePaymentTarget, vapidAuthorization, vapidKeysMatch, varBytes, verify, verifyAppRevocation, verifyAppSignature, verifyAppStatementBytes, verifyAtprotoRecordProof, verifyAtprotoSignature, verifyBip322, verifyBitcoinMessage, verifyChain, verifyCommit, verifyCommitSignature, verifyCommunityChain, verifyCommunityCommit, verifyDeviceTransports, verifyEnrollProof, verifyGroupMetaSignature, verifyIdentityPresentation, verifyNostrProof, verifyPeerProof, verifyRingAuthorization, verifyRingEvidence, verifySetUpdate, verifySshSignature, viewerResponseHeaders, voiceDownloadName, voiceFileName, voiceLevel, voiceLevelsOf, voicePeaksOf, waitForIceGathering, wakeFrame, wakePayload, wakeRequest, walletNetworkOf, webCryptoSigner, webLocalFetch, wellKnownUrl, wireHubPolicy, wireMentions, wireReaction, wireReply, withRequestOptions, wrapDataChannel, wrapGroupMeta };
|
|
206
|
+
|
|
207
|
+
//# sourceMappingURL=core.js.map
|
package/dist/core.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
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":"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"}
|