@1sat/connect 0.0.52 → 0.0.53

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 +41 -43
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -45890,7 +45890,6 @@ var require_AuthFetch = __commonJS((exports) => {
45890
45890
  }
45891
45891
  });
45892
45892
  if (response.status === 402) {
45893
- console.error("[AuthFetch] 402 received for " + url.slice(-50));
45894
45893
  return await this.handlePaymentAndRetry(url, config, response);
45895
45894
  }
45896
45895
  return response;
@@ -46099,7 +46098,6 @@ var require_AuthFetch = __commonJS((exports) => {
46099
46098
  return context.satoshisRequired === satoshisRequired && context.serverIdentityKey === serverIdentityKey && context.derivationPrefix === derivationPrefix;
46100
46099
  }
46101
46100
  async createPaymentContext(url, config, satoshisRequired, serverIdentityKey, derivationPrefix) {
46102
- console.error("[AuthFetch] createPaymentContext sats=" + satoshisRequired);
46103
46101
  const derivationSuffix = await (0, createNonce_js_1.createNonce)(this.wallet, undefined, this.originator);
46104
46102
  const { publicKey: derivedPublicKey } = await this.wallet.getPublicKey({
46105
46103
  protocolID: [2, "3241645161d8"],
@@ -46107,26 +46105,18 @@ var require_AuthFetch = __commonJS((exports) => {
46107
46105
  counterparty: serverIdentityKey
46108
46106
  }, this.originator);
46109
46107
  const lockingScript = new P2PKH_js_1.default().lock(PublicKey_js_1.default.fromString(derivedPublicKey).toAddress()).toHex();
46110
- console.error("[AuthFetch] calling wallet.createAction for payment");
46111
- let tx;
46112
- try {
46113
- ({ tx } = await this.wallet.createAction({
46114
- description: `Payment for request to ${new URL(url).origin}`,
46115
- outputs: [{
46116
- satoshis: satoshisRequired,
46117
- lockingScript,
46118
- customInstructions: JSON.stringify({ derivationPrefix, derivationSuffix, payee: serverIdentityKey }),
46119
- outputDescription: "HTTP request payment"
46120
- }],
46121
- options: {
46122
- randomizeOutputs: false
46123
- }
46124
- }, this.originator));
46125
- } catch (e) {
46126
- console.error("[AuthFetch] wallet.createAction threw:", e?.message || e);
46127
- throw e;
46128
- }
46129
- console.error("[AuthFetch] wallet.createAction returned bytes=", tx?.length);
46108
+ const { tx } = await this.wallet.createAction({
46109
+ description: `Payment for request to ${new URL(url).origin}`,
46110
+ outputs: [{
46111
+ satoshis: satoshisRequired,
46112
+ lockingScript,
46113
+ customInstructions: JSON.stringify({ derivationPrefix, derivationSuffix, payee: serverIdentityKey }),
46114
+ outputDescription: "HTTP request payment"
46115
+ }],
46116
+ options: {
46117
+ randomizeOutputs: false
46118
+ }
46119
+ }, this.originator);
46130
46120
  const { publicKey: clientIdentityKey } = await this.wallet.getPublicKey({ identityKey: true }, this.originator);
46131
46121
  return {
46132
46122
  satoshisRequired,
@@ -100448,6 +100438,7 @@ class LocalWalletPermissionsManager extends import_index_client.WalletPermission
100448
100438
  async revokeAllForOriginator(originator) {
100449
100439
  const normalized = normalizeOriginator(originator);
100450
100440
  await this.permissionStore.deleteAllForOriginator(normalized);
100441
+ this.clearPermissionCache();
100451
100442
  return super.revokeAllForOriginator(normalized);
100452
100443
  }
100453
100444
  async revokePermission(oldToken) {
@@ -100455,11 +100446,18 @@ class LocalWalletPermissionsManager extends import_index_client.WalletPermission
100455
100446
  if (idbKey) {
100456
100447
  await this.permissionStore.deleteGrant(idbKey);
100457
100448
  }
100449
+ this.clearPermissionCache();
100458
100450
  if (oldToken.txid.startsWith(IDB_TXID_PREFIX)) {
100459
100451
  return;
100460
100452
  }
100461
100453
  return super.revokePermission(oldToken);
100462
100454
  }
100455
+ clearPermissionCache() {
100456
+ const cache = this.permissionCache;
100457
+ if (cache instanceof Map) {
100458
+ cache.clear();
100459
+ }
100460
+ }
100463
100461
  }
100464
100462
  function grantToToken(grant) {
100465
100463
  const base = {
@@ -100852,7 +100850,7 @@ var onMount = ($store, initialize) => {
100852
100850
  };
100853
100851
  });
100854
100852
  };
100855
- // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/query.mjs
100853
+ // ../../node_modules/.bun/better-auth@1.6.9+c714f287dea22392/node_modules/better-auth/dist/client/query.mjs
100856
100854
  var isServer = () => typeof window === "undefined";
100857
100855
  var useAuthQuery = (initializedAtom, path, $fetch, options) => {
100858
100856
  const value = atom({
@@ -100951,7 +100949,7 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
100951
100949
  return value;
100952
100950
  };
100953
100951
 
100954
- // ../../node_modules/.bun/better-call@1.3.5+6eee28663eec23d9/node_modules/better-call/dist/error.mjs
100952
+ // ../../node_modules/.bun/better-call@1.3.5+68a1e3a0c4588df3/node_modules/better-call/dist/error.mjs
100955
100953
  function isErrorStackTraceLimitWritable() {
100956
100954
  const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
100957
100955
  if (desc === undefined)
@@ -101065,7 +101063,7 @@ var InternalAPIError = class extends Error {
101065
101063
  var kAPIErrorHeaderSymbol = Symbol.for("better-call:api-error-headers");
101066
101064
  var APIError = makeErrorForHideStackFrame(InternalAPIError, Error);
101067
101065
 
101068
- // ../../node_modules/.bun/@better-auth+core@1.6.9+bc248d5ac810b69a/node_modules/@better-auth/core/dist/error/index.mjs
101066
+ // ../../node_modules/.bun/@better-auth+core@1.6.9+e52c184230c67995/node_modules/@better-auth/core/dist/error/index.mjs
101069
101067
  var BetterAuthError = class extends Error {
101070
101068
  constructor(message, options) {
101071
101069
  super(message, options);
@@ -101075,7 +101073,7 @@ var BetterAuthError = class extends Error {
101075
101073
  }
101076
101074
  };
101077
101075
 
101078
- // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+5e42e7c53ae16068/node_modules/@sigma-auth/better-auth-plugin/dist/client/local-signer.js
101076
+ // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+bc80f45664eef636/node_modules/@sigma-auth/better-auth-plugin/dist/client/local-signer.js
101079
101077
  class LocalServerSigner {
101080
101078
  baseUrl;
101081
101079
  timeout;
@@ -101303,7 +101301,7 @@ class LocalServerSigner {
101303
101301
  }
101304
101302
  }
101305
101303
 
101306
- // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+5e42e7c53ae16068/node_modules/@sigma-auth/better-auth-plugin/dist/client/sigma-cwi.js
101304
+ // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+bc80f45664eef636/node_modules/@sigma-auth/better-auth-plugin/dist/client/sigma-cwi.js
101307
101305
  var isRecord3 = (v) => typeof v === "object" && v !== null;
101308
101306
  var isResponse3 = (v) => isRecord3(v) && v.type === "CWI" && v.isInvocation === false && typeof v.id === "string";
101309
101307
  var isState3 = (v) => isRecord3(v) && v.type === "CWI" && isRecord3(v.cwiState);
@@ -101544,7 +101542,7 @@ class SigmaCWISigner {
101544
101542
  this.pending.clear();
101545
101543
  }
101546
101544
  }
101547
- // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+5e42e7c53ae16068/node_modules/@sigma-auth/better-auth-plugin/dist/client/signer.js
101545
+ // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+bc80f45664eef636/node_modules/@sigma-auth/better-auth-plugin/dist/client/signer.js
101548
101546
  class SigmaIframeSigner {
101549
101547
  iframe = null;
101550
101548
  pendingRequests = new Map;
@@ -101942,7 +101940,7 @@ class SigmaIframeSigner {
101942
101940
  this.rejectAllPending(new Error("Signer destroyed"));
101943
101941
  }
101944
101942
  }
101945
- // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+5e42e7c53ae16068/node_modules/@sigma-auth/better-auth-plugin/dist/client/index.js
101943
+ // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+bc80f45664eef636/node_modules/@sigma-auth/better-auth-plugin/dist/client/index.js
101946
101944
  var signer = null;
101947
101945
  var signerType = null;
101948
101946
  var storedBapId = null;
@@ -102450,7 +102448,7 @@ Backend: ${status} (${endpoint})`;
102450
102448
  };
102451
102449
  };
102452
102450
 
102453
- // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/broadcast-channel.mjs
102451
+ // ../../node_modules/.bun/better-auth@1.6.9+c714f287dea22392/node_modules/better-auth/dist/client/broadcast-channel.mjs
102454
102452
  var kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
102455
102453
  var now = () => Math.floor(Date.now() / 1000);
102456
102454
  var WindowBroadcastChannel = class {
@@ -102498,7 +102496,7 @@ function getGlobalBroadcastChannel(name = "better-auth.message") {
102498
102496
  return globalThis[kBroadcastChannel];
102499
102497
  }
102500
102498
 
102501
- // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/focus-manager.mjs
102499
+ // ../../node_modules/.bun/better-auth@1.6.9+c714f287dea22392/node_modules/better-auth/dist/client/focus-manager.mjs
102502
102500
  var kFocusManager = Symbol.for("better-auth:focus-manager");
102503
102501
  var WindowFocusManager = class {
102504
102502
  listeners = /* @__PURE__ */ new Set;
@@ -102530,7 +102528,7 @@ function getGlobalFocusManager() {
102530
102528
  return globalThis[kFocusManager];
102531
102529
  }
102532
102530
 
102533
- // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/online-manager.mjs
102531
+ // ../../node_modules/.bun/better-auth@1.6.9+c714f287dea22392/node_modules/better-auth/dist/client/online-manager.mjs
102534
102532
  var kOnlineManager = Symbol.for("better-auth:online-manager");
102535
102533
  var WindowOnlineManager = class {
102536
102534
  listeners = /* @__PURE__ */ new Set;
@@ -102564,7 +102562,7 @@ function getGlobalOnlineManager() {
102564
102562
  return globalThis[kOnlineManager];
102565
102563
  }
102566
102564
 
102567
- // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/parser.mjs
102565
+ // ../../node_modules/.bun/better-auth@1.6.9+c714f287dea22392/node_modules/better-auth/dist/client/parser.mjs
102568
102566
  var PROTO_POLLUTION_PATTERNS = {
102569
102567
  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*:/,
102570
102568
  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*:/,
@@ -102644,7 +102642,7 @@ function parseJSON(value, options = { strict: true }) {
102644
102642
  return betterJSONParse(value, options);
102645
102643
  }
102646
102644
 
102647
- // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/session-refresh.mjs
102645
+ // ../../node_modules/.bun/better-auth@1.6.9+c714f287dea22392/node_modules/better-auth/dist/client/session-refresh.mjs
102648
102646
  var now2 = () => Math.floor(Date.now() / 1000);
102649
102647
  function normalizeSessionResponse(res) {
102650
102648
  if (typeof res === "object" && res !== null && "data" in res && "error" in res)
@@ -102784,7 +102782,7 @@ function createSessionRefreshManager(opts) {
102784
102782
  };
102785
102783
  }
102786
102784
 
102787
- // ../../node_modules/.bun/@better-auth+core@1.6.9+bc248d5ac810b69a/node_modules/@better-auth/core/dist/env/env-impl.mjs
102785
+ // ../../node_modules/.bun/@better-auth+core@1.6.9+e52c184230c67995/node_modules/@better-auth/core/dist/env/env-impl.mjs
102788
102786
  var _envShim = Object.create(null);
102789
102787
  var _getEnv = (useShim) => globalThis.process?.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (useShim ? _envShim : globalThis);
102790
102788
  var env = new Proxy(_envShim, {
@@ -102844,7 +102842,7 @@ var ENV = Object.freeze({
102844
102842
  return getEnvVar("BETTER_AUTH_TELEMETRY_ENDPOINT", "");
102845
102843
  }
102846
102844
  });
102847
- // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/utils/url.mjs
102845
+ // ../../node_modules/.bun/better-auth@1.6.9+c714f287dea22392/node_modules/better-auth/dist/utils/url.mjs
102848
102846
  function checkHasPath(url) {
102849
102847
  try {
102850
102848
  return (new URL(url).pathname.replace(/\/+$/, "") || "/") !== "/";
@@ -102928,7 +102926,7 @@ function getOrigin(url) {
102928
102926
  }
102929
102927
  }
102930
102928
 
102931
- // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/fetch-plugins.mjs
102929
+ // ../../node_modules/.bun/better-auth@1.6.9+c714f287dea22392/node_modules/better-auth/dist/client/fetch-plugins.mjs
102932
102930
  var redirectPlugin = {
102933
102931
  id: "redirect",
102934
102932
  name: "Redirect",
@@ -102944,7 +102942,7 @@ var redirectPlugin = {
102944
102942
  } }
102945
102943
  };
102946
102944
 
102947
- // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/session-atom.mjs
102945
+ // ../../node_modules/.bun/better-auth@1.6.9+c714f287dea22392/node_modules/better-auth/dist/client/session-atom.mjs
102948
102946
  function getSessionAtom($fetch, options) {
102949
102947
  const $signal = atom(false);
102950
102948
  const session = useAuthQuery($signal, "/get-session", $fetch, { method: "GET" });
@@ -103600,7 +103598,7 @@ var betterFetch = async (url, options) => {
103600
103598
  };
103601
103599
  };
103602
103600
 
103603
- // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/config.mjs
103601
+ // ../../node_modules/.bun/better-auth@1.6.9+c714f287dea22392/node_modules/better-auth/dist/client/config.mjs
103604
103602
  var resolvePublicAuthUrl = (basePath) => {
103605
103603
  if (typeof process === "undefined")
103606
103604
  return;
@@ -103710,12 +103708,12 @@ var getClientConfig = (options, loadEnv) => {
103710
103708
  };
103711
103709
  };
103712
103710
 
103713
- // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/utils/is-atom.mjs
103711
+ // ../../node_modules/.bun/better-auth@1.6.9+c714f287dea22392/node_modules/better-auth/dist/utils/is-atom.mjs
103714
103712
  function isAtom(value) {
103715
103713
  return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
103716
103714
  }
103717
103715
 
103718
- // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/proxy.mjs
103716
+ // ../../node_modules/.bun/better-auth@1.6.9+c714f287dea22392/node_modules/better-auth/dist/client/proxy.mjs
103719
103717
  function getMethod3(path, knownPathMethods, args) {
103720
103718
  const method = knownPathMethods[path];
103721
103719
  const { fetchOptions, query: _query, ...body } = args || {};
@@ -103797,12 +103795,12 @@ function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomLis
103797
103795
  return createProxy();
103798
103796
  }
103799
103797
 
103800
- // ../../node_modules/.bun/@better-auth+core@1.6.9+bc248d5ac810b69a/node_modules/@better-auth/core/dist/utils/string.mjs
103798
+ // ../../node_modules/.bun/@better-auth+core@1.6.9+e52c184230c67995/node_modules/@better-auth/core/dist/utils/string.mjs
103801
103799
  function capitalizeFirstLetter(str) {
103802
103800
  return str.charAt(0).toUpperCase() + str.slice(1);
103803
103801
  }
103804
103802
 
103805
- // ../../node_modules/.bun/better-auth@1.6.9+29364d72b6645b13/node_modules/better-auth/dist/client/vanilla.mjs
103803
+ // ../../node_modules/.bun/better-auth@1.6.9+c714f287dea22392/node_modules/better-auth/dist/client/vanilla.mjs
103806
103804
  function createAuthClient(options) {
103807
103805
  const { pluginPathMethods, pluginsActions, pluginsAtoms, $fetch, atomListeners, $store } = getClientConfig(options);
103808
103806
  const resolvedHooks = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1sat/connect",
3
- "version": "0.0.52",
3
+ "version": "0.0.53",
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.69",
31
+ "@1sat/wallet": "0.0.70",
32
32
  "@sigma-auth/better-auth-plugin": "^0.0.84",
33
33
  "better-auth": "^1.5.4",
34
34
  "eventemitter3": "^5.0.1"