@1sat/connect 0.0.48 → 0.0.49

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 +24 -0
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -100267,6 +100267,9 @@ class LocalWalletPermissionsManager extends import_index_client.WalletPermission
100267
100267
  return super.bindCallback(eventName, wrapped);
100268
100268
  }
100269
100269
  async ensureProtocolPermission(args) {
100270
+ if (this.isAdminProtocolUpstream(args.protocolID)) {
100271
+ return super.ensureProtocolPermission(args);
100272
+ }
100270
100273
  const counterparty = args.protocolID[0] === 1 ? "" : args.counterparty ?? "self";
100271
100274
  const key = {
100272
100275
  type: "protocol",
@@ -100281,6 +100284,9 @@ class LocalWalletPermissionsManager extends import_index_client.WalletPermission
100281
100284
  return super.ensureProtocolPermission(args);
100282
100285
  }
100283
100286
  async ensureBasketAccess(args) {
100287
+ if (this.isAdminBasketUpstream(args.basket)) {
100288
+ return super.ensureBasketAccess(args);
100289
+ }
100284
100290
  const key = {
100285
100291
  type: "basket",
100286
100292
  originator: normalizeOriginator(args.originator),
@@ -100318,6 +100324,20 @@ class LocalWalletPermissionsManager extends import_index_client.WalletPermission
100318
100324
  const grant = await this.permissionStore.findGrant(key);
100319
100325
  return !!grant && !isExpired(grant.expiry);
100320
100326
  }
100327
+ isAdminBasketUpstream(basket) {
100328
+ const fn = this.isAdminBasket;
100329
+ if (typeof fn !== "function") {
100330
+ throw new Error("LocalWalletPermissionsManager: super.isAdminBasket is unavailable; admin-basket checks would silently bypass");
100331
+ }
100332
+ return fn.call(this, basket);
100333
+ }
100334
+ isAdminProtocolUpstream(proto) {
100335
+ const fn = this.isAdminProtocol;
100336
+ if (typeof fn !== "function") {
100337
+ throw new Error("LocalWalletPermissionsManager: super.isAdminProtocol is unavailable; admin-protocol checks would silently bypass");
100338
+ }
100339
+ return fn.call(this, proto);
100340
+ }
100321
100341
  async grantPermission(params) {
100322
100342
  const request3 = this.pendingSingle.get(params.requestID);
100323
100343
  if (request3) {
@@ -100360,6 +100380,8 @@ class LocalWalletPermissionsManager extends import_index_client.WalletPermission
100360
100380
  for (const p of params.granted.protocolPermissions ?? []) {
100361
100381
  if (p.counterparty === "")
100362
100382
  continue;
100383
+ if (this.isAdminProtocolUpstream(p.protocolID))
100384
+ continue;
100363
100385
  const level = p.protocolID[0];
100364
100386
  const counterparty = level === 1 ? "" : p.counterparty ?? "self";
100365
100387
  await this.permissionStore.putGrant({
@@ -100377,6 +100399,8 @@ class LocalWalletPermissionsManager extends import_index_client.WalletPermission
100377
100399
  });
100378
100400
  }
100379
100401
  for (const b of params.granted.basketAccess ?? []) {
100402
+ if (this.isAdminBasketUpstream(b.basket))
100403
+ continue;
100380
100404
  await this.permissionStore.putGrant({
100381
100405
  key: { type: "basket", originator, basket: b.basket },
100382
100406
  expiry,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1sat/connect",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
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.63",
32
32
  "@sigma-auth/better-auth-plugin": "^0.0.84",
33
33
  "better-auth": "^1.5.4",
34
34
  "eventemitter3": "^5.0.1"