@bounded-sh/client 0.0.50 → 0.0.51
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/auth/index.d.ts +8 -1
- package/dist/builds/types.d.ts +6 -0
- package/dist/{email-auth-provider-B7czfBEU.mjs → email-auth-provider-Bh2fDYcb.mjs} +2 -2
- package/dist/{email-auth-provider-DIZAETBC.mjs.map → email-auth-provider-Bh2fDYcb.mjs.map} +1 -1
- package/dist/{email-auth-provider-Dj66AuH0.js → email-auth-provider-Bm6vmoy3.js} +2 -2
- package/dist/{email-auth-provider-Dj66AuH0.js.map → email-auth-provider-Bm6vmoy3.js.map} +1 -1
- package/dist/{email-auth-provider-DIZAETBC.mjs → email-auth-provider-CdbhqElf.mjs} +2 -2
- package/dist/{email-auth-provider-B7czfBEU.mjs.map → email-auth-provider-CdbhqElf.mjs.map} +1 -1
- package/dist/{email-auth-provider-CmYs6Dcm.js → email-auth-provider-CnHsY8U-.js} +2 -2
- package/dist/{email-auth-provider-CmYs6Dcm.js.map → email-auth-provider-CnHsY8U-.js.map} +1 -1
- package/dist/global.d.ts +3 -3
- package/dist/{guest-auth-provider-B5sgg-q5.js → guest-auth-provider-CHqB_uN0.js} +2 -2
- package/dist/{guest-auth-provider-B5sgg-q5.js.map → guest-auth-provider-CHqB_uN0.js.map} +1 -1
- package/dist/{guest-auth-provider-BR0_YL8z.mjs → guest-auth-provider-Dgmr7e0Z.mjs} +2 -2
- package/dist/{guest-auth-provider-CCpNvX3j.mjs.map → guest-auth-provider-Dgmr7e0Z.mjs.map} +1 -1
- package/dist/{guest-auth-provider-CCpNvX3j.mjs → guest-auth-provider-Xir8zyfZ.mjs} +2 -2
- package/dist/{guest-auth-provider-BR0_YL8z.mjs.map → guest-auth-provider-Xir8zyfZ.mjs.map} +1 -1
- package/dist/{guest-auth-provider-CxsLCznO.js → guest-auth-provider-fjOMwfpW.js} +2 -2
- package/dist/{guest-auth-provider-CxsLCznO.js.map → guest-auth-provider-fjOMwfpW.js.map} +1 -1
- package/dist/{index-m42Be5Oj.js → index-BsrZb496.js} +63 -11
- package/dist/index-BsrZb496.js.map +1 -0
- package/dist/{index-BYy1tSkr.mjs → index-Cy0IRs6U.mjs} +63 -11
- package/dist/index-Cy0IRs6U.mjs.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{index.native-B-ldAbu2.mjs → index.native-B29WKXlr.mjs} +63 -11
- package/dist/index.native-B29WKXlr.mjs.map +1 -0
- package/dist/{index.native-BfoLJCZg.js → index.native-BaEZwiWd.js} +63 -11
- package/dist/index.native-BaEZwiWd.js.map +1 -0
- package/dist/index.native.js +1 -1
- package/dist/index.native.mjs +1 -1
- package/dist/{injected-evm-wallet-provider-BLQzWiBP.js → injected-evm-wallet-provider-CEWIg-_U.js} +2 -2
- package/dist/{injected-evm-wallet-provider-BLQzWiBP.js.map → injected-evm-wallet-provider-CEWIg-_U.js.map} +1 -1
- package/dist/{injected-evm-wallet-provider-BXj1YFaZ.js → injected-evm-wallet-provider-DUyX7Xj9.js} +2 -2
- package/dist/{injected-evm-wallet-provider-BXj1YFaZ.js.map → injected-evm-wallet-provider-DUyX7Xj9.js.map} +1 -1
- package/dist/{injected-evm-wallet-provider-ubsHX217.mjs → injected-evm-wallet-provider-DWnpa6Yx.mjs} +2 -2
- package/dist/{injected-evm-wallet-provider-ubsHX217.mjs.map → injected-evm-wallet-provider-DWnpa6Yx.mjs.map} +1 -1
- package/dist/{injected-evm-wallet-provider-sBCSkksr.mjs → injected-evm-wallet-provider-DkyIMRce.mjs} +2 -2
- package/dist/{injected-evm-wallet-provider-sBCSkksr.mjs.map → injected-evm-wallet-provider-DkyIMRce.mjs.map} +1 -1
- package/dist/{injected-wallet-provider-PYcvLO2Z.js → injected-wallet-provider-C65NiItg.js} +2 -2
- package/dist/{injected-wallet-provider-PYcvLO2Z.js.map → injected-wallet-provider-C65NiItg.js.map} +1 -1
- package/dist/{injected-wallet-provider-Cml9TkyV.js → injected-wallet-provider-DpJvuK73.js} +2 -2
- package/dist/{injected-wallet-provider-Cml9TkyV.js.map → injected-wallet-provider-DpJvuK73.js.map} +1 -1
- package/dist/{injected-wallet-provider-BfzoheDy.mjs → injected-wallet-provider-DqBpuASt.mjs} +2 -2
- package/dist/{injected-wallet-provider-BfzoheDy.mjs.map → injected-wallet-provider-DqBpuASt.mjs.map} +1 -1
- package/dist/{injected-wallet-provider-DG87X6AQ.mjs → injected-wallet-provider-DsesEVnZ.mjs} +2 -2
- package/dist/{injected-wallet-provider-DG87X6AQ.mjs.map → injected-wallet-provider-DsesEVnZ.mjs.map} +1 -1
- package/package.json +2 -2
- package/dist/index-BYy1tSkr.mjs.map +0 -1
- package/dist/index-m42Be5Oj.js.map +0 -1
- package/dist/index.native-B-ldAbu2.mjs.map +0 -1
- package/dist/index.native-BfoLJCZg.js.map +0 -1
|
@@ -4466,7 +4466,7 @@ async function getAuthProvider(config) {
|
|
|
4466
4466
|
// manager as legacy email sessions. Human login should be started
|
|
4467
4467
|
// with loginWithRedirect(); this provider is kept as the restore and
|
|
4468
4468
|
// logout surface for those sessions.
|
|
4469
|
-
currentAuthProvider = new (await Promise.resolve().then(function () { return require('./email-auth-provider-
|
|
4469
|
+
currentAuthProvider = new (await Promise.resolve().then(function () { return require('./email-auth-provider-CnHsY8U-.js'); })).EmailAuthProvider();
|
|
4470
4470
|
break;
|
|
4471
4471
|
case "wallet":
|
|
4472
4472
|
case "phantom": {
|
|
@@ -4485,7 +4485,7 @@ async function getAuthProvider(config) {
|
|
|
4485
4485
|
if (!isWalletLoginEnabled(config)) {
|
|
4486
4486
|
throw walletLoginNotEnabledError(authMethod);
|
|
4487
4487
|
}
|
|
4488
|
-
const { InjectedWalletProvider } = await Promise.resolve().then(function () { return require('./injected-wallet-provider-
|
|
4488
|
+
const { InjectedWalletProvider } = await Promise.resolve().then(function () { return require('./injected-wallet-provider-C65NiItg.js'); });
|
|
4489
4489
|
currentAuthProvider = new InjectedWalletProvider(resolveInjectedWalletConfig(config), rpcUrl, configuredNetwork);
|
|
4490
4490
|
break;
|
|
4491
4491
|
}
|
|
@@ -4498,7 +4498,7 @@ async function getAuthProvider(config) {
|
|
|
4498
4498
|
// Selecting authMethod:'evm-wallet' IS the opt-in — pass evmWalletConfig
|
|
4499
4499
|
// to point at a specific wallet or set chainId/domain.
|
|
4500
4500
|
const evmWalletConfig = ((_a = config.evmWalletConfig) !== null && _a !== void 0 ? _a : {});
|
|
4501
|
-
const { InjectedEvmWalletProvider } = await Promise.resolve().then(function () { return require('./injected-evm-wallet-provider-
|
|
4501
|
+
const { InjectedEvmWalletProvider } = await Promise.resolve().then(function () { return require('./injected-evm-wallet-provider-DUyX7Xj9.js'); });
|
|
4502
4502
|
currentAuthProvider = new InjectedEvmWalletProvider(evmWalletConfig);
|
|
4503
4503
|
break;
|
|
4504
4504
|
}
|
|
@@ -4526,7 +4526,7 @@ async function getAuthProvider(config) {
|
|
|
4526
4526
|
break;
|
|
4527
4527
|
case "guest":
|
|
4528
4528
|
// Anonymous auth: a device-local ed25519 keypair signs the challenge.
|
|
4529
|
-
currentAuthProvider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-
|
|
4529
|
+
currentAuthProvider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-fjOMwfpW.js'); })).GuestAuthProvider();
|
|
4530
4530
|
break;
|
|
4531
4531
|
}
|
|
4532
4532
|
if (!currentAuthProvider) {
|
|
@@ -4582,7 +4582,7 @@ async function signInAnonymously() {
|
|
|
4582
4582
|
// Lazy-load the guest provider so its ed25519/web3 dependencies stay out of
|
|
4583
4583
|
// the main bundle for data-only apps. Specifier is a static string literal
|
|
4584
4584
|
// so bundle-splitting can see it.
|
|
4585
|
-
const provider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-
|
|
4585
|
+
const provider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-fjOMwfpW.js'); })).GuestAuthProvider();
|
|
4586
4586
|
setAuthLoading(true); // reflect "signing in…" while the guest keypair session is minted
|
|
4587
4587
|
const commit = (user) => {
|
|
4588
4588
|
// No await/interleaving inside this block: provider/method/config/marker
|
|
@@ -4758,8 +4758,45 @@ async function login$1(options) {
|
|
|
4758
4758
|
function getCurrentAuthMethod() {
|
|
4759
4759
|
return currentAuthMethod;
|
|
4760
4760
|
}
|
|
4761
|
-
|
|
4762
|
-
|
|
4761
|
+
// The hosted issuer keeps its OWN browser session (the Better Auth cookie on
|
|
4762
|
+
// auth.bounded.sh) — clearing the app-local session alone leaves it alive, so
|
|
4763
|
+
// the next loginWithRedirect() silently re-signs the user in as the SAME
|
|
4764
|
+
// account: "sign out" that never lets you re-choose. The issuer ships
|
|
4765
|
+
// GET /logout for exactly this — it expires the session cookies and bounces
|
|
4766
|
+
// back — but it only redirects to https origins it trusts. Mirror that
|
|
4767
|
+
// allowlist here: on a trusted origin we end the issuer session with a
|
|
4768
|
+
// top-level bounce; anywhere else (custom domains, http dev) we keep the
|
|
4769
|
+
// local-only logout instead of stranding the user on the issuer origin.
|
|
4770
|
+
function issuerLogoutBounceUrl(issuerBase) {
|
|
4771
|
+
if (typeof window === 'undefined' || typeof document === 'undefined')
|
|
4772
|
+
return null; // RN/Node: no shared cookie jar to clear this way
|
|
4773
|
+
try {
|
|
4774
|
+
if (window.top !== window.self)
|
|
4775
|
+
return null; // framed: SameSite=Lax cookies don't ride iframe navigations
|
|
4776
|
+
}
|
|
4777
|
+
catch (_a) {
|
|
4778
|
+
return null;
|
|
4779
|
+
}
|
|
4780
|
+
try {
|
|
4781
|
+
const here = new URL(window.location.href);
|
|
4782
|
+
const host = here.hostname;
|
|
4783
|
+
const isLocalhost = host === 'localhost' || host === '127.0.0.1' || host.endsWith('.localhost');
|
|
4784
|
+
const trusted = here.protocol === 'https:' &&
|
|
4785
|
+
(host === 'bounded.sh' ||
|
|
4786
|
+
host.endsWith('.bounded.sh') ||
|
|
4787
|
+
host.endsWith('.bounded.page') ||
|
|
4788
|
+
host.endsWith('.oapps.fun') ||
|
|
4789
|
+
isLocalhost);
|
|
4790
|
+
if (!trusted)
|
|
4791
|
+
return null;
|
|
4792
|
+
const base = issuerBase.replace(/\/$/, '');
|
|
4793
|
+
return `${base}/logout?redirect_uri=${encodeURIComponent(here.href)}`;
|
|
4794
|
+
}
|
|
4795
|
+
catch (_b) {
|
|
4796
|
+
return null;
|
|
4797
|
+
}
|
|
4798
|
+
}
|
|
4799
|
+
async function logout$1(options) {
|
|
4763
4800
|
// Re-initialize the provider if it was cleared by a prior logout — the exact mirror
|
|
4764
4801
|
// of login()'s self-heal above. A hosted popup/redirect login (loginWithPopup /
|
|
4765
4802
|
// completeLoginFromRedirect) establishes a session WITHOUT touching the provider
|
|
@@ -4782,13 +4819,28 @@ async function logout$1() {
|
|
|
4782
4819
|
// mistake a local-only logout for server revocation.
|
|
4783
4820
|
const sm = core.getActiveSessionManager();
|
|
4784
4821
|
const refreshToken = sm.getRefreshToken();
|
|
4822
|
+
const sessionIssuer = sm.getIssuer();
|
|
4785
4823
|
if (refreshToken)
|
|
4786
|
-
await core.revokeSession(refreshToken,
|
|
4824
|
+
await core.revokeSession(refreshToken, sessionIssuer !== null && sessionIssuer !== void 0 ? sessionIssuer : undefined);
|
|
4825
|
+
// Hosted sessions ('email' covers the whole hosted surface: email OTP +
|
|
4826
|
+
// social + the OIDC redirect/popup flows) are the ones with an issuer
|
|
4827
|
+
// cookie; wallet and guest sessions have nothing hosted to end.
|
|
4828
|
+
const wasHosted = (currentAuthMethod !== null && currentAuthMethod !== void 0 ? currentAuthMethod : getStoredAuthMethod()) === 'email';
|
|
4787
4829
|
await currentAuthProvider.logout();
|
|
4788
4830
|
setStoredAuthMethod(null);
|
|
4789
4831
|
currentAuthProvider = null;
|
|
4790
4832
|
currentAuthMethod = null;
|
|
4791
4833
|
currentAuthProviderConfigKey = null;
|
|
4834
|
+
if (wasHosted && !(options === null || options === void 0 ? void 0 : options.keepIssuerSession)) {
|
|
4835
|
+
const issuerBase = sessionIssuer
|
|
4836
|
+
|| (await core.getConfig()).humanAuthApiUrl
|
|
4837
|
+
|| 'https://auth.bounded.sh';
|
|
4838
|
+
const bounce = issuerLogoutBounceUrl(issuerBase);
|
|
4839
|
+
// Local state is already cleared, so even if the navigation is stopped
|
|
4840
|
+
// (tab close, extension) the app-side logout has fully happened.
|
|
4841
|
+
if (bounce)
|
|
4842
|
+
window.location.href = bounce;
|
|
4843
|
+
}
|
|
4792
4844
|
}
|
|
4793
4845
|
|
|
4794
4846
|
/**
|
|
@@ -4918,11 +4970,11 @@ async function login(options) {
|
|
|
4918
4970
|
setCurrentUser(loggedInUser);
|
|
4919
4971
|
return currentUser;
|
|
4920
4972
|
}
|
|
4921
|
-
async function logout() {
|
|
4973
|
+
async function logout(options) {
|
|
4922
4974
|
if (!authProviderInstance) {
|
|
4923
4975
|
throw new Error('SDK not initialized. Please call init() first.');
|
|
4924
4976
|
}
|
|
4925
|
-
await logout$1();
|
|
4977
|
+
await logout$1(options);
|
|
4926
4978
|
setCurrentUser(null);
|
|
4927
4979
|
}
|
|
4928
4980
|
var hasRunFirstTime = false;
|
|
@@ -6032,4 +6084,4 @@ exports.setPlatform = setPlatform;
|
|
|
6032
6084
|
exports.signInAnonymously = signInAnonymously;
|
|
6033
6085
|
exports.useAuth = useAuth;
|
|
6034
6086
|
exports.useBuildRun = useBuildRun;
|
|
6035
|
-
//# sourceMappingURL=index.native-
|
|
6087
|
+
//# sourceMappingURL=index.native-BaEZwiWd.js.map
|