@1sat/connect 0.0.48 → 0.0.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +45 -74
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -100057,59 +100057,6 @@ function createSigmaCWI(config) {
100057
100057
  };
100058
100058
  return { wallet: createCWI(transport), destroy, sendCustomMessage };
100059
100059
  }
100060
- // ../wallet/dist/backupRegistration.js
100061
- class BackupRegistration {
100062
- opts;
100063
- pending;
100064
- attempting = new Set;
100065
- attempts = new Map;
100066
- timers = new Map;
100067
- stopped = false;
100068
- constructor(opts) {
100069
- this.opts = opts;
100070
- this.pending = new Set(opts.urls);
100071
- }
100072
- start() {
100073
- for (const url of this.pending)
100074
- this.attempt(url);
100075
- }
100076
- stop() {
100077
- this.stopped = true;
100078
- for (const t of this.timers.values())
100079
- clearTimeout(t);
100080
- this.timers.clear();
100081
- }
100082
- attempt(url) {
100083
- if (this.stopped)
100084
- return;
100085
- if (!this.pending.has(url))
100086
- return;
100087
- if (this.attempting.has(url))
100088
- return;
100089
- this.attempting.add(url);
100090
- const count = (this.attempts.get(url) ?? 0) + 1;
100091
- this.attempts.set(url, count);
100092
- (async () => {
100093
- try {
100094
- await this.opts.register(url);
100095
- this.pending.delete(url);
100096
- this.attempts.delete(url);
100097
- } catch (err) {
100098
- if (this.opts.onError)
100099
- this.opts.onError(url, err, count);
100100
- if (!this.stopped && this.pending.has(url)) {
100101
- const t = setTimeout(() => {
100102
- this.timers.delete(url);
100103
- this.attempt(url);
100104
- }, this.opts.retryMsecs);
100105
- this.timers.set(url, t);
100106
- }
100107
- } finally {
100108
- this.attempting.delete(url);
100109
- }
100110
- })();
100111
- }
100112
- }
100113
100060
  // ../wallet/dist/permissions/key.js
100114
100061
  var DEFAULT_PORTS = {
100115
100062
  "http:": "80",
@@ -100267,6 +100214,9 @@ class LocalWalletPermissionsManager extends import_index_client.WalletPermission
100267
100214
  return super.bindCallback(eventName, wrapped);
100268
100215
  }
100269
100216
  async ensureProtocolPermission(args) {
100217
+ if (this.isAdminProtocolUpstream(args.protocolID)) {
100218
+ return super.ensureProtocolPermission(args);
100219
+ }
100270
100220
  const counterparty = args.protocolID[0] === 1 ? "" : args.counterparty ?? "self";
100271
100221
  const key = {
100272
100222
  type: "protocol",
@@ -100281,6 +100231,9 @@ class LocalWalletPermissionsManager extends import_index_client.WalletPermission
100281
100231
  return super.ensureProtocolPermission(args);
100282
100232
  }
100283
100233
  async ensureBasketAccess(args) {
100234
+ if (this.isAdminBasketUpstream(args.basket)) {
100235
+ return super.ensureBasketAccess(args);
100236
+ }
100284
100237
  const key = {
100285
100238
  type: "basket",
100286
100239
  originator: normalizeOriginator(args.originator),
@@ -100318,6 +100271,20 @@ class LocalWalletPermissionsManager extends import_index_client.WalletPermission
100318
100271
  const grant = await this.permissionStore.findGrant(key);
100319
100272
  return !!grant && !isExpired(grant.expiry);
100320
100273
  }
100274
+ isAdminBasketUpstream(basket) {
100275
+ const fn = this.isAdminBasket;
100276
+ if (typeof fn !== "function") {
100277
+ throw new Error("LocalWalletPermissionsManager: super.isAdminBasket is unavailable; admin-basket checks would silently bypass");
100278
+ }
100279
+ return fn.call(this, basket);
100280
+ }
100281
+ isAdminProtocolUpstream(proto) {
100282
+ const fn = this.isAdminProtocol;
100283
+ if (typeof fn !== "function") {
100284
+ throw new Error("LocalWalletPermissionsManager: super.isAdminProtocol is unavailable; admin-protocol checks would silently bypass");
100285
+ }
100286
+ return fn.call(this, proto);
100287
+ }
100321
100288
  async grantPermission(params) {
100322
100289
  const request3 = this.pendingSingle.get(params.requestID);
100323
100290
  if (request3) {
@@ -100360,6 +100327,8 @@ class LocalWalletPermissionsManager extends import_index_client.WalletPermission
100360
100327
  for (const p of params.granted.protocolPermissions ?? []) {
100361
100328
  if (p.counterparty === "")
100362
100329
  continue;
100330
+ if (this.isAdminProtocolUpstream(p.protocolID))
100331
+ continue;
100363
100332
  const level = p.protocolID[0];
100364
100333
  const counterparty = level === 1 ? "" : p.counterparty ?? "self";
100365
100334
  await this.permissionStore.putGrant({
@@ -100377,6 +100346,8 @@ class LocalWalletPermissionsManager extends import_index_client.WalletPermission
100377
100346
  });
100378
100347
  }
100379
100348
  for (const b of params.granted.basketAccess ?? []) {
100349
+ if (this.isAdminBasketUpstream(b.basket))
100350
+ continue;
100380
100351
  await this.permissionStore.putGrant({
100381
100352
  key: { type: "basket", originator, basket: b.basket },
100382
100353
  expiry,
@@ -100881,7 +100852,7 @@ var onMount = ($store, initialize) => {
100881
100852
  };
100882
100853
  });
100883
100854
  };
100884
- // ../../node_modules/.bun/better-auth@1.6.9+5b359f2b516881c0/node_modules/better-auth/dist/client/query.mjs
100855
+ // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/query.mjs
100885
100856
  var isServer = () => typeof window === "undefined";
100886
100857
  var useAuthQuery = (initializedAtom, path, $fetch, options) => {
100887
100858
  const value = atom({
@@ -100980,7 +100951,7 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
100980
100951
  return value;
100981
100952
  };
100982
100953
 
100983
- // ../../node_modules/.bun/better-call@1.3.5+3c5d820c62823f0b/node_modules/better-call/dist/error.mjs
100954
+ // ../../node_modules/.bun/better-call@1.3.5+6eee28663eec23d9/node_modules/better-call/dist/error.mjs
100984
100955
  function isErrorStackTraceLimitWritable() {
100985
100956
  const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
100986
100957
  if (desc === undefined)
@@ -101094,7 +101065,7 @@ var InternalAPIError = class extends Error {
101094
101065
  var kAPIErrorHeaderSymbol = Symbol.for("better-call:api-error-headers");
101095
101066
  var APIError = makeErrorForHideStackFrame(InternalAPIError, Error);
101096
101067
 
101097
- // ../../node_modules/.bun/@better-auth+core@1.6.9+52327739b267453f/node_modules/@better-auth/core/dist/error/index.mjs
101068
+ // ../../node_modules/.bun/@better-auth+core@1.6.9+bc248d5ac810b69a/node_modules/@better-auth/core/dist/error/index.mjs
101098
101069
  var BetterAuthError = class extends Error {
101099
101070
  constructor(message, options) {
101100
101071
  super(message, options);
@@ -101104,7 +101075,7 @@ var BetterAuthError = class extends Error {
101104
101075
  }
101105
101076
  };
101106
101077
 
101107
- // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+9f726a97e5e0cb02/node_modules/@sigma-auth/better-auth-plugin/dist/client/local-signer.js
101078
+ // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+bb929f0b4951eb5f/node_modules/@sigma-auth/better-auth-plugin/dist/client/local-signer.js
101108
101079
  class LocalServerSigner {
101109
101080
  baseUrl;
101110
101081
  timeout;
@@ -101332,7 +101303,7 @@ class LocalServerSigner {
101332
101303
  }
101333
101304
  }
101334
101305
 
101335
- // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+9f726a97e5e0cb02/node_modules/@sigma-auth/better-auth-plugin/dist/client/sigma-cwi.js
101306
+ // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+bb929f0b4951eb5f/node_modules/@sigma-auth/better-auth-plugin/dist/client/sigma-cwi.js
101336
101307
  var isRecord3 = (v) => typeof v === "object" && v !== null;
101337
101308
  var isResponse3 = (v) => isRecord3(v) && v.type === "CWI" && v.isInvocation === false && typeof v.id === "string";
101338
101309
  var isState3 = (v) => isRecord3(v) && v.type === "CWI" && isRecord3(v.cwiState);
@@ -101573,7 +101544,7 @@ class SigmaCWISigner {
101573
101544
  this.pending.clear();
101574
101545
  }
101575
101546
  }
101576
- // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+9f726a97e5e0cb02/node_modules/@sigma-auth/better-auth-plugin/dist/client/signer.js
101547
+ // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+bb929f0b4951eb5f/node_modules/@sigma-auth/better-auth-plugin/dist/client/signer.js
101577
101548
  class SigmaIframeSigner {
101578
101549
  iframe = null;
101579
101550
  pendingRequests = new Map;
@@ -101971,7 +101942,7 @@ class SigmaIframeSigner {
101971
101942
  this.rejectAllPending(new Error("Signer destroyed"));
101972
101943
  }
101973
101944
  }
101974
- // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+9f726a97e5e0cb02/node_modules/@sigma-auth/better-auth-plugin/dist/client/index.js
101945
+ // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+bb929f0b4951eb5f/node_modules/@sigma-auth/better-auth-plugin/dist/client/index.js
101975
101946
  var signer = null;
101976
101947
  var signerType = null;
101977
101948
  var storedBapId = null;
@@ -102479,7 +102450,7 @@ Backend: ${status} (${endpoint})`;
102479
102450
  };
102480
102451
  };
102481
102452
 
102482
- // ../../node_modules/.bun/better-auth@1.6.9+5b359f2b516881c0/node_modules/better-auth/dist/client/broadcast-channel.mjs
102453
+ // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/broadcast-channel.mjs
102483
102454
  var kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
102484
102455
  var now = () => Math.floor(Date.now() / 1000);
102485
102456
  var WindowBroadcastChannel = class {
@@ -102527,7 +102498,7 @@ function getGlobalBroadcastChannel(name = "better-auth.message") {
102527
102498
  return globalThis[kBroadcastChannel];
102528
102499
  }
102529
102500
 
102530
- // ../../node_modules/.bun/better-auth@1.6.9+5b359f2b516881c0/node_modules/better-auth/dist/client/focus-manager.mjs
102501
+ // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/focus-manager.mjs
102531
102502
  var kFocusManager = Symbol.for("better-auth:focus-manager");
102532
102503
  var WindowFocusManager = class {
102533
102504
  listeners = /* @__PURE__ */ new Set;
@@ -102559,7 +102530,7 @@ function getGlobalFocusManager() {
102559
102530
  return globalThis[kFocusManager];
102560
102531
  }
102561
102532
 
102562
- // ../../node_modules/.bun/better-auth@1.6.9+5b359f2b516881c0/node_modules/better-auth/dist/client/online-manager.mjs
102533
+ // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/online-manager.mjs
102563
102534
  var kOnlineManager = Symbol.for("better-auth:online-manager");
102564
102535
  var WindowOnlineManager = class {
102565
102536
  listeners = /* @__PURE__ */ new Set;
@@ -102593,7 +102564,7 @@ function getGlobalOnlineManager() {
102593
102564
  return globalThis[kOnlineManager];
102594
102565
  }
102595
102566
 
102596
- // ../../node_modules/.bun/better-auth@1.6.9+5b359f2b516881c0/node_modules/better-auth/dist/client/parser.mjs
102567
+ // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/parser.mjs
102597
102568
  var PROTO_POLLUTION_PATTERNS = {
102598
102569
  proto: /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,
102599
102570
  constructor: /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,
@@ -102673,7 +102644,7 @@ function parseJSON(value, options = { strict: true }) {
102673
102644
  return betterJSONParse(value, options);
102674
102645
  }
102675
102646
 
102676
- // ../../node_modules/.bun/better-auth@1.6.9+5b359f2b516881c0/node_modules/better-auth/dist/client/session-refresh.mjs
102647
+ // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/session-refresh.mjs
102677
102648
  var now2 = () => Math.floor(Date.now() / 1000);
102678
102649
  function normalizeSessionResponse(res) {
102679
102650
  if (typeof res === "object" && res !== null && "data" in res && "error" in res)
@@ -102813,7 +102784,7 @@ function createSessionRefreshManager(opts) {
102813
102784
  };
102814
102785
  }
102815
102786
 
102816
- // ../../node_modules/.bun/@better-auth+core@1.6.9+52327739b267453f/node_modules/@better-auth/core/dist/env/env-impl.mjs
102787
+ // ../../node_modules/.bun/@better-auth+core@1.6.9+bc248d5ac810b69a/node_modules/@better-auth/core/dist/env/env-impl.mjs
102817
102788
  var _envShim = Object.create(null);
102818
102789
  var _getEnv = (useShim) => globalThis.process?.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (useShim ? _envShim : globalThis);
102819
102790
  var env = new Proxy(_envShim, {
@@ -102873,7 +102844,7 @@ var ENV = Object.freeze({
102873
102844
  return getEnvVar("BETTER_AUTH_TELEMETRY_ENDPOINT", "");
102874
102845
  }
102875
102846
  });
102876
- // ../../node_modules/.bun/better-auth@1.6.9+5b359f2b516881c0/node_modules/better-auth/dist/utils/url.mjs
102847
+ // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/utils/url.mjs
102877
102848
  function checkHasPath(url) {
102878
102849
  try {
102879
102850
  return (new URL(url).pathname.replace(/\/+$/, "") || "/") !== "/";
@@ -102957,7 +102928,7 @@ function getOrigin(url) {
102957
102928
  }
102958
102929
  }
102959
102930
 
102960
- // ../../node_modules/.bun/better-auth@1.6.9+5b359f2b516881c0/node_modules/better-auth/dist/client/fetch-plugins.mjs
102931
+ // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/fetch-plugins.mjs
102961
102932
  var redirectPlugin = {
102962
102933
  id: "redirect",
102963
102934
  name: "Redirect",
@@ -102973,7 +102944,7 @@ var redirectPlugin = {
102973
102944
  } }
102974
102945
  };
102975
102946
 
102976
- // ../../node_modules/.bun/better-auth@1.6.9+5b359f2b516881c0/node_modules/better-auth/dist/client/session-atom.mjs
102947
+ // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/session-atom.mjs
102977
102948
  function getSessionAtom($fetch, options) {
102978
102949
  const $signal = atom(false);
102979
102950
  const session = useAuthQuery($signal, "/get-session", $fetch, { method: "GET" });
@@ -103629,7 +103600,7 @@ var betterFetch = async (url, options) => {
103629
103600
  };
103630
103601
  };
103631
103602
 
103632
- // ../../node_modules/.bun/better-auth@1.6.9+5b359f2b516881c0/node_modules/better-auth/dist/client/config.mjs
103603
+ // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/config.mjs
103633
103604
  var resolvePublicAuthUrl = (basePath) => {
103634
103605
  if (typeof process === "undefined")
103635
103606
  return;
@@ -103739,12 +103710,12 @@ var getClientConfig = (options, loadEnv) => {
103739
103710
  };
103740
103711
  };
103741
103712
 
103742
- // ../../node_modules/.bun/better-auth@1.6.9+5b359f2b516881c0/node_modules/better-auth/dist/utils/is-atom.mjs
103713
+ // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/utils/is-atom.mjs
103743
103714
  function isAtom(value) {
103744
103715
  return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
103745
103716
  }
103746
103717
 
103747
- // ../../node_modules/.bun/better-auth@1.6.9+5b359f2b516881c0/node_modules/better-auth/dist/client/proxy.mjs
103718
+ // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/proxy.mjs
103748
103719
  function getMethod3(path, knownPathMethods, args) {
103749
103720
  const method = knownPathMethods[path];
103750
103721
  const { fetchOptions, query: _query, ...body } = args || {};
@@ -103826,12 +103797,12 @@ function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomLis
103826
103797
  return createProxy();
103827
103798
  }
103828
103799
 
103829
- // ../../node_modules/.bun/@better-auth+core@1.6.9+52327739b267453f/node_modules/@better-auth/core/dist/utils/string.mjs
103800
+ // ../../node_modules/.bun/@better-auth+core@1.6.9+bc248d5ac810b69a/node_modules/@better-auth/core/dist/utils/string.mjs
103830
103801
  function capitalizeFirstLetter(str) {
103831
103802
  return str.charAt(0).toUpperCase() + str.slice(1);
103832
103803
  }
103833
103804
 
103834
- // ../../node_modules/.bun/better-auth@1.6.9+5b359f2b516881c0/node_modules/better-auth/dist/client/vanilla.mjs
103805
+ // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/vanilla.mjs
103835
103806
  function createAuthClient(options) {
103836
103807
  const { pluginPathMethods, pluginsActions, pluginsAtoms, $fetch, atomListeners, $store } = getClientConfig(options);
103837
103808
  const resolvedHooks = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1sat/connect",
3
- "version": "0.0.48",
3
+ "version": "0.0.50",
4
4
  "description": "Connection layer for 1Sat wallet - popup flow, events, session management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "license": "MIT",
30
30
  "dependencies": {
31
- "@1sat/wallet": "0.0.62",
31
+ "@1sat/wallet": "0.0.66",
32
32
  "@sigma-auth/better-auth-plugin": "^0.0.84",
33
33
  "better-auth": "^1.5.4",
34
34
  "eventemitter3": "^5.0.1"