@ghostlytools/sdk 1.13.2 → 1.13.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.
@@ -3405,6 +3405,11 @@ var IdentityExchange = class IdentityExchange {
3405
3405
  requested = /* @__PURE__ */ new Set();
3406
3406
  /** The nonces of the presentations in their provider's check now. */
3407
3407
  checking = /* @__PURE__ */ new Set();
3408
+ /**
3409
+ * The nonces of the challenges sent on this connection. A presentation is signed for its session, so a challenge
3410
+ * from a closed link that is not in its check now can no longer be answered.
3411
+ */
3412
+ issued = /* @__PURE__ */ new Set();
3408
3413
  /** When the contact's presentations were checked with their provider (seconds), for `IDENTITY_MAX_CHECKS_PER_HOUR`. */
3409
3414
  checks = [];
3410
3415
  /** When this side sent its recent frames (ms), for `IDENTITY_SEND_LIMIT`. Kept across connections, as the contact's count is. */
@@ -3573,6 +3578,7 @@ var IdentityExchange = class IdentityExchange {
3573
3578
  stop() {
3574
3579
  this.requested.clear();
3575
3580
  this.peerProviders = void 0;
3581
+ this.issued.clear();
3576
3582
  this.outbox = [];
3577
3583
  this.attempts.clear();
3578
3584
  if (this.timer !== void 0) clearTimeout(this.timer);
@@ -3851,6 +3857,11 @@ var IdentityExchange = class IdentityExchange {
3851
3857
  id
3852
3858
  };
3853
3859
  await this.options.storage.update((l) => {
3860
+ const stale = (c) => c.id === id && !this.issued.has(c.nonce) && !this.checking.has(c.nonce);
3861
+ if (l.challenges.some(stale)) l = {
3862
+ ...l,
3863
+ challenges: l.challenges.filter((c) => !stale(c))
3864
+ };
3854
3865
  if (l.challenges.filter((c) => liveAt(c, now)).length >= MAX_CHALLENGES) throw new Error("Too many identity challenges");
3855
3866
  return this.withoutExpired(this.log({
3856
3867
  ...l,
@@ -3862,6 +3873,9 @@ var IdentityExchange = class IdentityExchange {
3862
3873
  provider
3863
3874
  }), now);
3864
3875
  });
3876
+ const held = new Set(this.options.storage.read().challenges.map((c) => c.nonce));
3877
+ for (const n of this.issued) if (!held.has(n)) this.issued.delete(n);
3878
+ this.issued.add(challenge.nonce);
3865
3879
  this.send({
3866
3880
  t: "idp-challenge",
3867
3881
  id,
@@ -4130,4 +4144,4 @@ function isBitcoinAddress(address, network) {
4130
4144
  }
4131
4145
  export { DEFAULT_RELAYS as $, decodeTxtPacket as $t, identityRevocationValue as A, BREAKER_BASE_MS as At, applyIdentityEvent as B, withRequestOptions as Bt, IdentityCheckUnavailable as C, currentRelays as Ct, emptyIdentityLedger as D, setLinkTraceSink as Dt, boundVerifiedIdentity as E, relayUrlProblem as Et, receivedIdentityStatus as F, PublishFailedError as Ft, AWAITED_READS as G, createRelayPayload as Gt, ANSWER_READ_ALLOWANCE as H, PKARR_FUTURE_SKEW_MS as Ht, revokesIdentity as I, budgetRetryMs as It, BACKGROUND_WRITES_SHARE as J, openRelayPayload as Jt, BACKGROUND_REQUESTS_PER_MINUTE as K, measureRecords as Kt, signIdentityPresentation as L, heldBackError as Lt, identityStatementText as M, BREAKER_THRESHOLD as Mt, isIdentityBinding as N, RelayBreaker as Nt, identityPresentationBytes as O, traceLink as Ot, newIdentityBinding as P, DiscoveryBudgetError as Pt, CHAT_WATCH_SHARE as Q, decodeDnsAnswers as Qt, verifyIdentityPresentation as R, isDiscoveryBudgetError as Rt, IDENTITY_SUBJECT as S, WRITE_FIRST_MS as St, boundIdentityDisplay as T, readRelayBody as Tt, ANSWER_READ_FIRST_MS as U, PacketTooLargeError as Ut, lastSharedWithMe as V, MAX_DNS_PACKET_BYTES as Vt, ANSWER_READ_SPACING_MS as W, RELAY_PAYLOAD_MAX_BYTES as Wt, CHAT_RESERVE_MOST_SHARE as X, readOwnRelayPayload as Xt, CHAT_RESERVE as Y, parseRelayPayload as Yt, CHAT_RESERVE_PER_CHAT as Z, signRelayPayload as Zt, IDENTITY_REUSE_CHECK_S as _, stripHidden as _n, SLOW_DEMOTE_MS as _t, IDENTITY_CLOCK_SKEW as a, createIdentity as an, GROUP_OVER_PACE_MS as at, IDENTITY_SEND_WINDOW_MS as b, WATCH_SHARE as bt, IDENTITY_MAX_CHECKS_PER_HOUR as c, publicKeyFromZ32 as cn, HEDGE_MISSING_MS as ct, IDENTITY_MAX_RECEIVED as d, verify as dn, RELAY_REQUESTS_PER_MINUTE as dt, encodeTxtPacket as en, DEPARTED_READS as et, IDENTITY_MAX_VALIDITY as f, MAX_NICK_LENGTH as fn, REQUESTS_PER_MINUTE as ft, IDENTITY_RESEND_MS as g, sanitizeNick as gn, SIGNALING_WINDOW_MS as gt, IDENTITY_RESENDS as h, sanitizeDisplayText as hn, SIGNALING_ALLOWANCE_SHARE as ht, IDENTITY_CHECK_UNAVAILABLE as i, IDENTITY_MEMO_SIZE as in, GROUP_BURST_ONE_LINK as it, identityStatement as j, BREAKER_MAX_MS as jt, identityRefusal as k, BREAKER_ALL_DOWN_PROBE_MS as kt, IDENTITY_MAX_EVIDENCE as l, setPublicKeyFastPath as ln, HEDGE_MS as lt, IDENTITY_PROVIDER_ID as m, hasVisible as mn, RelaysFailedError as mt, isBitcoinAddress as n, IDENTITY_MEMO_IDLE_MS as nn, FRESH_READ_MS as nt, IDENTITY_FRAME_LIMIT as o, identityFromSeed as on, GROUP_RATION_WINDOW_MS as ot, IDENTITY_PROOF_CAPABILITY as p, dropLoneJoiners as pn, RelayTransport as pt, BACKGROUND_WHILE_SIGNALING as q, newerPacket as qt, IDENTITY_CHALLENGE_WINDOW as r, IDENTITY_MEMO_MAX as rn, GROUP_BURST_MS as rt, IDENTITY_FRAME_WINDOW_MS as s, identityFromSeedB64 as sn, GROUP_SIGNALING_ALLOWANCE_SHARE as st, BITCOIN_NETWORKS as t, readDnsName as tn, DOOR_FIRST_MS as tt, IDENTITY_MAX_FRAME as u, sign as un, PREVIOUS_DEFAULT_RELAYS as ut, IDENTITY_REVOCATION_LABEL as v, trimEndOf as vn, SLOW_MS as vt, IdentityExchange as w, normalizeRelayUrl as wt, IDENTITY_STATEMENT_PREFIX as x, WAY_BACK_SHARE as xt, IDENTITY_SEND_LIMIT as y, unwrapPasted as yn, TURN_SOURCE_TIMEOUT_MS as yt, IDENTITY_TIMELINE_MAX as z, publishedNowhere as zt };
4132
4146
 
4133
- //# sourceMappingURL=bitcoinAddress-BIW3tpJG.js.map
4147
+ //# sourceMappingURL=bitcoinAddress-DifDz48H.js.map