@ghostlytools/cli 1.11.4 → 1.12.1
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 +31 -14
- package/dist/assets/{api-MYc6QNRs.js → api-BwEgbvvK.js} +395 -131
- package/dist/assets/api-BwEgbvvK.js.map +1 -0
- package/dist/assets/{api-BwyFq4lA.js → api-jRUXnBdX.js} +2 -2
- package/dist/assets/{apiKit-CfsNx9ZR.js → apiKit-BlsNk-Cx.js} +48 -11
- package/dist/assets/apiKit-BlsNk-Cx.js.map +1 -0
- package/dist/assets/appFetch-CW9fJPHh.js +602 -0
- package/dist/assets/appFetch-CW9fJPHh.js.map +1 -0
- package/dist/assets/apps-BcG4u6SM.js +1 -0
- package/dist/assets/{apps-h12II1us.js → apps-CL8TXHhu.js} +20 -14
- package/dist/assets/apps-CL8TXHhu.js.map +1 -0
- package/dist/assets/{argon2id-088uQfnH.js → argon2id-B9wFdSj6.js} +2 -3
- package/dist/assets/{argon2id-088uQfnH.js.map → argon2id-B9wFdSj6.js.map} +1 -1
- package/dist/assets/{arkade-Bw_4PZRG.js → arkade-DryM-q5n.js} +6 -7
- package/dist/assets/arkade-DryM-q5n.js.map +1 -0
- package/dist/assets/{backup-Chvy79SN.js → backup-BA41EDvh.js} +110 -26
- package/dist/assets/backup-BA41EDvh.js.map +1 -0
- package/dist/assets/backup-xZfV-ytw.js +1 -0
- package/dist/assets/bark_ffi_wasm_bg-CcafsJla.js +5 -0
- package/dist/assets/bark_ffi_wasm_bg-CcafsJla.js.map +1 -0
- package/dist/assets/{bark_ffi_wasm_bg-Bxru_BVW.wasm → bark_ffi_wasm_bg-VNmaJsc9.wasm} +0 -0
- package/dist/assets/{bitcoind-CdSmvy2y.js → bitcoind-Dh7n9amb.js} +4 -5
- package/dist/assets/{bitcoind-CdSmvy2y.js.map → bitcoind-Dh7n9amb.js.map} +1 -1
- package/dist/assets/bitcoindevkit_bg-BWQHx7vd.js +5 -0
- package/dist/assets/bitcoindevkit_bg-BWQHx7vd.js.map +1 -0
- package/dist/assets/bitcoindevkit_bg-DXil67yS.wasm +0 -0
- package/dist/assets/{blobFiles-BmsrvZc3.js → blobFiles-DDs34n0r.js} +4 -5
- package/dist/assets/{blobFiles-BmsrvZc3.js.map → blobFiles-DDs34n0r.js.map} +1 -1
- package/dist/assets/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/dist/assets/buttons-CsGdQNnR.js +1 -0
- package/dist/assets/{buttons-BgoExb4E.js → buttons-SH1tNRh7.js} +45 -23
- package/dist/assets/buttons-SH1tNRh7.js.map +1 -0
- package/dist/assets/bytes-C1DNGY18.js +132 -0
- package/dist/assets/bytes-C1DNGY18.js.map +1 -0
- package/dist/assets/{childEnv-K_IzUqQx.js → childEnv-C-99hdbL.js} +2 -3
- package/dist/assets/{childEnv-K_IzUqQx.js.map → childEnv-C-99hdbL.js.map} +1 -1
- package/dist/assets/{client-DY8tZZWi.js → client-DGS-atRu.js} +5 -8
- package/dist/assets/{client-DY8tZZWi.js.map → client-DGS-atRu.js.map} +1 -1
- package/dist/assets/{codec-BnMg-Grj.js → codec-B2rH1mfx.js} +2 -4
- package/dist/assets/{codec-BnMg-Grj.js.map → codec-B2rH1mfx.js.map} +1 -1
- package/dist/assets/domainProofs-BDNP1dIy.js +280 -0
- package/dist/assets/domainProofs-BDNP1dIy.js.map +1 -0
- package/dist/assets/{endpoint-DarqblYE.js → endpoint-Cvu-taMs.js} +462 -424
- package/dist/assets/endpoint-Cvu-taMs.js.map +1 -0
- package/dist/assets/engineErrors--9hfgKlK.js +150 -0
- package/dist/assets/engineErrors--9hfgKlK.js.map +1 -0
- package/dist/assets/{envelope-CdV7vHVZ.js → envelope-Bi2kMqbp.js} +3 -4
- package/dist/assets/{envelope-CdV7vHVZ.js.map → envelope-Bi2kMqbp.js.map} +1 -1
- package/dist/assets/{errors-CAh6GLJZ.js → errors-DDLFO4Gf.js} +5 -4
- package/dist/assets/errors-DDLFO4Gf.js.map +1 -0
- package/dist/assets/{fedimintSdk-CPFfVK-G.js → fedimintSdk-D-6H9Pe7.js} +4 -5
- package/dist/assets/{fedimintSdk-CPFfVK-G.js.map → fedimintSdk-D-6H9Pe7.js.map} +1 -1
- package/dist/assets/fedimint_client_wasm_bg-Cr5xGD-w.js +5 -0
- package/dist/assets/{fedimint_client_wasm_bg-BtHHlFpp.js.map → fedimint_client_wasm_bg-Cr5xGD-w.js.map} +1 -1
- package/dist/assets/fileBytes-CCKbwqG_.js +1 -0
- package/dist/assets/{fileBytes-BLPZq9YU.js → fileBytes-CfvUXdSy.js} +5 -7
- package/dist/assets/fileBytes-CfvUXdSy.js.map +1 -0
- package/dist/assets/{fileBytes-B0z9A6Le.js → fileBytes-tj6-VZcB.js} +3 -4
- package/dist/assets/{fileBytes-B0z9A6Le.js.map → fileBytes-tj6-VZcB.js.map} +1 -1
- package/dist/assets/fileBytesIdb-B0zzJ6p7.js +1 -0
- package/dist/assets/{fileBytesIdb-Bmlrl9EO.js → fileBytesIdb-BJirUAjI.js} +4 -5
- package/dist/assets/{fileBytesIdb-Bmlrl9EO.js.map → fileBytesIdb-BJirUAjI.js.map} +1 -1
- package/dist/assets/{fileBytesOpfs-DBS0kbPT.js → fileBytesOpfs-DRUYLER4.js} +4 -5
- package/dist/assets/{fileBytesOpfs-DBS0kbPT.js.map → fileBytesOpfs-DRUYLER4.js.map} +1 -1
- package/dist/assets/{fixedHosts-CbgqrIKs.js → fixedHosts-CPSsGOI2.js} +4 -5
- package/dist/assets/{fixedHosts-CbgqrIKs.js.map → fixedHosts-CPSsGOI2.js.map} +1 -1
- package/dist/assets/{ghostly_iroh_web-BzAXJUYH.js → ghostly_iroh_web-DIj5xGmR.js} +2 -3
- package/dist/assets/{ghostly_iroh_web-BzAXJUYH.js.map → ghostly_iroh_web-DIj5xGmR.js.map} +1 -1
- package/dist/assets/{src-DJe-OYxd.js → groupMeta-DxuJzko_.js} +6009 -25536
- package/dist/assets/groupMeta-DxuJzko_.js.map +1 -0
- package/dist/assets/{host-C0NMNQLl.js → host-BxM-HMr0.js} +262 -134
- package/dist/assets/host-BxM-HMr0.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-Dz7pvcBA.js → hyperdhtRelay-DLUiwfnt.js} +36 -9
- package/dist/assets/hyperdhtRelay-DLUiwfnt.js.map +1 -0
- package/dist/assets/hyperdhtRelay-bjNGacf5.js +32 -0
- package/dist/assets/hyperdhtRelay-bjNGacf5.js.map +1 -0
- package/dist/assets/{idb-CEuoNsTv.js → idb-ewvbqyDI.js} +2 -3
- package/dist/assets/{idb-CEuoNsTv.js.map → idb-ewvbqyDI.js.map} +1 -1
- package/dist/assets/identityProofs-Cksc_K7_.js +940 -0
- package/dist/assets/identityProofs-Cksc_K7_.js.map +1 -0
- package/dist/assets/{irohWeb-caAj4Dms.js → irohWeb-CbnGtUo6.js} +3231 -87
- package/dist/assets/irohWeb-CbnGtUo6.js.map +1 -0
- package/dist/assets/joinTrace-CBr1jbch.js +1 -0
- package/dist/assets/{joinTrace-CjRDFy85.js → joinTrace-xKBe73j9.js} +2 -3
- package/dist/assets/{joinTrace-CjRDFy85.js.map → joinTrace-xKBe73j9.js.map} +1 -1
- package/dist/assets/{legacy_ciphers-JJOu0JXL.js → legacy_ciphers-BnYATjxo.js} +2 -3
- package/dist/assets/{legacy_ciphers-JJOu0JXL.js.map → legacy_ciphers-BnYATjxo.js.map} +1 -1
- package/dist/assets/linkPreview-DdMf-YAc.js +252 -0
- package/dist/assets/linkPreview-DdMf-YAc.js.map +1 -0
- package/dist/assets/{main-C6t5zrD5.js → main-CwTaepxR.js} +296 -122
- package/dist/assets/main-CwTaepxR.js.map +1 -0
- package/dist/assets/{mainline-DCuGUSZF.js → mainline-CVrd0C1n.js} +72 -18
- package/dist/assets/mainline-CVrd0C1n.js.map +1 -0
- package/dist/assets/mints-BcBODVVW.js +1 -0
- package/dist/assets/{mints-j5XAOk4f.js → mints-CMDLbMeH.js} +8 -6
- package/dist/assets/mints-CMDLbMeH.js.map +1 -0
- package/dist/assets/{nacl-fast-CDhNCYHs.js → nacl-fast-B1ThWvuM.js} +2 -3
- package/dist/assets/{nacl-fast-CDhNCYHs.js.map → nacl-fast-B1ThWvuM.js.map} +1 -1
- package/dist/assets/{networkReason-BbQW1Xpc.js → networkReason-Be-hMghr.js} +10 -14
- package/dist/assets/{networkReason-BbQW1Xpc.js.map → networkReason-Be-hMghr.js.map} +1 -1
- package/dist/assets/{noble_curves-DDWn5AH0.js → noble_curves-DqpNlhAU.js} +3 -4
- package/dist/assets/{noble_curves-DDWn5AH0.js.map → noble_curves-DqpNlhAU.js.map} +1 -1
- package/dist/assets/{noble_hashes-B7AZyFyS.js → noble_hashes-LFe1N2xt.js} +3 -4
- package/dist/assets/{noble_hashes-B7AZyFyS.js.map → noble_hashes-LFe1N2xt.js.map} +1 -1
- package/dist/assets/{nwc-CSDRMZ0e.js → nwc-DKE2FXr6.js} +5 -6
- package/dist/assets/{nwc-CSDRMZ0e.js.map → nwc-DKE2FXr6.js.map} +1 -1
- package/dist/assets/nwcProvider-pL2XqSbW.js +208 -0
- package/dist/assets/nwcProvider-pL2XqSbW.js.map +1 -0
- package/dist/assets/{openpgp-BBFr-zHQ.js → openpgp-LkR_Zof0.js} +14 -15
- package/dist/assets/{openpgp-BBFr-zHQ.js.map → openpgp-LkR_Zof0.js.map} +1 -1
- package/dist/assets/ownDid-DY3rYqDI.js +862 -0
- package/dist/assets/ownDid-DY3rYqDI.js.map +1 -0
- package/dist/assets/{ownStatus-BoTf5WqQ.js → ownStatus-DtzIllg2.js} +70 -20
- package/dist/assets/ownStatus-DtzIllg2.js.map +1 -0
- package/dist/assets/pairedTransports-BKmvlKz1.js +581 -0
- package/dist/assets/pairedTransports-BKmvlKz1.js.map +1 -0
- package/dist/assets/paymentIntent-DySU3Ajm.js +349 -0
- package/dist/assets/paymentIntent-DySU3Ajm.js.map +1 -0
- package/dist/assets/pkarr-BQo4PcCg.js +367 -0
- package/dist/assets/pkarr-BQo4PcCg.js.map +1 -0
- package/dist/assets/{profiles-DszHjEJi.js → profiles-BOYGlmu2.js} +9 -10
- package/dist/assets/profiles-BOYGlmu2.js.map +1 -0
- package/dist/assets/registry-4W1LGlCF.js +1 -0
- package/dist/assets/{registry-Da-r6eC3.js → registry-Bep4umOM.js} +1296 -80
- package/dist/assets/registry-Bep4umOM.js.map +1 -0
- package/dist/assets/relay-Cjfmdec0.js +2219 -0
- package/dist/assets/relay-Cjfmdec0.js.map +1 -0
- package/dist/assets/resolve-CIc3KZMV.js +970 -0
- package/dist/assets/resolve-CIc3KZMV.js.map +1 -0
- package/dist/assets/{restoredRows-C3LcxmOw.js → restoredRows-D_WSHE7H.js} +3 -4
- package/dist/assets/{restoredRows-C3LcxmOw.js.map → restoredRows-D_WSHE7H.js.map} +1 -1
- package/dist/assets/secretGuard-Bm6nci0I.js +1 -0
- package/dist/assets/{secretGuard-CsVHDdYk.js → secretGuard-BrATm_gl.js} +43 -22
- package/dist/assets/{secretGuard-CsVHDdYk.js.map → secretGuard-BrATm_gl.js.map} +1 -1
- package/dist/assets/{server-C1jZZ61O.js → server-D4gf-LnD.js} +9797 -479
- package/dist/assets/server-D4gf-LnD.js.map +1 -0
- package/dist/assets/{sha512-BYId-G-T.js → sha512-DST9fbWH.js} +2 -3
- package/dist/assets/{sha512-BYId-G-T.js.map → sha512-DST9fbWH.js.map} +1 -1
- package/dist/assets/sshForges-BnvwmNj-.js +539 -0
- package/dist/assets/sshForges-BnvwmNj-.js.map +1 -0
- package/dist/assets/{storage-Bya5b2Xt.js → storage-BpjdxvO2.js} +243 -34
- package/dist/assets/storage-BpjdxvO2.js.map +1 -0
- package/dist/assets/text-li76pThX.js +106 -0
- package/dist/assets/text-li76pThX.js.map +1 -0
- package/dist/assets/{translate-CUuC5szR.js → translate-BcbSWkuq.js} +21 -26
- package/dist/assets/{translate-CUuC5szR.js.map → translate-BcbSWkuq.js.map} +1 -1
- package/dist/assets/{tree-store-N362nuzZ.js → tree-store-CAchkO_l.js} +22 -6
- package/dist/assets/tree-store-CAchkO_l.js.map +1 -0
- package/dist/assets/{types-Clyb52K2.js → types-CdWwgvyt.js} +2 -3
- package/dist/assets/{types-Clyb52K2.js.map → types-CdWwgvyt.js.map} +1 -1
- package/dist/assets/{unbzip2-stream-B1C-JX9L.js → unbzip2-stream-BtkYGpC5.js} +2 -3
- package/dist/assets/{unbzip2-stream-B1C-JX9L.js.map → unbzip2-stream-BtkYGpC5.js.map} +1 -1
- package/dist/assets/{usdt-DI51znt-.js → usdt-CBJ4Q5Ji.js} +7 -7
- package/dist/assets/usdt-CBJ4Q5Ji.js.map +1 -0
- package/dist/assets/{waitNotice-Cn0WJ-He.js → waitNotice-DQvZgz2T.js} +27 -4
- package/dist/assets/waitNotice-DQvZgz2T.js.map +1 -0
- package/dist/assets/{web-DwgdhfcY.js → web-68CYFCl9.js} +314 -91
- package/dist/assets/web-68CYFCl9.js.map +1 -0
- package/dist/ghostly.mjs +3 -5
- package/dist/ghostly.mjs.map +1 -1
- package/npm-shrinkwrap.json +225 -200
- package/package.json +16 -16
- package/dist/assets/api-MYc6QNRs.js.map +0 -1
- package/dist/assets/apiKit-CfsNx9ZR.js.map +0 -1
- package/dist/assets/appFetch-DVYZOZFw.js +0 -194
- package/dist/assets/appFetch-DVYZOZFw.js.map +0 -1
- package/dist/assets/apps-Dbw2Hcko.js +0 -2
- package/dist/assets/apps-h12II1us.js.map +0 -1
- package/dist/assets/arkade-Bw_4PZRG.js.map +0 -1
- package/dist/assets/backup-CdEzTq5C.js +0 -2
- package/dist/assets/backup-Chvy79SN.js.map +0 -1
- package/dist/assets/bark_ffi_wasm_bg-EY2uc0Bx.js +0 -6
- package/dist/assets/bark_ffi_wasm_bg-EY2uc0Bx.js.map +0 -1
- package/dist/assets/bitcoindProvider-BvoRh0D5.js +0 -97
- package/dist/assets/bitcoindProvider-BvoRh0D5.js.map +0 -1
- package/dist/assets/bitcoindevkit_bg-B-iLWrmX.js +0 -6
- package/dist/assets/bitcoindevkit_bg-B-iLWrmX.js.map +0 -1
- package/dist/assets/bitcoindevkit_bg-CRkZTSbO.wasm +0 -0
- package/dist/assets/buttons-BgoExb4E.js.map +0 -1
- package/dist/assets/buttons-DK2aAGat.js +0 -2
- package/dist/assets/endpoint-DarqblYE.js.map +0 -1
- package/dist/assets/errors-CAh6GLJZ.js.map +0 -1
- package/dist/assets/fedimint_client_wasm_bg-BtHHlFpp.js +0 -6
- package/dist/assets/fileBytes-BLPZq9YU.js.map +0 -1
- package/dist/assets/fileBytes-BtIyoDF2.js +0 -2
- package/dist/assets/fileBytesIdb-D8mAK4pF.js +0 -2
- package/dist/assets/host-C0NMNQLl.js.map +0 -1
- package/dist/assets/hyperdhtRelay-1wzya_0L.js +0 -25
- package/dist/assets/hyperdhtRelay-1wzya_0L.js.map +0 -1
- package/dist/assets/hyperdhtRelay-Dz7pvcBA.js.map +0 -1
- package/dist/assets/irohWeb-caAj4Dms.js.map +0 -1
- package/dist/assets/joinTrace-D-fnt2p3.js +0 -2
- package/dist/assets/jsonOut-POtMBS_V.js +0 -16
- package/dist/assets/jsonOut-POtMBS_V.js.map +0 -1
- package/dist/assets/main-C6t5zrD5.js.map +0 -1
- package/dist/assets/mainline-DCuGUSZF.js.map +0 -1
- package/dist/assets/mints-BaOmx517.js +0 -2
- package/dist/assets/mints-j5XAOk4f.js.map +0 -1
- package/dist/assets/nwcProvider-PE0wli8n.js +0 -88
- package/dist/assets/nwcProvider-PE0wli8n.js.map +0 -1
- package/dist/assets/ownDid-C1R5Kd8q.js +0 -282
- package/dist/assets/ownDid-C1R5Kd8q.js.map +0 -1
- package/dist/assets/ownStatus-BoTf5WqQ.js.map +0 -1
- package/dist/assets/profiles-DszHjEJi.js.map +0 -1
- package/dist/assets/registry-Da-r6eC3.js.map +0 -1
- package/dist/assets/registry-zUZBSHYv.js +0 -2
- package/dist/assets/resolve-tUzh4lHh.js +0 -400
- package/dist/assets/resolve-tUzh4lHh.js.map +0 -1
- package/dist/assets/secretGuard-DCb1I0_B.js +0 -2
- package/dist/assets/server-C1jZZ61O.js.map +0 -1
- package/dist/assets/src-DJe-OYxd.js.map +0 -1
- package/dist/assets/sshForges-C9zTO72R.js +0 -261
- package/dist/assets/sshForges-C9zTO72R.js.map +0 -1
- package/dist/assets/storage-Bya5b2Xt.js.map +0 -1
- package/dist/assets/tree-store-N362nuzZ.js.map +0 -1
- package/dist/assets/usdt-DI51znt-.js.map +0 -1
- package/dist/assets/waitNotice-Cn0WJ-He.js.map +0 -1
- package/dist/assets/web-DwgdhfcY.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identityProofs-Cksc_K7_.js","names":[],"sources":["../../../core/src/identityTimeline.ts","../../../core/src/identityProofs.ts"],"sourcesContent":["/**\n * What a chat's timeline shows of the identity-proof exchange (WISP 300, \"In the conversation\"): one entry when\n * an identity is shared, on both sides, turning verified or failed as the exchange settles, and one when it stops\n * (withdrawn by its owner, or found revoked). Local only: made from the exchange's own steps, stored with the\n * chat's identity ledger, never sent. Nothing new goes on the wire.\n */\n\n/** \"mine\": this side shared it. \"theirs\": the contact did. */\nexport type IdentityTimelineSide = \"mine\" | \"theirs\";\nexport type IdentityTimelineState = \"verifying\" | \"verified\" | \"failed\";\n\nexport interface IdentityTimelineEntry {\n /**\n * Unique in the chat: side, proof and one past the highest number that proof's kept entries on that side have. A\n * contact's later attempt that took the entry over keeps it (see applyIdentityEvent).\n */\n id: string;\n /** The proof's id (identityStatement().id). */\n proof: string;\n side: IdentityTimelineSide;\n kind: \"shared\" | \"stopped\";\n provider: string;\n /** The identity, once known: at once on the sharer's side, from the presentation on the contact's. */\n subject?: string;\n /** A share only: where the contact's check stands. */\n state?: IdentityTimelineState;\n /** A failed share: why, as the verifier said it. */\n error?: string;\n /** A stop only: its owner withdrew it here, or its proof key published a revocation. */\n reason?: \"withdrawn\" | \"revoked\";\n /** Milliseconds. When it happened; later steps of the same share leave it in place. */\n at: number;\n}\n\n/** One step of the exchange, as the timeline needs it. */\nexport type IdentityTimelineEvent =\n /** A share began: this side shared, or the contact asked for a challenge. `requested`: the id the request named. */\n | { type: \"shared\"; side: IdentityTimelineSide; proof: string; provider: string; subject?: string }\n /** The contact's check settled. `requested`: the id the request named, when the presented proof is another. */\n | { type: \"result\"; side: IdentityTimelineSide; proof: string; requested?: string; provider?: string; subject?: string; ok: boolean; error?: string }\n | { type: \"stopped\"; side: IdentityTimelineSide; proof: string; provider: string; subject?: string; reason: \"withdrawn\" | \"revoked\" }\n /** A share taken back before it ever left this side (queued, the contact never heard of it): its entry goes. */\n | { type: \"unsent\"; side: \"mine\"; proof: string }\n /** The contact asked for a challenge and presented nothing within its window: its entry goes, as `unsent` does. */\n | { type: \"unanswered\"; side: \"theirs\"; proof: string };\n\n/** Entries a chat keeps, newest last. */\nexport const IDENTITY_TIMELINE_MAX = 100;\n\nconst lastOf = (timeline: readonly IdentityTimelineEntry[], side: IdentityTimelineSide, proofs: readonly (string | undefined)[]) => {\n for (let i = timeline.length - 1; i >= 0; i--) if (timeline[i].side === side && proofs.includes(timeline[i].proof)) return i;\n return -1;\n};\n\n/** The contact's share of this kind still not verified (checking, or failed): the one its next attempt takes over. */\nconst unverifiedOf = (timeline: readonly IdentityTimelineEntry[], provider: string | undefined) => {\n for (let i = timeline.length - 1; i >= 0; i--) {\n const e = timeline[i];\n if (e.side === \"theirs\" && e.kind === \"shared\" && e.state !== \"verified\" && e.provider === provider) return i;\n }\n return -1;\n};\n\n/**\n * The timeline after one step. A share already on it is updated in place, never repeated: a request sent again at\n * a reconnect, a second share of a proof the contact already verified. A new attempt after a failure or a stop is\n * a new entry, except the contact's own not verified: those keep one entry per kind, which its next attempt takes\n * over in place (its id and time stay, so no new sound and the chat does not move). The ids and the kind are the\n * contact's to choose, so otherwise its requests alone could push every other entry, this side's too, out of the\n * bound. A stop is written once; a withdrawal later found revoked becomes a revocation in place.\n */\nexport function applyIdentityEvent(timeline: readonly IdentityTimelineEntry[], event: IdentityTimelineEvent, at: number): IdentityTimelineEntry[] {\n const out = [...timeline];\n const i = lastOf(out, event.side, event.type === \"result\" ? [event.proof, event.requested] : [event.proof]);\n const last = i >= 0 ? out[i] : undefined;\n /** Puts the contact's attempt on the entry of its kind still not verified, if there is one. */\n const takeOver = (entry: Omit<IdentityTimelineEntry, \"id\" | \"at\" | \"side\" | \"kind\">) => {\n const j = event.side === \"theirs\" ? unverifiedOf(out, entry.provider) : -1;\n if (j < 0) return false;\n out[j] = { id: out[j].id, proof: entry.proof, side: \"theirs\", kind: \"shared\", provider: entry.provider, ...(entry.subject ? { subject: entry.subject } : {}),\n state: entry.state, ...(entry.error ? { error: entry.error } : {}), at: out[j].at };\n return true;\n };\n const add = (entry: Omit<IdentityTimelineEntry, \"id\" | \"at\">) => {\n // One past the highest number kept, not the count: the bound may have cut this proof's earlier entries.\n const prefix = `${entry.side}:${entry.proof}:`;\n let n = 0;\n for (const e of out) if (e.id.startsWith(prefix)) n = Math.max(n, Number(e.id.slice(prefix.length)) + 1 || 0);\n out.push({ ...entry, id: `${prefix}${n}`, at });\n };\n switch (event.type) {\n case \"shared\":\n if (last?.kind === \"shared\" && last.state !== \"failed\") {\n out[i] = { ...last, provider: event.provider, subject: event.subject ?? last.subject };\n break;\n }\n if (takeOver({ proof: event.proof, provider: event.provider, subject: event.subject, state: \"verifying\" })) break;\n add({ proof: event.proof, side: event.side, kind: \"shared\", provider: event.provider, ...(event.subject ? { subject: event.subject } : {}), state: \"verifying\" });\n break;\n case \"result\": {\n const settled = { state: event.ok ? \"verified\" as const : \"failed\" as const, ...(event.ok || !event.error ? {} : { error: event.error }) };\n if (last?.kind === \"shared\") {\n const { error: _, ...rest } = last;\n out[i] = { ...rest, proof: event.proof, provider: event.provider ?? last.provider, subject: event.subject ?? last.subject, ...settled };\n break;\n }\n // Its start is no longer kept (the timeline is bounded, or a later attempt took it over): the outcome stands\n // alone, a failed one on the contact's entry of its kind still not verified.\n if (!event.ok && event.provider && takeOver({ proof: event.proof, provider: event.provider, subject: event.subject, ...settled })) break;\n if (event.provider) add({ proof: event.proof, side: event.side, kind: \"shared\", provider: event.provider, ...(event.subject ? { subject: event.subject } : {}), ...settled });\n break;\n }\n case \"stopped\":\n // A revocation found after the withdrawal (a removal is both, WISP 300) says what the stop was: the same entry.\n if (last?.kind === \"stopped\") { if (last.reason === \"withdrawn\" && event.reason === \"revoked\") out[i] = { ...last, reason: \"revoked\" }; break; }\n add({ proof: event.proof, side: event.side, kind: \"stopped\", provider: event.provider, subject: event.subject ?? last?.subject, reason: event.reason });\n break;\n case \"unsent\":\n case \"unanswered\":\n if (last?.kind === \"shared\" && last.state === \"verifying\") out.splice(i, 1);\n break;\n }\n return out.length > IDENTITY_TIMELINE_MAX ? out.slice(-IDENTITY_TIMELINE_MAX) : out;\n}\n\n/** When the contact last shared an identity here (milliseconds), for the chat list: 0 when never. */\nexport function lastSharedWithMe(timeline: readonly IdentityTimelineEntry[] | undefined): number {\n let at = 0;\n for (const e of timeline ?? []) if (e.side === \"theirs\" && e.kind === \"shared\" && e.at > at) at = e.at;\n return at;\n}\n","import { sha256 } from \"@noble/hashes/sha2.js\";\nimport { fromBase64Url, isZ32Key, randomBytes, toBase64Url, utf8Encode } from \"./bytes\";\nimport { identityFromSeed, publicKeyFromZ32, sign, verify } from \"./identity\";\nimport { applyIdentityEvent, type IdentityTimelineEntry, type IdentityTimelineEvent } from \"./identityTimeline\";\nimport { hasVisible, stripHidden } from \"./text\";\n\n/**\n * Identity proofs (WISP 300), provider-agnostic half.\n *\n * A proof is made once per profile: the external identity (a Nostr key, a domain, an SSH key, an\n * OpenID Connect account…) signs or attests the canonical **statement** below, which authorizes a\n * fresh Ed25519 **proof key** that only this profile holds. Sharing it with a contact is then a\n * challenge-response on that contact's authenticated paired channel: the contact sends a fresh nonce,\n * the proof key signs a **presentation** binding the proof to both participation keys, the\n * conversation, the session and that nonce. A copy replayed to anyone else fails: wrong audience,\n * unknown nonce, and nobody else has the proof key.\n *\n * Providers (browser side, `packages/browser/src/proofs/`) only know how to produce and check the\n * evidence over the statement bytes; everything here is shared, so every provider signs the same bytes.\n */\n\nexport const IDENTITY_PROOF_CAPABILITY = \"identity-proof/1\";\n/** Domain separation: the first words of every statement. */\nexport const IDENTITY_STATEMENT_PREFIX = \"Ghostly identity proof v1\";\n/** No binding is valid for longer than this, whatever the provider allows. */\nexport const IDENTITY_MAX_VALIDITY = 400 * 86_400;\n/** A binding issued this far in the future is refused (seconds of clock disagreement tolerated). */\nexport const IDENTITY_CLOCK_SKEW = 300;\n/** A contact's challenge must be answered within this many seconds. */\nexport const IDENTITY_CHALLENGE_WINDOW = 300;\n/** Evidence, serialized as JSON, is at most this many characters. */\nexport const IDENTITY_MAX_EVIDENCE = 16 * 1024;\n/** A whole `idp-*` frame, serialized. */\nexport const IDENTITY_MAX_FRAME = 32 * 1024;\n/** Unanswered challenges a verifier keeps per conversation. */\nconst MAX_CHALLENGES = 8;\n/** A challenge still open at `now` (seconds): a presentation for it is still taken. */\nconst liveAt = (c: { issuedAt: number }, now: number) => c.issuedAt > now - IDENTITY_CHALLENGE_WINDOW;\n/**\n * Proofs a verifier keeps from one contact. A newer proof of the same identity replaces the older one, and one no longer\n * standing (withdrawn, revoked, expired) gives its place to a new one; past that a presentation is refused before it is\n * checked, so a contact cannot make this side store, re-send to its pages and look up its proofs without end.\n */\nexport const IDENTITY_MAX_RECEIVED = 16;\n/** `idp-*` frames a paired session reads from the contact per `IDENTITY_FRAME_WINDOW_MS`; the rest are dropped unread. */\nexport const IDENTITY_FRAME_LIMIT = 40;\nexport const IDENTITY_FRAME_WINDOW_MS = 60_000;\n/**\n * A proof this side holds verified, presented again with the same evidence between the same keys, is answered from that\n * check while it is younger than this (seconds): the contact chooses how often it presents, and each check costs this\n * device a provider lookup (a forge's per-IP quota, a DNS query, a contact's server) and a Pkarr read. An hour keeps an\n * answer as fresh as a re-share can expect; past it, and between, the daily re-check (or Check again) asks the provider.\n */\nexport const IDENTITY_REUSE_CHECK_S = 3600;\n/**\n * Presentations a verifier checks with their provider per contact in an hour; past it the contact is told the check\n * could not run. Room for every proof it may keep (`IDENTITY_MAX_RECEIVED`) and a few retries: a contact making fresh\n * proofs cannot spend a forge's per-IP quota (GitHub: 60 an hour) for every chat and app on this network.\n */\nexport const IDENTITY_MAX_CHECKS_PER_HOUR = 20;\n\nexport const IDENTITY_PROVIDER_ID = /^[a-z][a-z0-9-]{0,31}$/;\n/** Printable ASCII without spaces, so the statement can be built but never needs parsing. */\nexport const IDENTITY_SUBJECT = /^[\\x21-\\x7e]{1,512}$/;\nconst BINDING_NONCE = /^[A-Za-z0-9_-]{22}$/;\nconst CHALLENGE_NONCE = /^[A-Za-z0-9_-]{43}$/;\nconst HEX64 = /^[a-f0-9]{64}$/;\nconst SIG = /^[A-Za-z0-9_-]{86}$/;\n\n/** What the external identity signs, as fields. `key` is the proof key (z-base-32 Ed25519). */\nexport interface IdentityBinding {\n v: 1;\n provider: string;\n subject: string;\n key: string;\n issuedAt: number;\n expiresAt: number;\n nonce: string;\n}\n\n/** A binding with its exact bytes. Providers sign `text` (UTF-8 `bytes`) and never rebuild it. */\nexport interface IdentityStatement {\n binding: IdentityBinding;\n text: string;\n bytes: Uint8Array;\n /** SHA-256 of `bytes`, lowercase hex: the proof's id everywhere (storage, frames, OIDC nonce input). */\n id: string;\n}\n\n/** What a provider's `verify` established. Stored by the verifier with the evidence. */\nexport interface VerifiedIdentity {\n /** The identity that was proven, canonical. Self-custodied providers: exactly `binding.subject`. */\n subject: string;\n /** How it was checked, for people: \"Nostr signature (BIP-340)\", \"ID token signed by accounts.google.com\". */\n source: string;\n /** Provider-attested only: who vouches for `subject` (an issuer host). */\n attester?: string;\n /** Earlier than the binding's own expiry when the evidence says so (a key or certificate expiring). */\n expiresAt?: number;\n /** Optional name/picture carried by the evidence itself, with where it came from. */\n display?: IdentityDisplay;\n}\n\nexport interface IdentityDisplay {\n name?: string;\n /** A sanitized `data:image/…` URL, never a remote one. */\n avatar?: string;\n /** Where the person can see the identity (a profile page), https only. */\n url?: string;\n /** Where name/picture came from: \"Nostr kind-0 metadata (self-described)\". */\n source: string;\n fetchedAt: number;\n}\n\nexport interface IdentityScope { subject: string; audience: string; context: string; session: string }\n\n/**\n * Early revocation: the proof key publishes, under its own Pkarr key, a TXT record naming the proof it\n * revokes. Anyone holding a copy can look it up by the key in the binding; nothing else is published,\n * and the key is random, so the record says nothing about the identity or its contacts.\n */\nexport const IDENTITY_REVOCATION_LABEL = \"_ghostly-revoked\";\nexport const identityRevocationValue = (id: string, at: number) => `v=1;id=${id};at=${at}`;\n/** True when these records (resolved and signature-checked under the proof key) revoke proof `id`. */\nexport function revokesIdentity(records: { label: string; value: string }[], id: string): boolean {\n return records.some(r => r.label === IDENTITY_REVOCATION_LABEL && new RegExp(`^v=1;id=${id};at=\\\\d{1,12}$`).test(r.value));\n}\n\nconst nowSeconds = () => Math.floor(Date.now() / 1000);\nconst hex = (bytes: Uint8Array) => Array.from(bytes, b => b.toString(16).padStart(2, \"0\")).join(\"\");\nconst iso = (seconds: number) => new Date(seconds * 1000).toISOString().replace(/\\.\\d{3}Z$/, \"Z\");\nconst isInt = (v: unknown): v is number => Number.isSafeInteger(v) && (v as number) > 0;\n\nexport function isIdentityBinding(value: unknown): value is IdentityBinding {\n const b = value as IdentityBinding;\n return !!b && typeof b === \"object\" && !Array.isArray(b) &&\n Object.keys(b).sort().join(\",\") === \"expiresAt,issuedAt,key,nonce,provider,subject,v\" && b.v === 1 &&\n typeof b.provider === \"string\" && IDENTITY_PROVIDER_ID.test(b.provider) &&\n typeof b.subject === \"string\" && IDENTITY_SUBJECT.test(b.subject) &&\n isZ32Key(b.key) && typeof b.nonce === \"string\" && BINDING_NONCE.test(b.nonce) &&\n isInt(b.issuedAt) && isInt(b.expiresAt) && b.expiresAt > b.issuedAt && b.expiresAt - b.issuedAt <= IDENTITY_MAX_VALIDITY &&\n // ISO dates in the text need years 1970–9999.\n b.expiresAt < 253_402_300_800;\n}\n\n/**\n * The canonical statement, one line, so it survives every tool and clipboard (no line-ending\n * ambiguity). Every field is space-free and the order is fixed, so the text is injective.\n */\nexport function identityStatementText(b: IdentityBinding): string {\n if (!isIdentityBinding(b)) throw new Error(\"Invalid identity binding\");\n return `${IDENTITY_STATEMENT_PREFIX}: I control ${b.provider}:${b.subject} and authorize the Ghostly key ${b.key} ` +\n `to present it to contacts I choose, from ${iso(b.issuedAt)} until ${iso(b.expiresAt)}. Nonce: ${b.nonce}`;\n}\n\nexport function identityStatement(binding: IdentityBinding): IdentityStatement {\n const text = identityStatementText(binding);\n const bytes = utf8Encode(text);\n return { binding: { ...binding }, text, bytes, id: hex(sha256(bytes)) };\n}\n\n/** A new binding and the seed of its proof key. The seed stays in this profile; never share it. */\nexport function newIdentityBinding(options: { provider: string; subject: string; validitySeconds: number; now?: number }): { binding: IdentityBinding; seed: Uint8Array } {\n const issuedAt = options.now ?? nowSeconds();\n const seed = randomBytes(32);\n const binding: IdentityBinding = { v: 1, provider: options.provider, subject: options.subject,\n key: identityFromSeed(seed).pubKeyZ32, issuedAt, expiresAt: issuedAt + options.validitySeconds, nonce: toBase64Url(randomBytes(16)) };\n if (!isIdentityBinding(binding)) { seed.fill(0); throw new Error(\"Invalid identity provider, subject or validity\"); }\n return { binding, seed };\n}\n\n/** Bytes the proof key signs for one contact. `scope` is the presenter's view (subject = presenter). */\nexport function identityPresentationBytes(proofId: string, scope: IdentityScope, nonce: string, issuedAt: number): Uint8Array {\n return utf8Encode(JSON.stringify([\"ghostly-identity-presentation\", 1, proofId, scope.subject, scope.audience, scope.context, scope.session, nonce, issuedAt]));\n}\n\nexport function signIdentityPresentation(seed: Uint8Array, proofId: string, scope: IdentityScope, nonce: string, issuedAt: number): string {\n return toBase64Url(sign(identityPresentationBytes(proofId, scope, nonce, issuedAt), seed));\n}\n\nexport function verifyIdentityPresentation(key: string, sig: string, proofId: string, scope: IdentityScope, nonce: string, issuedAt: number): boolean {\n if (typeof sig !== \"string\" || !SIG.test(sig) || !isZ32Key(key)) return false;\n return verify(fromBase64Url(sig), identityPresentationBytes(proofId, scope, nonce, issuedAt), publicKeyFromZ32(key));\n}\n\nconst clean = (value: unknown, max: number): string | undefined => {\n if (typeof value !== \"string\") return undefined;\n // One line of plain text, as a nickname: no control, format, bidi or line-separator character from peer-supplied text.\n const text = stripHidden(value).trim();\n return text && hasVisible(text) ? text.slice(0, max) : undefined;\n};\n\n/**\n * Room for a line that names a domain (up to 253 characters) once or twice: a How line or a reason cut inside the name\n * names a record that does not exist, and the app no longer knows the reason to say it in the person's language.\n */\nconst SOURCE_MAX = 640;\nconst ERROR_MAX = 512;\n\n/** Bounds a provider's result so a buggy provider cannot store or show arbitrary data. */\nexport function boundVerifiedIdentity(v: VerifiedIdentity): VerifiedIdentity {\n if (!v || typeof v.subject !== \"string\" || !IDENTITY_SUBJECT.test(v.subject)) throw new Error(\"Provider returned an invalid subject\");\n const source = clean(v.source, SOURCE_MAX);\n if (!source) throw new Error(\"Provider did not say how it verified\");\n const out: VerifiedIdentity = { subject: v.subject, source };\n const attester = clean(v.attester, 253);\n if (attester) out.attester = attester;\n if (v.expiresAt !== undefined) { if (!isInt(v.expiresAt)) throw new Error(\"Provider returned an invalid expiry\"); out.expiresAt = v.expiresAt; }\n if (v.display) out.display = boundIdentityDisplay(v.display);\n return out;\n}\n\n/** Bounds a provider's public name/picture (from a proof or `lookupDisplay`): a name with nothing visible left is dropped. */\nexport function boundIdentityDisplay(d: IdentityDisplay): IdentityDisplay {\n const display: IdentityDisplay = { source: clean(d.source, 120) ?? \"Self-described\", fetchedAt: isInt(d.fetchedAt) ? d.fetchedAt : nowSeconds() };\n const name = clean(d.name, 64);\n if (name) display.name = name;\n if (typeof d.avatar === \"string\" && d.avatar.length <= 48 * 1024 && /^data:image\\/(png|jpeg);base64,[A-Za-z0-9+/=]+$/.test(d.avatar)) display.avatar = d.avatar;\n if (typeof d.url === \"string\" && d.url.length <= 512) { try { const u = new URL(d.url); if (u.protocol === \"https:\" && !u.username && !u.password) display.url = u.href; } catch { /* dropped */ } }\n return display;\n}\n\n// ---------------------------------------------------------------------------------------------\n// Per-conversation exchange\n\n/** Sharer side, one per proof shared in this conversation. */\nexport interface SharedIdentity {\n id: string;\n provider: string;\n subject: string;\n /**\n * The identity the contact keeps it under (the provider's verified subject: an OIDC binding names the issuer, its\n * account is the issuer and `sub`). Absent in older ledgers.\n */\n account?: string;\n /** queued: the person chose to share, the contact is not connected yet. */\n status: \"queued\" | \"pending\" | \"accepted\" | \"rejected\" | \"withdrawal-pending\" | \"withdrawn\";\n /** Seconds. When the status last changed. */\n at: number;\n error?: string;\n}\n\n/** Verifier side: a contact's proof as this app checked it. */\nexport interface ReceivedIdentity {\n id: string;\n binding: IdentityBinding;\n evidence: unknown;\n verified: VerifiedIdentity;\n /** The participation keys it was presented between (presenter, then this side). */\n presenter: string;\n audience: string;\n context: string;\n verifiedAt: number;\n checkedAt: number;\n /**\n * unconfirmed: a re-check failed (the domain record is gone, the account cannot be confirmed).\n * revoked: its proof key published a revocation (the person removed it from their profile).\n */\n status: \"verified\" | \"withdrawn\" | \"unconfirmed\" | \"revoked\";\n error?: string;\n /** A name/picture looked up on the person's request (Nostr kind-0), with its source. */\n display?: IdentityDisplay;\n}\n\n/** `id`: the proof the request named, kept here only (never sent) so the timeline can settle its entry.\n * `withdrawn`: its owner withdrew that proof while this side was checking its presentation. */\nexport interface IdentityChallenge { nonce: string; issuedAt: number; provider: string; id?: string; withdrawn?: true }\n\nexport interface IdentityLedger {\n challenges: IdentityChallenge[];\n shared: SharedIdentity[];\n received: ReceivedIdentity[];\n /** What the chat's timeline shows of this exchange (identityTimeline.ts). Local only; absent in older ledgers. */\n timeline?: IdentityTimelineEntry[];\n}\nexport const emptyIdentityLedger = (): IdentityLedger => ({ challenges: [], shared: [], received: [] });\n\n/** `account`: the subject its provider verified (`VerifiedIdentity.subject`); the binding's subject when not given. */\nexport interface LocalIdentityProof { statement: IdentityStatement; evidence: unknown; seed: Uint8Array; account?: string }\n\nexport interface IdentityExchangeOptions {\n /** This side's view of the authenticated channel; throws when there is none. */\n scope(): IdentityScope;\n send(frame: object): void;\n storage: { read(): IdentityLedger; update(change: (ledger: IdentityLedger) => IdentityLedger): Promise<void> };\n /** Providers this app can verify. */\n providers(): readonly string[];\n /** A proof of this profile, by id; undefined once removed. */\n localProof(id: string): LocalIdentityProof | undefined | Promise<LocalIdentityProof | undefined>;\n /** Parses and checks untrusted evidence for a statement (the registry's `verifyIdentity`). */\n verify(statement: IdentityStatement, evidence: unknown): Promise<VerifiedIdentity>;\n /** Looks up the proof key's revocation record. Resolves false when there is none or it cannot be read. */\n revoked?(statement: IdentityStatement): Promise<boolean>;\n now?(): number;\n onError?(error: string): void;\n}\n\nexport type IdentityStatus = \"verified\" | \"expired\" | \"withdrawn\" | \"revoked\" | \"unconfirmed\" | \"previous-key\";\n\n/** What the verifier should show for a received proof right now. */\nexport function receivedIdentityStatus(r: ReceivedIdentity, presenter: string | undefined, audience: string | undefined, now = nowSeconds()): IdentityStatus {\n if (r.presenter !== presenter || r.audience !== audience) return \"previous-key\";\n if (r.status === \"withdrawn\") return \"withdrawn\";\n if (r.status === \"revoked\") return \"revoked\";\n if (Math.min(r.binding.expiresAt, r.verified.expiresAt ?? Infinity) <= now) return \"expired\";\n return r.status === \"unconfirmed\" ? \"unconfirmed\" : \"verified\";\n}\n\nconst standing = (r: ReceivedIdentity, now: number) =>\n r.status !== \"withdrawn\" && r.status !== \"revoked\" && Math.min(r.binding.expiresAt, r.verified.expiresAt ?? Infinity) > now;\n/**\n * `received` with room for one more proof: `replaced` (the older proof of the same identity) dropped, then the oldest ones\n * no longer standing; undefined when every place is still taken.\n */\nfunction receivedWithRoom(received: ReceivedIdentity[], id: string, replaced: (r: ReceivedIdentity) => boolean, now: number): ReceivedIdentity[] | undefined {\n const kept = received.filter(r => r.id !== id && !replaced(r));\n const gone = kept.filter(r => !standing(r, now)).sort((a, b) => a.verifiedAt - b.verifiedAt);\n const drop = new Set(gone.slice(0, Math.max(0, kept.length - IDENTITY_MAX_RECEIVED + 1)));\n const out = kept.filter(r => !drop.has(r));\n return out.length < IDENTITY_MAX_RECEIVED ? out : undefined;\n}\n\nconst REVOKED = \"Its owner revoked this proof\";\n/** Revoked is final: a later lookup that fails or finds nothing (the relays forgot it) does not undo it. */\nconst revokedHere = (received: ReceivedIdentity[], id: string) => received.some(r => r.id === id && r.status === \"revoked\");\n\nconst shortError = (e: unknown) => clean(e instanceof Error ? e.message : String(e), ERROR_MAX) ?? \"Invalid proof\";\n\n/**\n * A check this side could not finish because of what its own network did: a host it refused to contact, a server\n * that did not answer or answered an error. The message is for this side only. The contact is told the proof could\n * not be checked, never which host, address or status was seen, so a proof cannot make a contact's app report on\n * the network it sits in.\n */\nexport class IdentityCheckUnavailable extends Error {\n constructor(message: string) { super(message); this.name = \"IdentityCheckUnavailable\"; }\n}\n\n/** What the contact is told when the check failed with an IdentityCheckUnavailable. */\nexport const IDENTITY_CHECK_UNAVAILABLE = \"Your contact's app could not check it. Try again later.\";\n\nconst TOO_MANY_RECEIVED = \"Your contact keeps too many identities from you already\";\n\nconst NEWER_HELD = \"Your contact keeps a newer proof of this identity from you\";\n\nconst peerError = (e: unknown) => e instanceof IdentityCheckUnavailable ? IDENTITY_CHECK_UNAVAILABLE : shortError(e);\n\nconst UNSUPPORTED_KIND = \"Your contact's app cannot verify this kind of identity yet\";\nconst NOT_IN_PROFILE = \"That identity is no longer in your profile\";\nconst CONTACT_REFUSED = \"Your contact could not verify it\";\nconst EXPIRED = \"The proof has expired\";\n/** The refusals a contact's app writes itself (onRequest, onPresent): the only words of its `idp-result` kept as they came. */\nconst CONTACT_REFUSALS = new Set([UNSUPPORTED_KIND, IDENTITY_CHECK_UNAVAILABLE, TOO_MANY_RECEIVED, REVOKED, EXPIRED, NEWER_HELD]);\n\n/**\n * Why a share of mine was not accepted, as this app may say it under my identity: one of the refusals above or my own\n * app's line; else nothing past \"not verified\". Any other words came from the contact (a ledger kept before this check)\n * and would read as this app's own notice.\n */\nexport const identityRefusal = (error: unknown): string | undefined =>\n typeof error === \"string\" && (CONTACT_REFUSALS.has(error) || error === NOT_IN_PROFILE) ? error : undefined;\n\n/**\n * The `idp-*` exchange of one conversation. Frames (all JSON, additive, over the paired channel,\n * only when both offers carry `identity-proof/1`):\n *\n * idp-hello {providers} each side, when the channel is ready\n * idp-request {id, provider} sharer → verifier: \"give me a challenge for this proof\"\n * idp-challenge {id, nonce, issuedAt} verifier, after saving the nonce\n * idp-present {nonce, issuedAt, binding, evidence, sig}\n * idp-result {id, ok, error?} verifier, after saving the outcome\n * idp-withdraw {id} / idp-withdrawn {id}\n */\nexport class IdentityExchange {\n private peerProviders: readonly string[] | undefined;\n private requested = new Set<string>();\n /** The nonces of the presentations in their provider's check now. */\n private checking = new Set<string>();\n /** When the contact's presentations were checked with their provider (seconds), for `IDENTITY_MAX_CHECKS_PER_HOUR`. */\n private checks: number[] = [];\n constructor(private options: IdentityExchangeOptions) {}\n private now() { return (this.options.now ?? nowSeconds)(); }\n /** The ledger with one more step on the chat's timeline, in milliseconds (a test's clock, in seconds, when given). */\n private log(l: IdentityLedger, event: IdentityTimelineEvent): IdentityLedger {\n return { ...l, timeline: applyIdentityEvent(l.timeline ?? [], event, this.options.now ? this.now() * 1000 : Date.now()) };\n }\n private incomingScope(): IdentityScope { const s = this.options.scope(); return { ...s, subject: s.audience, audience: s.subject }; }\n private send(frame: object) {\n if (JSON.stringify(frame).length > IDENTITY_MAX_FRAME) throw new Error(\"Identity proof too large\");\n this.options.send(frame);\n }\n private shared(id: string) { return this.options.storage.read().shared.find(s => s.id === id); }\n private async setShared(entry: SharedIdentity, event?: IdentityTimelineEvent) {\n await this.options.storage.update(l => {\n const next = { ...l, shared: [...l.shared.filter(s => s.id !== entry.id), entry] };\n return event ? this.log(next, event) : next;\n });\n }\n\n /** The providers the contact said it verifies; undefined until its hello. */\n get contactProviders(): readonly string[] | undefined { return this.peerProviders; }\n\n /** The channel is ready: say what we verify, then send what the person queued while offline. */\n ready(): void {\n this.options.scope();\n this.send({ t: \"idp-hello\", providers: [...this.options.providers()] });\n for (const s of this.options.storage.read().shared) {\n if (s.status === \"queued\" || s.status === \"pending\") this.request(s);\n else if (s.status === \"withdrawal-pending\") this.send({ t: \"idp-withdraw\", id: s.id });\n }\n }\n stop(): void { this.requested.clear(); this.peerProviders = undefined; }\n\n /**\n * The challenges whose window ended unanswered go, and with them their requests' lines still verifying: a contact\n * whose app closed, or whose proof left its profile, before it presented tells this side nothing, and its line read\n * \"verifying\" for good. No write when none ended.\n */\n async expire(): Promise<void> {\n const now = this.now();\n if (!this.options.storage.read().challenges.some(c => !liveAt(c, now))) return;\n await this.options.storage.update(l => this.withoutExpired(l, now));\n }\n private withoutExpired(l: IdentityLedger, now: number): IdentityLedger {\n const live = l.challenges.filter(c => liveAt(c, now));\n if (live.length === l.challenges.length) return l;\n // A request sent again (a reconnect) has a live challenge of the same id, whose line it shares.\n const ended = new Set(l.challenges.filter(c => c.id !== undefined && !liveAt(c, now) && !live.some(x => x.id === c.id)).map(c => c.id!));\n return [...ended].reduce((out, proof) => this.log(out, { type: \"unanswered\", side: \"theirs\", proof }), { ...l, challenges: live });\n }\n\n /** Share a proof of this profile with this contact: now if connected, else when it next is. */\n async share(id: string, connected: boolean): Promise<void> {\n const local = await this.options.localProof(id);\n if (!local) throw new Error(\"That identity is no longer in your profile\");\n const { provider, subject } = local.statement.binding;\n const entry: SharedIdentity = { id, provider, subject, account: local.account ?? subject, status: \"queued\", at: this.now() };\n await this.setShared(entry, { type: \"shared\", side: \"mine\", proof: id, provider, subject });\n if (connected) this.request(entry);\n }\n private request(s: SharedIdentity) {\n this.requested.add(s.id);\n this.send({ t: \"idp-request\", id: s.id, provider: s.provider });\n }\n\n /** Stop sharing here. The contact is told (now or on reconnect); a copy it kept cannot be erased. */\n async withdraw(id: string, connected: boolean): Promise<void> {\n let s = this.shared(id);\n if (!s || s.status === \"withdrawn\") return;\n this.requested.delete(id);\n if (s.status === \"queued\") {\n // Unless its challenge was answered meanwhile: that presentation is out, so it is withdrawn as a pending one.\n let answered: SharedIdentity | undefined;\n await this.options.storage.update(l => {\n answered = l.shared.find(x => x.id === id && x.status === \"pending\");\n return answered ? l : this.log({ ...l, shared: l.shared.filter(x => x.id !== id) }, { type: \"unsent\", side: \"mine\", proof: id });\n });\n if (!answered) return;\n s = answered;\n }\n // One the contact refused, it never held: its app writes no stop, and neither does this side.\n await this.setShared({ ...s, status: \"withdrawal-pending\", at: this.now(), error: undefined },\n s.status === \"rejected\" ? undefined : { type: \"stopped\", side: \"mine\", proof: id, provider: s.provider, subject: s.subject, reason: \"withdrawn\" });\n // A link that closed during that write: the withdrawal stays pending and ready() sends it on reconnect.\n if (connected) try { this.send({ t: \"idp-withdraw\", id }); } catch { /* sent on reconnect */ }\n }\n\n /**\n * Run the checks again on a received proof: its revocation record, then (unless `revocationOnly`) the\n * provider's check (a domain record may be gone). `keepUnavailable`: a check that could not run (IdentityCheckUnavailable)\n * is thrown, and the proof is left as it was, for a check this side started on its own.\n */\n async recheck(id: string, { revocationOnly = false, keepUnavailable = false } = {}): Promise<ReceivedIdentity> {\n const r = this.options.storage.read().received.find(x => x.id === id);\n if (!r) throw new Error(\"Unknown identity\");\n if (r.status === \"revoked\") return r;\n if (await this.options.revoked?.(identityStatement(r.binding)).catch(() => false)) {\n return await this.settleRecheck(id, x => x.status === \"revoked\" ? x : { ...x, status: \"revoked\", checkedAt: this.now(), error: undefined },\n { type: \"stopped\", side: \"theirs\", proof: id, provider: r.binding.provider, subject: r.verified.subject, reason: \"revoked\" }) ?? r;\n }\n if (revocationOnly) return r;\n let outcome: (x: ReceivedIdentity) => ReceivedIdentity;\n try {\n const verified = boundVerifiedIdentity(await this.options.verify(identityStatement(r.binding), r.evidence));\n if (verified.subject !== r.verified.subject) throw new Error(\"The identity changed\");\n outcome = x => ({ ...x, verified: { ...verified, display: verified.display ?? x.verified.display }, checkedAt: this.now(), status: \"verified\", error: undefined });\n } catch (e) {\n if (keepUnavailable && e instanceof IdentityCheckUnavailable) throw e;\n const error = shortError(e);\n outcome = x => ({ ...x, checkedAt: this.now(), status: \"unconfirmed\", error });\n }\n // Applied to the record as it is once the check is back: a withdraw or revocation that landed meanwhile holds.\n return await this.settleRecheck(id, x => x.status === \"revoked\" ? x : x.status === \"withdrawn\" ? { ...outcome(x), status: \"withdrawn\" } : outcome(x)) ?? r;\n }\n private async settleRecheck(id: string, outcome: (x: ReceivedIdentity) => ReceivedIdentity, event?: IdentityTimelineEvent): Promise<ReceivedIdentity | undefined> {\n let next: ReceivedIdentity | undefined;\n await this.options.storage.update(l => {\n const x = l.received.find(y => y.id === id);\n if (!x) return l;\n next = outcome(x);\n const out = { ...l, received: l.received.map(y => y.id === id ? next! : y) };\n return event && x.status !== \"revoked\" ? this.log(out, event) : out;\n });\n return next;\n }\n\n async receive(frame: Record<string, unknown>): Promise<void> {\n try {\n if (JSON.stringify(frame).length > IDENTITY_MAX_FRAME) throw new Error(\"Identity proof too large\");\n const id = typeof frame.id === \"string\" && HEX64.test(frame.id) ? frame.id : undefined;\n switch (frame.t) {\n case \"idp-hello\":\n if (Array.isArray(frame.providers) && frame.providers.length <= 64)\n this.peerProviders = frame.providers.filter((p): p is string => typeof p === \"string\" && IDENTITY_PROVIDER_ID.test(p));\n return;\n case \"idp-request\": return await this.onRequest(id, frame.provider);\n case \"idp-challenge\": return await this.onChallenge(id, frame.nonce, frame.issuedAt);\n case \"idp-present\": {\n // The engine checks a presentation beside the chat's other frames, not before them: a copy of one still in\n // its check is refused here, so it never reaches the provider twice.\n const nonce = typeof frame.nonce === \"string\" ? frame.nonce : \"\";\n if (this.checking.has(nonce)) throw new Error(\"Unknown or reused identity challenge\");\n this.checking.add(nonce);\n try { return await this.onPresent(frame); } finally { this.checking.delete(nonce); }\n }\n case \"idp-result\": {\n const s = id ? this.shared(id) : undefined;\n if (!s || s.status !== \"pending\") return;\n const ok = frame.ok === true;\n // Only a refusal its app writes: any other text is the contact's own, never shown as this app's line.\n const error = ok ? undefined : typeof frame.error === \"string\" && CONTACT_REFUSALS.has(frame.error) ? frame.error : CONTACT_REFUSED;\n const entry: SharedIdentity = { ...s, status: ok ? \"accepted\" : \"rejected\", at: this.now(), error };\n // The contact keeps one proof per identity (onPresent): the one it accepted replaced any other of the same\n // provider and verified identity it held from here, so that one is no longer shared in this chat. Matched on\n // the account, not the binding's subject (two OIDC accounts at one issuer are two identities there); one whose\n // account this side does not know stays shared, so Stop sharing still reaches it.\n // Its share stops on the timeline too, as the contact's does (onPresent).\n const replaced = (x: SharedIdentity) => ok && x.status === \"accepted\" && x.provider === s.provider &&\n x.account !== undefined && x.account === s.account;\n await this.options.storage.update(l => l.shared.filter(x => x.id !== s.id && replaced(x)).reduce(\n (out, x) => this.log(out, { type: \"stopped\", side: \"mine\", proof: x.id, provider: x.provider, subject: x.subject, reason: \"withdrawn\" }),\n this.log({ ...l, shared: [\n ...l.shared.filter(x => x.id !== s.id).map(x => replaced(x) ? { ...x, status: \"withdrawn\" as const, at: entry.at } : x), entry,\n ] }, { type: \"result\", side: \"mine\", proof: s.id, ok, error })));\n return;\n }\n case \"idp-withdraw\": {\n if (!id) return;\n // A durable write only for a proof this side actually received and still holds: a withdraw naming an\n // unknown (or already-withdrawn) id is only acknowledged, never written, so it cannot be repeated for a\n // durable write each time. The ack is always sent (a share the contact refused is withdrawn this way too).\n // A revoked one stays revoked: the owner revoked it everywhere, which says more than a withdraw from here.\n const r = this.options.storage.read().received.find(x => x.id === id);\n if (r && r.status !== \"withdrawn\" && r.status !== \"revoked\")\n await this.options.storage.update(l => this.log(\n { ...l, received: l.received.map(x => x.id === id ? { ...x, status: \"withdrawn\" as const } : x) },\n { type: \"stopped\", side: \"theirs\", proof: id, provider: r.binding.provider, subject: r.verified.subject, reason: \"withdrawn\" }));\n // A presentation of it may still be in its check (a withdraw on a new session after a reconnect): noted on\n // the challenge, so the check's outcome is stored withdrawn. Once per challenge, and challenges are bounded.\n if (this.options.storage.read().challenges.some(c => c.id === id && !c.withdrawn))\n await this.options.storage.update(l => ({ ...l, challenges: l.challenges.map(c => c.id === id ? { ...c, withdrawn: true as const } : c) }));\n this.send({ t: \"idp-withdrawn\", id });\n return;\n }\n case \"idp-withdrawn\": {\n const s = id ? this.shared(id) : undefined;\n if (s?.status === \"withdrawal-pending\") await this.setShared({ ...s, status: \"withdrawn\", at: this.now() });\n return;\n }\n }\n } catch (e) { this.options.onError?.(shortError(e)); }\n }\n\n private async onRequest(id: string | undefined, provider: unknown) {\n if (!id) return;\n if (typeof provider !== \"string\" || !this.options.providers().includes(provider)) {\n // A kind this app does not verify: told so at once (`idp-result`), no durable write. The provider is the\n // contact's to choose, so a write here would let it fill the timeline (one entry per fresh id, the real\n // verified line pushed out) and ring the identity cue, with no limit.\n const error = UNSUPPORTED_KIND;\n this.send({ t: \"idp-result\", id, ok: false, error });\n return;\n }\n this.options.scope();\n const now = this.now();\n const challenge: IdentityChallenge = { nonce: toBase64Url(randomBytes(32)), issuedAt: now, provider, id };\n // Saved before it is sent: a presentation for a nonce this side never saved is always refused.\n await this.options.storage.update(l => {\n if (l.challenges.filter(c => liveAt(c, now)).length >= MAX_CHALLENGES) throw new Error(\"Too many identity challenges\");\n // The request's line first, the ended challenges after: a line of this kind an ended one left verifying is\n // taken over in place (its id and time stay), and only the other ended ones' lines go.\n return this.withoutExpired(this.log({ ...l, challenges: [...l.challenges, challenge] }, { type: \"shared\", side: \"theirs\", proof: id, provider }), now);\n });\n this.send({ t: \"idp-challenge\", id, nonce: challenge.nonce, issuedAt: challenge.issuedAt });\n }\n\n private async onChallenge(id: string | undefined, nonce: unknown, issuedAt: unknown) {\n if (!id || !this.requested.has(id) || typeof nonce !== \"string\" || !CHALLENGE_NONCE.test(nonce) || !isInt(issuedAt)) return;\n const s = this.shared(id);\n if (!s || (s.status !== \"queued\" && s.status !== \"pending\")) return;\n this.requested.delete(id);\n const local = await this.options.localProof(id);\n if (!local) {\n const error = NOT_IN_PROFILE;\n await this.setShared({ ...s, status: \"rejected\", at: this.now(), error }, { type: \"result\", side: \"mine\", proof: id, ok: false, error });\n return;\n }\n const scope = this.options.scope();\n const sig = signIdentityPresentation(local.seed, id, scope, nonce, issuedAt);\n // Read again in the write: a Remove or Unshare while the proof key was opened holds, and nothing is presented.\n let stopped = false;\n await this.options.storage.update(l => {\n const x = l.shared.find(y => y.id === id);\n if (!x || (x.status !== \"queued\" && x.status !== \"pending\")) { stopped = true; return l; }\n return { ...l, shared: [...l.shared.filter(y => y.id !== id), { ...x, status: \"pending\", at: this.now(), error: undefined }] };\n });\n if (stopped) return;\n this.send({ t: \"idp-present\", nonce, issuedAt, binding: local.statement.binding, evidence: local.evidence, sig });\n }\n\n private async onPresent(frame: Record<string, unknown>) {\n const { nonce, issuedAt, binding, evidence, sig } = frame;\n if (typeof nonce !== \"string\" || !CHALLENGE_NONCE.test(nonce) || !isInt(issuedAt) || !isIdentityBinding(binding)) return;\n const statement = identityStatement(binding);\n const id = statement.id;\n const scope = this.incomingScope();\n const now = this.now();\n const challengeOf = (l: IdentityLedger) => l.challenges.find(c => c.nonce === nonce && c.issuedAt === issuedAt && c.provider === binding.provider && liveAt(c, now));\n const known = (l: IdentityLedger) => !!challengeOf(l);\n if (!known(this.options.storage.read())) throw new Error(\"Unknown or reused identity challenge\");\n let verified: VerifiedIdentity | undefined;\n // Only what the contact may know: see IdentityCheckUnavailable.\n let error: string | undefined;\n /** The same, as this side's own timeline says it. */\n let reason: string | undefined;\n /** Its owner withdrew the proof while this check ran: no result goes out (see below). */\n let withdrawn = false;\n /** The check could not run on this side (IdentityCheckUnavailable). */\n let unavailable = false;\n /** The same proof this side holds verified, checked recently: its answer is reused (`IDENTITY_REUSE_CHECK_S`). */\n let reused: ReceivedIdentity | undefined;\n try {\n // Before anything is checked or looked up: a contact past the bound costs this side nothing more.\n // The checked subject is not known yet: an identity kept under the binding's subject may be the one replaced.\n const mayReplace = (r: ReceivedIdentity) => r.binding.provider === binding.provider && (r.binding.subject === binding.subject || r.verified.subject === binding.subject);\n if (revokedHere(this.options.storage.read().received, id)) throw new Error(REVOKED);\n if (!receivedWithRoom(this.options.storage.read().received, id, mayReplace, now)) throw new Error(TOO_MANY_RECEIVED);\n if (JSON.stringify(evidence ?? null).length > IDENTITY_MAX_EVIDENCE) throw new Error(\"Evidence too large\");\n if (!verifyIdentityPresentation(binding.key, sig as string, id, scope, nonce, issuedAt)) throw new Error(\"The proof key did not sign this conversation's challenge\");\n if (binding.issuedAt > now + IDENTITY_CLOCK_SKEW) throw new Error(\"The proof is dated in the future\");\n const evidenceJson = JSON.stringify(evidence ?? null);\n reused = this.options.storage.read().received.find(r => r.id === id && r.status === \"verified\" && r.presenter === scope.subject &&\n r.audience === scope.audience && r.context === scope.context && r.checkedAt <= now && now - r.checkedAt < IDENTITY_REUSE_CHECK_S &&\n JSON.stringify(r.evidence ?? null) === evidenceJson);\n if (!reused) {\n this.checks = this.checks.filter(t => t > now - 3600 && t <= now);\n if (this.checks.length >= IDENTITY_MAX_CHECKS_PER_HOUR) throw new IdentityCheckUnavailable(\"Too many of this contact's proofs to check this hour\");\n this.checks.push(now);\n }\n const result = reused ? reused.verified : boundVerifiedIdentity(await this.options.verify(statement, evidence));\n if (Math.min(binding.expiresAt, result.expiresAt ?? Infinity) <= now) throw new Error(EXPIRED);\n // A presentation needs the proof key, so this only matters when its seed leaked: a lookup that\n // fails is not a refusal, a revocation found is. A held proof was looked up with its check.\n if (!reused && await this.options.revoked?.(statement).catch(() => false)) throw new Error(REVOKED);\n verified = result;\n } catch (e) { error = peerError(e); reason = shortError(e); unavailable = e instanceof IdentityCheckUnavailable; }\n // Consuming the nonce and recording the outcome are one transaction.\n await this.options.storage.update(l => {\n const challenge = challengeOf(l);\n if (!challenge) throw new Error(\"Unknown or reused identity challenge\");\n const challenges = l.challenges.filter(c => c.nonce !== nonce);\n withdrawn = !!challenge.withdrawn;\n // Withdrawn while it was checked, then shared again: the newer share decides, so this outcome is dropped. A withdraw\n // marks every challenge and record of that proof, so one of them still unmarked came with the newer share.\n if (withdrawn && (challenges.some(c => c.id === challenge.id && !c.withdrawn) ||\n l.received.some(r => r.id === challenge.id && r.status !== \"withdrawn\" && r.status !== \"revoked\"))) return { ...l, challenges };\n // A newer proof of the same identity replaces the older one; the bound holds for presentations checked at once.\n const subject = verified?.subject;\n // A re-check may have found it revoked while it was being checked.\n if (verified && revokedHere(l.received, id)) { verified = undefined; error = reason = REVOKED; }\n // Checked beside a newer one that is stored already: the binding's date decides, not which check ended last.\n if (verified && l.received.some(r => r.id !== id && r.binding.provider === binding.provider && r.verified.subject === subject &&\n r.binding.issuedAt > binding.issuedAt && standing(r, now))) { verified = undefined; error = reason = NEWER_HELD; }\n // A held proof's record as it is now: one a re-check found unconfirmed meanwhile is not written back verified.\n const prior = reused && l.received.find(r => r.id === id);\n if (verified && reused && prior?.status !== (withdrawn ? \"withdrawn\" : \"verified\")) {\n verified = undefined; error = IDENTITY_CHECK_UNAVAILABLE; reason = \"It was checked again while it was presented\";\n }\n const received = verified && receivedWithRoom(l.received, id, r => r.binding.provider === binding.provider && r.verified.subject === subject, now);\n if (verified && !received) { verified = undefined; error = reason = TOO_MANY_RECEIVED; }\n // This proof, held from this contact already, presented again (its result was lost, so it was asked again): the\n // check settles the held copy. One that could not run leaves a verified copy standing, and the contact is told it\n // is held; one that failed turns it unconfirmed, as a re-check does.\n const held = verified ? undefined : l.received.find(r => r.id === id && r.presenter === scope.subject && r.audience === scope.audience &&\n (r.status === \"verified\" || r.status === \"unconfirmed\"));\n const stands = held?.status === \"verified\" && unavailable;\n if (stands) { verified = held.verified; error = reason = undefined; }\n const logged = this.log(l, { type: \"result\", side: \"theirs\", proof: id, requested: challenge.id, provider: binding.provider,\n subject: verified?.subject ?? binding.subject, ok: !!verified, ...(reason ? { error: reason } : {}) });\n if (stands) return { ...logged, challenges };\n if (!verified || !received) return { ...logged, challenges, received: held && !unavailable\n ? l.received.map(r => r === held ? { ...r, checkedAt: now, status: \"unconfirmed\" as const, error: reason } : r) : l.received };\n // Its owner withdrew it while it was being checked: kept as if the withdraw had come just after.\n const record: ReceivedIdentity = { id, binding, evidence, verified, presenter: scope.subject, audience: scope.audience, context: scope.context,\n verifiedAt: prior?.verifiedAt ?? now, checkedAt: prior?.checkedAt ?? now, status: withdrawn ? \"withdrawn\" : \"verified\" };\n // The older proof it replaced is no longer held: its share stops on the timeline (one already stopped has its stop).\n const replaced = l.received.filter(r => r.id !== id && !received.includes(r) && r.binding.provider === binding.provider && r.verified.subject === subject\n && r.status !== \"withdrawn\" && r.status !== \"revoked\");\n const kept = replaced.reduce((out, r) => this.log(out, { type: \"stopped\", side: \"theirs\", proof: r.id, provider: r.binding.provider, subject: r.verified.subject, reason: \"withdrawn\" }),\n { ...logged, challenges, received: [...received, record] });\n return withdrawn ? this.log(kept, { type: \"stopped\", side: \"theirs\", proof: id, provider: binding.provider, subject: verified.subject, reason: \"withdrawn\" }) : kept;\n });\n // A withdrawn one gets no result, verified or not: the owner has it withdrawn (`idp-withdrawn` went out), and a late\n // one would settle a new share of the same proof made since.\n if (!withdrawn) this.send(verified ? { t: \"idp-result\", id, ok: true } : { t: \"idp-result\", id, ok: false, error });\n }\n}\n"],"mappings":";;;;AAiDA,IAAM,UAAU,UAA4C,MAA4B,WAA4C;CAClI,KAAK,IAAI,IAAI,SAAS,SAAS,GAAG,KAAK,GAAG,KAAK,IAAI,SAAS,EAAE,CAAC,SAAS,QAAQ,OAAO,SAAS,SAAS,EAAE,CAAC,KAAK,GAAG,OAAO;CAC3H,OAAO;AACT;;AAGA,IAAM,gBAAgB,UAA4C,aAAiC;CACjG,KAAK,IAAI,IAAI,SAAS,SAAS,GAAG,KAAK,GAAG,KAAK;EAC7C,MAAM,IAAI,SAAS;EACnB,IAAI,EAAE,SAAS,YAAY,EAAE,SAAS,YAAY,EAAE,UAAU,cAAc,EAAE,aAAa,UAAU,OAAO;CAC9G;CACA,OAAO;AACT;;;;;;;;;AAUA,SAAgB,mBAAmB,UAA4C,OAA8B,IAAqC;CAChJ,MAAM,MAAM,CAAC,GA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