@1sat/connect 0.0.29 → 0.0.30
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/dist/index.js +69 -22
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -21000,7 +21000,7 @@ var init_https = __esm(() => {
|
|
|
21000
21000
|
https_default = https;
|
|
21001
21001
|
});
|
|
21002
21002
|
|
|
21003
|
-
// ../../node_modules/.bun/@bsv+wallet-toolbox@2.1.
|
|
21003
|
+
// ../../node_modules/.bun/@bsv+wallet-toolbox@2.1.21+1e0cb1bedf0614c6/node_modules/@bsv/wallet-toolbox/out/src/sdk/WalletError.js
|
|
21004
21004
|
var require_WalletError = __commonJS((exports) => {
|
|
21005
21005
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21006
21006
|
exports.WalletError = undefined;
|
|
@@ -40808,6 +40808,53 @@ function createSigmaCWI(config) {
|
|
|
40808
40808
|
};
|
|
40809
40809
|
return { wallet: createCWI(transport), destroy, sendCustomMessage };
|
|
40810
40810
|
}
|
|
40811
|
+
// ../wallet/dist/permissions/key.js
|
|
40812
|
+
function permissionKeyToString(key) {
|
|
40813
|
+
switch (key.type) {
|
|
40814
|
+
case "protocol":
|
|
40815
|
+
return `proto:${key.originator}:${key.privileged}:${key.protocolLevel},${key.protocolName}:${key.counterparty}`;
|
|
40816
|
+
case "basket":
|
|
40817
|
+
return `basket:${key.originator}:${key.basket}`;
|
|
40818
|
+
case "certificate":
|
|
40819
|
+
return `cert:${key.originator}:${key.privileged}:${key.verifier}:${key.certType}:${[...key.fields].sort().join("|")}`;
|
|
40820
|
+
case "spending":
|
|
40821
|
+
return `spend:${key.originator}`;
|
|
40822
|
+
}
|
|
40823
|
+
}
|
|
40824
|
+
// ../wallet/dist/permissions/in-memory-store.js
|
|
40825
|
+
class InMemoryPermissionStore {
|
|
40826
|
+
grants = new Map;
|
|
40827
|
+
async findGrant(key) {
|
|
40828
|
+
return this.grants.get(permissionKeyToString(key)) ?? null;
|
|
40829
|
+
}
|
|
40830
|
+
async putGrant(grant) {
|
|
40831
|
+
this.grants.set(permissionKeyToString(grant.key), grant);
|
|
40832
|
+
}
|
|
40833
|
+
async deleteGrant(key) {
|
|
40834
|
+
this.grants.delete(permissionKeyToString(key));
|
|
40835
|
+
}
|
|
40836
|
+
async deleteAllForOriginator(originator) {
|
|
40837
|
+
let removed = 0;
|
|
40838
|
+
for (const [id, grant] of this.grants) {
|
|
40839
|
+
if (grant.key.originator === originator) {
|
|
40840
|
+
this.grants.delete(id);
|
|
40841
|
+
removed++;
|
|
40842
|
+
}
|
|
40843
|
+
}
|
|
40844
|
+
return removed;
|
|
40845
|
+
}
|
|
40846
|
+
async listGrants(filter) {
|
|
40847
|
+
const out = [];
|
|
40848
|
+
for (const grant of this.grants.values()) {
|
|
40849
|
+
if (filter?.originator && grant.key.originator !== filter.originator)
|
|
40850
|
+
continue;
|
|
40851
|
+
if (filter?.type && grant.key.type !== filter.type)
|
|
40852
|
+
continue;
|
|
40853
|
+
out.push(grant);
|
|
40854
|
+
}
|
|
40855
|
+
return out;
|
|
40856
|
+
}
|
|
40857
|
+
}
|
|
40811
40858
|
// src/connectWallet.ts
|
|
40812
40859
|
var LAST_PROVIDER_KEY = "cwi_last_provider";
|
|
40813
40860
|
function saveLastProvider(providerType) {
|
|
@@ -41042,7 +41089,7 @@ var onMount = ($store, initialize) => {
|
|
|
41042
41089
|
};
|
|
41043
41090
|
});
|
|
41044
41091
|
};
|
|
41045
|
-
// ../../node_modules/.bun/better-auth@1.6.
|
|
41092
|
+
// ../../node_modules/.bun/better-auth@1.6.5+4ebdec0417783102/node_modules/better-auth/dist/client/query.mjs
|
|
41046
41093
|
var isServer = () => typeof window === "undefined";
|
|
41047
41094
|
var useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
41048
41095
|
const value = atom({
|
|
@@ -41255,7 +41302,7 @@ var InternalAPIError = class extends Error {
|
|
|
41255
41302
|
var kAPIErrorHeaderSymbol = Symbol.for("better-call:api-error-headers");
|
|
41256
41303
|
var APIError = makeErrorForHideStackFrame(InternalAPIError, Error);
|
|
41257
41304
|
|
|
41258
|
-
// ../../node_modules/.bun/@better-auth+core@1.6.
|
|
41305
|
+
// ../../node_modules/.bun/@better-auth+core@1.6.5+ffc25a14ebebf8ae/node_modules/@better-auth/core/dist/error/index.mjs
|
|
41259
41306
|
var BetterAuthError = class extends Error {
|
|
41260
41307
|
constructor(message, options) {
|
|
41261
41308
|
super(message, options);
|
|
@@ -41265,7 +41312,7 @@ var BetterAuthError = class extends Error {
|
|
|
41265
41312
|
}
|
|
41266
41313
|
};
|
|
41267
41314
|
|
|
41268
|
-
// ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+
|
|
41315
|
+
// ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+ec75ea420259e8cb/node_modules/@sigma-auth/better-auth-plugin/dist/client/local-signer.js
|
|
41269
41316
|
class LocalServerSigner {
|
|
41270
41317
|
baseUrl;
|
|
41271
41318
|
timeout;
|
|
@@ -41493,7 +41540,7 @@ class LocalServerSigner {
|
|
|
41493
41540
|
}
|
|
41494
41541
|
}
|
|
41495
41542
|
|
|
41496
|
-
// ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+
|
|
41543
|
+
// ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+ec75ea420259e8cb/node_modules/@sigma-auth/better-auth-plugin/dist/client/sigma-cwi.js
|
|
41497
41544
|
var isRecord3 = (v) => typeof v === "object" && v !== null;
|
|
41498
41545
|
var isResponse3 = (v) => isRecord3(v) && v.type === "CWI" && v.isInvocation === false && typeof v.id === "string";
|
|
41499
41546
|
var isState3 = (v) => isRecord3(v) && v.type === "CWI" && isRecord3(v.cwiState);
|
|
@@ -41734,7 +41781,7 @@ class SigmaCWISigner {
|
|
|
41734
41781
|
this.pending.clear();
|
|
41735
41782
|
}
|
|
41736
41783
|
}
|
|
41737
|
-
// ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+
|
|
41784
|
+
// ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+ec75ea420259e8cb/node_modules/@sigma-auth/better-auth-plugin/dist/client/signer.js
|
|
41738
41785
|
class SigmaIframeSigner {
|
|
41739
41786
|
iframe = null;
|
|
41740
41787
|
pendingRequests = new Map;
|
|
@@ -42132,7 +42179,7 @@ class SigmaIframeSigner {
|
|
|
42132
42179
|
this.rejectAllPending(new Error("Signer destroyed"));
|
|
42133
42180
|
}
|
|
42134
42181
|
}
|
|
42135
|
-
// ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+
|
|
42182
|
+
// ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+ec75ea420259e8cb/node_modules/@sigma-auth/better-auth-plugin/dist/client/index.js
|
|
42136
42183
|
var signer = null;
|
|
42137
42184
|
var signerType = null;
|
|
42138
42185
|
var storedBapId = null;
|
|
@@ -42640,7 +42687,7 @@ Backend: ${status} (${endpoint})`;
|
|
|
42640
42687
|
};
|
|
42641
42688
|
};
|
|
42642
42689
|
|
|
42643
|
-
// ../../node_modules/.bun/better-auth@1.6.
|
|
42690
|
+
// ../../node_modules/.bun/better-auth@1.6.5+4ebdec0417783102/node_modules/better-auth/dist/client/broadcast-channel.mjs
|
|
42644
42691
|
var kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
|
|
42645
42692
|
var now = () => Math.floor(Date.now() / 1000);
|
|
42646
42693
|
var WindowBroadcastChannel = class {
|
|
@@ -42688,7 +42735,7 @@ function getGlobalBroadcastChannel(name = "better-auth.message") {
|
|
|
42688
42735
|
return globalThis[kBroadcastChannel];
|
|
42689
42736
|
}
|
|
42690
42737
|
|
|
42691
|
-
// ../../node_modules/.bun/better-auth@1.6.
|
|
42738
|
+
// ../../node_modules/.bun/better-auth@1.6.5+4ebdec0417783102/node_modules/better-auth/dist/client/focus-manager.mjs
|
|
42692
42739
|
var kFocusManager = Symbol.for("better-auth:focus-manager");
|
|
42693
42740
|
var WindowFocusManager = class {
|
|
42694
42741
|
listeners = /* @__PURE__ */ new Set;
|
|
@@ -42720,7 +42767,7 @@ function getGlobalFocusManager() {
|
|
|
42720
42767
|
return globalThis[kFocusManager];
|
|
42721
42768
|
}
|
|
42722
42769
|
|
|
42723
|
-
// ../../node_modules/.bun/better-auth@1.6.
|
|
42770
|
+
// ../../node_modules/.bun/better-auth@1.6.5+4ebdec0417783102/node_modules/better-auth/dist/client/online-manager.mjs
|
|
42724
42771
|
var kOnlineManager = Symbol.for("better-auth:online-manager");
|
|
42725
42772
|
var WindowOnlineManager = class {
|
|
42726
42773
|
listeners = /* @__PURE__ */ new Set;
|
|
@@ -42754,7 +42801,7 @@ function getGlobalOnlineManager() {
|
|
|
42754
42801
|
return globalThis[kOnlineManager];
|
|
42755
42802
|
}
|
|
42756
42803
|
|
|
42757
|
-
// ../../node_modules/.bun/better-auth@1.6.
|
|
42804
|
+
// ../../node_modules/.bun/better-auth@1.6.5+4ebdec0417783102/node_modules/better-auth/dist/client/parser.mjs
|
|
42758
42805
|
var PROTO_POLLUTION_PATTERNS = {
|
|
42759
42806
|
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*:/,
|
|
42760
42807
|
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*:/,
|
|
@@ -42834,7 +42881,7 @@ function parseJSON(value, options = { strict: true }) {
|
|
|
42834
42881
|
return betterJSONParse(value, options);
|
|
42835
42882
|
}
|
|
42836
42883
|
|
|
42837
|
-
// ../../node_modules/.bun/better-auth@1.6.
|
|
42884
|
+
// ../../node_modules/.bun/better-auth@1.6.5+4ebdec0417783102/node_modules/better-auth/dist/client/session-refresh.mjs
|
|
42838
42885
|
var now2 = () => Math.floor(Date.now() / 1000);
|
|
42839
42886
|
function normalizeSessionResponse(res) {
|
|
42840
42887
|
if (typeof res === "object" && res !== null && "data" in res && "error" in res)
|
|
@@ -42974,7 +43021,7 @@ function createSessionRefreshManager(opts) {
|
|
|
42974
43021
|
};
|
|
42975
43022
|
}
|
|
42976
43023
|
|
|
42977
|
-
// ../../node_modules/.bun/@better-auth+core@1.6.
|
|
43024
|
+
// ../../node_modules/.bun/@better-auth+core@1.6.5+ffc25a14ebebf8ae/node_modules/@better-auth/core/dist/env/env-impl.mjs
|
|
42978
43025
|
var _envShim = Object.create(null);
|
|
42979
43026
|
var _getEnv = (useShim) => globalThis.process?.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (useShim ? _envShim : globalThis);
|
|
42980
43027
|
var env = new Proxy(_envShim, {
|
|
@@ -43034,7 +43081,7 @@ var ENV = Object.freeze({
|
|
|
43034
43081
|
return getEnvVar("BETTER_AUTH_TELEMETRY_ENDPOINT", "");
|
|
43035
43082
|
}
|
|
43036
43083
|
});
|
|
43037
|
-
// ../../node_modules/.bun/better-auth@1.6.
|
|
43084
|
+
// ../../node_modules/.bun/better-auth@1.6.5+4ebdec0417783102/node_modules/better-auth/dist/utils/url.mjs
|
|
43038
43085
|
function checkHasPath(url) {
|
|
43039
43086
|
try {
|
|
43040
43087
|
return (new URL(url).pathname.replace(/\/+$/, "") || "/") !== "/";
|
|
@@ -43118,7 +43165,7 @@ function getOrigin(url) {
|
|
|
43118
43165
|
}
|
|
43119
43166
|
}
|
|
43120
43167
|
|
|
43121
|
-
// ../../node_modules/.bun/better-auth@1.6.
|
|
43168
|
+
// ../../node_modules/.bun/better-auth@1.6.5+4ebdec0417783102/node_modules/better-auth/dist/client/fetch-plugins.mjs
|
|
43122
43169
|
var redirectPlugin = {
|
|
43123
43170
|
id: "redirect",
|
|
43124
43171
|
name: "Redirect",
|
|
@@ -43134,7 +43181,7 @@ var redirectPlugin = {
|
|
|
43134
43181
|
} }
|
|
43135
43182
|
};
|
|
43136
43183
|
|
|
43137
|
-
// ../../node_modules/.bun/better-auth@1.6.
|
|
43184
|
+
// ../../node_modules/.bun/better-auth@1.6.5+4ebdec0417783102/node_modules/better-auth/dist/client/session-atom.mjs
|
|
43138
43185
|
function getSessionAtom($fetch, options) {
|
|
43139
43186
|
const $signal = atom(false);
|
|
43140
43187
|
const session = useAuthQuery($signal, "/get-session", $fetch, { method: "GET" });
|
|
@@ -43790,7 +43837,7 @@ var betterFetch = async (url, options) => {
|
|
|
43790
43837
|
};
|
|
43791
43838
|
};
|
|
43792
43839
|
|
|
43793
|
-
// ../../node_modules/.bun/better-auth@1.6.
|
|
43840
|
+
// ../../node_modules/.bun/better-auth@1.6.5+4ebdec0417783102/node_modules/better-auth/dist/client/config.mjs
|
|
43794
43841
|
var resolvePublicAuthUrl = (basePath) => {
|
|
43795
43842
|
if (typeof process === "undefined")
|
|
43796
43843
|
return;
|
|
@@ -43858,7 +43905,7 @@ var getClientConfig = (options, loadEnv) => {
|
|
|
43858
43905
|
const atomListeners = [{
|
|
43859
43906
|
signal: "$sessionSignal",
|
|
43860
43907
|
matcher(path) {
|
|
43861
|
-
return path === "/sign-out" || path === "/update-user" || path === "/update-session" || path === "/sign-up/email" || path === "/sign-in/email" || path === "/delete-user" || path === "/verify-email" || path === "/revoke-sessions" || path === "/revoke-session" || path === "/change-email";
|
|
43908
|
+
return path === "/sign-out" || path === "/update-user" || path === "/update-session" || path === "/sign-up/email" || path === "/sign-in/email" || path === "/delete-user" || path === "/verify-email" || path === "/revoke-sessions" || path === "/revoke-session" || path === "/revoke-other-sessions" || path === "/change-email" || path === "/change-password";
|
|
43862
43909
|
},
|
|
43863
43910
|
callback(path) {
|
|
43864
43911
|
if (path === "/sign-out")
|
|
@@ -43900,12 +43947,12 @@ var getClientConfig = (options, loadEnv) => {
|
|
|
43900
43947
|
};
|
|
43901
43948
|
};
|
|
43902
43949
|
|
|
43903
|
-
// ../../node_modules/.bun/better-auth@1.6.
|
|
43950
|
+
// ../../node_modules/.bun/better-auth@1.6.5+4ebdec0417783102/node_modules/better-auth/dist/utils/is-atom.mjs
|
|
43904
43951
|
function isAtom(value) {
|
|
43905
43952
|
return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
|
|
43906
43953
|
}
|
|
43907
43954
|
|
|
43908
|
-
// ../../node_modules/.bun/better-auth@1.6.
|
|
43955
|
+
// ../../node_modules/.bun/better-auth@1.6.5+4ebdec0417783102/node_modules/better-auth/dist/client/proxy.mjs
|
|
43909
43956
|
function getMethod2(path, knownPathMethods, args) {
|
|
43910
43957
|
const method = knownPathMethods[path];
|
|
43911
43958
|
const { fetchOptions, query: _query, ...body } = args || {};
|
|
@@ -43987,12 +44034,12 @@ function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomLis
|
|
|
43987
44034
|
return createProxy();
|
|
43988
44035
|
}
|
|
43989
44036
|
|
|
43990
|
-
// ../../node_modules/.bun/@better-auth+core@1.6.
|
|
44037
|
+
// ../../node_modules/.bun/@better-auth+core@1.6.5+ffc25a14ebebf8ae/node_modules/@better-auth/core/dist/utils/string.mjs
|
|
43991
44038
|
function capitalizeFirstLetter(str) {
|
|
43992
44039
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
43993
44040
|
}
|
|
43994
44041
|
|
|
43995
|
-
// ../../node_modules/.bun/better-auth@1.6.
|
|
44042
|
+
// ../../node_modules/.bun/better-auth@1.6.5+4ebdec0417783102/node_modules/better-auth/dist/client/vanilla.mjs
|
|
43996
44043
|
function createAuthClient(options) {
|
|
43997
44044
|
const { pluginPathMethods, pluginsActions, pluginsAtoms, $fetch, atomListeners, $store } = getClientConfig(options);
|
|
43998
44045
|
const resolvedHooks = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1sat/connect",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"description": "Connection layer for 1Sat wallet - popup flow, events, session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
],
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@1sat/wallet": "0.0.
|
|
31
|
+
"@1sat/wallet": "0.0.41",
|
|
32
32
|
"@sigma-auth/better-auth-plugin": "^0.0.84",
|
|
33
33
|
"better-auth": "^1.5.4",
|
|
34
34
|
"eventemitter3": "^5.0.1"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@bsv/sdk": "^2.0.
|
|
37
|
+
"@bsv/sdk": "^2.0.13"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@bsv/sdk": "^2.0.
|
|
40
|
+
"@bsv/sdk": "^2.0.13",
|
|
41
41
|
"typescript": "^5.9.3"
|
|
42
42
|
}
|
|
43
43
|
}
|