@bounded-sh/client 0.0.20 → 0.0.22
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/README.md +2 -2
- package/dist/index.js +159 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +159 -33
- package/dist/index.mjs.map +1 -1
- package/dist/{index.native-BtM38BVP.js → index.native-C4a8IUpM.js} +163 -37
- package/dist/index.native-C4a8IUpM.js.map +1 -0
- package/dist/{index.native-w12aoVNW.mjs → index.native-C9PMGtxX.mjs} +163 -37
- package/dist/index.native-C9PMGtxX.mjs.map +1 -0
- package/dist/index.native.js +1 -1
- package/dist/index.native.mjs +1 -1
- package/dist/{phantom-wallet-provider-BJWelaiH.js → phantom-wallet-provider-BPRRcIaN.js} +2 -2
- package/dist/{phantom-wallet-provider-BJWelaiH.js.map → phantom-wallet-provider-BPRRcIaN.js.map} +1 -1
- package/dist/{phantom-wallet-provider-BT2V4EU5.mjs → phantom-wallet-provider-DhpV9xKE.mjs} +2 -2
- package/dist/{phantom-wallet-provider-BT2V4EU5.mjs.map → phantom-wallet-provider-DhpV9xKE.mjs.map} +1 -1
- package/dist/{privy-wallet-provider-LV1X7hZe.mjs → privy-wallet-provider-B6QyPXqq.mjs} +3 -3
- package/dist/{privy-wallet-provider-LV1X7hZe.mjs.map → privy-wallet-provider-B6QyPXqq.mjs.map} +1 -1
- package/dist/{privy-wallet-provider-BSh0aZVL.js → privy-wallet-provider-D4W91sqG.js} +3 -3
- package/dist/{privy-wallet-provider-BSh0aZVL.js.map → privy-wallet-provider-D4W91sqG.js.map} +1 -1
- package/dist/{solana-mobile-wallet-provider-CKsfiyDd.js → solana-mobile-wallet-provider-B0O0BctB.js} +2 -2
- package/dist/{solana-mobile-wallet-provider-CKsfiyDd.js.map → solana-mobile-wallet-provider-B0O0BctB.js.map} +1 -1
- package/dist/{solana-mobile-wallet-provider-NLe9_mEn.mjs → solana-mobile-wallet-provider-OGKifgCZ.mjs} +2 -2
- package/dist/{solana-mobile-wallet-provider-NLe9_mEn.mjs.map → solana-mobile-wallet-provider-OGKifgCZ.mjs.map} +1 -1
- package/package.json +2 -2
- package/dist/index.native-BtM38BVP.js.map +0 -1
- package/dist/index.native-w12aoVNW.mjs.map +0 -1
|
@@ -3987,13 +3987,44 @@ function createEmailModalTree() {
|
|
|
3987
3987
|
close.type = 'button';
|
|
3988
3988
|
close.textContent = '×';
|
|
3989
3989
|
card.appendChild(close);
|
|
3990
|
+
// Brand row — the real Bounded mark (same geometry as bounded.sh) + wordmark.
|
|
3990
3991
|
const brand = document.createElement('div');
|
|
3991
3992
|
brand.className = 'ba-brand';
|
|
3992
|
-
const
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3993
|
+
const mark = document.createElement('span');
|
|
3994
|
+
mark.className = 'ba-mark';
|
|
3995
|
+
mark.setAttribute('aria-hidden', 'true');
|
|
3996
|
+
const svgNs = 'http://www.w3.org/2000/svg';
|
|
3997
|
+
const markSvg = document.createElementNS(svgNs, 'svg');
|
|
3998
|
+
markSvg.setAttribute('width', '24');
|
|
3999
|
+
markSvg.setAttribute('height', '24');
|
|
4000
|
+
markSvg.setAttribute('viewBox', '0 0 32 32');
|
|
4001
|
+
markSvg.setAttribute('fill', 'none');
|
|
4002
|
+
for (const [className, d] of [
|
|
4003
|
+
['ba-c ba-c1', 'M16 5 H5 V16'],
|
|
4004
|
+
['ba-c ba-c2', 'M16 5 H27 V16'],
|
|
4005
|
+
['ba-c ba-c3', 'M5 16 V27 H16'],
|
|
4006
|
+
['ba-c ba-c4', 'M27 16 V27 H16'],
|
|
4007
|
+
]) {
|
|
4008
|
+
const path = document.createElementNS(svgNs, 'path');
|
|
4009
|
+
path.setAttribute('class', className);
|
|
4010
|
+
path.setAttribute('d', d);
|
|
4011
|
+
markSvg.appendChild(path);
|
|
4012
|
+
}
|
|
4013
|
+
mark.appendChild(markSvg);
|
|
4014
|
+
brand.appendChild(mark);
|
|
4015
|
+
const word = document.createElement('span');
|
|
4016
|
+
word.className = 'ba-word';
|
|
4017
|
+
word.textContent = 'bounded';
|
|
4018
|
+
brand.appendChild(word);
|
|
3996
4019
|
card.appendChild(brand);
|
|
4020
|
+
const title = document.createElement('h1');
|
|
4021
|
+
title.className = 'ba-title';
|
|
4022
|
+
title.textContent = 'Sign in';
|
|
4023
|
+
card.appendChild(title);
|
|
4024
|
+
const sub = document.createElement('p');
|
|
4025
|
+
sub.className = 'ba-subtitle';
|
|
4026
|
+
sub.textContent = 'Continue with your email — no wallet needed.';
|
|
4027
|
+
card.appendChild(sub);
|
|
3997
4028
|
const emailStep = document.createElement('div');
|
|
3998
4029
|
emailStep.id = 'ba-email-step';
|
|
3999
4030
|
card.appendChild(emailStep);
|
|
@@ -4014,7 +4045,7 @@ function createEmailModalTree() {
|
|
|
4014
4045
|
emailButton.id = 'ba-email-btn';
|
|
4015
4046
|
emailButton.className = 'ba-btn';
|
|
4016
4047
|
emailButton.type = 'button';
|
|
4017
|
-
emailButton.textContent = 'Continue';
|
|
4048
|
+
emailButton.textContent = 'Continue with email';
|
|
4018
4049
|
emailStep.appendChild(emailButton);
|
|
4019
4050
|
const otpStep = document.createElement('div');
|
|
4020
4051
|
otpStep.id = 'ba-otp-step';
|
|
@@ -4059,37 +4090,67 @@ function createEmailModalTree() {
|
|
|
4059
4090
|
card.appendChild(foot);
|
|
4060
4091
|
return root;
|
|
4061
4092
|
}
|
|
4093
|
+
// Design language matches the hosted Bounded login (auth.bounded.sh) and bounded.sh:
|
|
4094
|
+
// dark editorial panel, green accent, Schibsted Grotesk / Newsreader / JetBrains Mono,
|
|
4095
|
+
// the Bounded mark drawing itself in. Fonts load best-effort (scoped @import); every
|
|
4096
|
+
// rule has a system fallback so the modal looks right even if Google Fonts is blocked.
|
|
4097
|
+
// All selectors are scoped under #bounded-auth-modal so we never leak into the host page.
|
|
4062
4098
|
const MODAL_CSS = `
|
|
4063
|
-
|
|
4099
|
+
@import url('https://fonts.googleapis.com/css2?family=Newsreader:opsz,wght@6..72,400;6..72,500&family=Schibsted+Grotesk:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');
|
|
4100
|
+
#bounded-auth-modal{--ba-bg:#0a0a0b;--ba-panel:#0e0f11;--ba-inset:#060607;--ba-raise:#131416;
|
|
4101
|
+
--ba-line:rgba(232,230,222,.08);--ba-line-strong:rgba(232,230,222,.16);
|
|
4102
|
+
--ba-text:#e8e6de;--ba-dim:#9b9991;--ba-faint:#85837c;--ba-green:#58c98f;
|
|
4103
|
+
--ba-green-bg:rgba(88,201,143,.09);--ba-green-line:rgba(88,201,143,.28);--ba-red:#ec8488;
|
|
4104
|
+
--ba-body:'Schibsted Grotesk',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;
|
|
4105
|
+
--ba-display:'Newsreader','Iowan Old Style',Georgia,serif;
|
|
4106
|
+
--ba-mono:'JetBrains Mono',ui-monospace,'SF Mono',Menlo,monospace;}
|
|
4107
|
+
#bounded-auth-modal .ba-overlay{position:fixed;inset:0;background:rgba(6,6,7,.66);backdrop-filter:blur(4px);
|
|
4064
4108
|
display:flex;align-items:center;justify-content:center;z-index:2147483000;opacity:1;transition:opacity .16s ease;
|
|
4065
|
-
font-family
|
|
4109
|
+
font-family:var(--ba-body);padding:16px;}
|
|
4066
4110
|
#bounded-auth-modal .ba-overlay.out{opacity:0;}
|
|
4067
|
-
#bounded-auth-modal
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
#bounded-auth-modal .ba-
|
|
4076
|
-
#bounded-auth-modal .ba-
|
|
4077
|
-
#bounded-auth-modal .ba-
|
|
4078
|
-
#bounded-auth-modal .ba-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
#bounded-auth-modal .ba-
|
|
4082
|
-
#bounded-auth-modal .ba-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
#bounded-auth-modal .ba-
|
|
4086
|
-
#bounded-auth-modal .ba-
|
|
4087
|
-
#bounded-auth-modal .ba-
|
|
4088
|
-
#bounded-auth-modal .ba-
|
|
4089
|
-
#bounded-auth-modal .ba-
|
|
4090
|
-
#bounded-auth-modal .ba-
|
|
4111
|
+
#bounded-auth-modal *{box-sizing:border-box;}
|
|
4112
|
+
#bounded-auth-modal .ba-card{width:100%;max-width:372px;background:var(--ba-panel);color:var(--ba-text);
|
|
4113
|
+
border:1px solid var(--ba-line);border-radius:12px;padding:28px 28px 22px;position:relative;
|
|
4114
|
+
box-shadow:0 1px 0 rgba(232,230,222,.03) inset,0 30px 80px -40px rgba(0,0,0,.8);animation:ba-in .18s ease;}
|
|
4115
|
+
@keyframes ba-in{from{transform:translateY(8px);opacity:.5}to{transform:translateY(0);opacity:1}}
|
|
4116
|
+
#bounded-auth-modal .ba-x{position:absolute;top:14px;right:14px;width:28px;height:28px;border:1px solid var(--ba-line);
|
|
4117
|
+
background:var(--ba-raise);color:var(--ba-faint);border-radius:7px;font-size:18px;line-height:1;cursor:pointer;
|
|
4118
|
+
transition:color .15s,border-color .15s;}
|
|
4119
|
+
#bounded-auth-modal .ba-x:hover{color:var(--ba-text);border-color:var(--ba-faint);}
|
|
4120
|
+
#bounded-auth-modal .ba-brand{display:flex;align-items:center;gap:10px;margin:0 0 24px;}
|
|
4121
|
+
#bounded-auth-modal .ba-mark{display:flex;color:var(--ba-text);}
|
|
4122
|
+
#bounded-auth-modal .ba-mark svg{overflow:visible;display:block;}
|
|
4123
|
+
#bounded-auth-modal .ba-c{stroke:currentColor;stroke-width:2.4;fill:none;}
|
|
4124
|
+
@media (prefers-reduced-motion:no-preference){
|
|
4125
|
+
#bounded-auth-modal .ba-c{stroke-dasharray:23;stroke-dashoffset:23;animation:ba-draw .4s cubic-bezier(.45,0,.2,1) forwards;}
|
|
4126
|
+
#bounded-auth-modal .ba-c1{animation-delay:.1s}#bounded-auth-modal .ba-c2{animation-delay:.38s}
|
|
4127
|
+
#bounded-auth-modal .ba-c3{animation-delay:.66s}#bounded-auth-modal .ba-c4{animation-delay:.94s}}
|
|
4128
|
+
@keyframes ba-draw{to{stroke-dashoffset:0}}
|
|
4129
|
+
#bounded-auth-modal .ba-word{font-family:var(--ba-body);font-weight:500;font-size:15px;letter-spacing:.2px;color:var(--ba-text);}
|
|
4130
|
+
#bounded-auth-modal .ba-title{font-family:var(--ba-display);font-weight:400;font-size:25px;letter-spacing:-.01em;margin:0 0 5px;}
|
|
4131
|
+
#bounded-auth-modal .ba-subtitle{color:var(--ba-dim);font-size:14px;margin:0 0 22px;}
|
|
4132
|
+
#bounded-auth-modal .ba-label{display:block;font-size:12px;color:var(--ba-dim);margin:0 0 7px;}
|
|
4133
|
+
#bounded-auth-modal .ba-em{color:var(--ba-text);font-weight:600;}
|
|
4134
|
+
#bounded-auth-modal .ba-input{width:100%;background:var(--ba-inset);border:1px solid var(--ba-line-strong);color:var(--ba-text);
|
|
4135
|
+
border-radius:6px;padding:11px 13px;font-family:var(--ba-body);font-size:15px;outline:none;transition:border-color .15s,box-shadow .15s;}
|
|
4136
|
+
#bounded-auth-modal .ba-input::placeholder{color:var(--ba-faint);}
|
|
4137
|
+
#bounded-auth-modal .ba-input:focus{border-color:var(--ba-green-line);box-shadow:0 0 0 3px var(--ba-green-bg);}
|
|
4138
|
+
#bounded-auth-modal .ba-code{font-family:var(--ba-mono);letter-spacing:8px;text-align:center;font-size:21px;padding-left:8px;}
|
|
4139
|
+
#bounded-auth-modal .ba-btn{width:100%;margin-top:16px;background:var(--ba-text);color:var(--ba-bg);
|
|
4140
|
+
border:0;border-radius:6px;padding:12px;font-family:var(--ba-body);font-size:14px;font-weight:600;cursor:pointer;
|
|
4141
|
+
transition:opacity .15s,transform .04s;}
|
|
4142
|
+
#bounded-auth-modal .ba-btn:hover{opacity:.9;}
|
|
4143
|
+
#bounded-auth-modal .ba-btn:active{transform:translateY(.5px);}
|
|
4144
|
+
#bounded-auth-modal .ba-btn:disabled{opacity:.45;cursor:default;}
|
|
4145
|
+
#bounded-auth-modal .ba-link{width:100%;margin-top:14px;background:none;border:none;color:var(--ba-dim);
|
|
4146
|
+
font-family:var(--ba-body);font-size:12.5px;cursor:pointer;}
|
|
4147
|
+
#bounded-auth-modal .ba-link:hover{color:var(--ba-text);}
|
|
4148
|
+
#bounded-auth-modal .ba-msg{min-height:16px;margin-top:16px;font-size:12.5px;color:var(--ba-dim);text-align:center;}
|
|
4149
|
+
#bounded-auth-modal .ba-msg.err{color:var(--ba-red);}
|
|
4150
|
+
#bounded-auth-modal .ba-foot{margin-top:26px;padding-top:16px;border-top:1px solid var(--ba-line);
|
|
4151
|
+
text-align:center;font-size:11px;color:var(--ba-faint);}
|
|
4091
4152
|
#bounded-auth-modal .hidden{display:none;}
|
|
4092
|
-
@media (max-width:480px){#bounded-auth-modal .ba-card{max-width:none;
|
|
4153
|
+
@media (max-width:480px){#bounded-auth-modal .ba-card{max-width:none;}}`;
|
|
4093
4154
|
|
|
4094
4155
|
const SURFNET_RPC_URL = "https://surfpool.fly.dev";
|
|
4095
4156
|
const SUPPORTED_SOLANA_NETWORKS = new Set([
|
|
@@ -4136,6 +4197,7 @@ function resolveSolanaRpcUrl(explicitRpcUrl, network, context) {
|
|
|
4136
4197
|
}
|
|
4137
4198
|
|
|
4138
4199
|
const PKCE_STORE_KEY = 'bounded.oidc.pkce';
|
|
4200
|
+
const STORED_AUTH_METHOD_KEY$1 = 'bounded_last_auth_method';
|
|
4139
4201
|
// Active session store (Web on web, RN on React Native) — selected by config,
|
|
4140
4202
|
// not by `typeof window` (truthy on RN). OIDC redirect/popup is web-only, but the
|
|
4141
4203
|
// session it mints is read back through this same selector everywhere.
|
|
@@ -4430,6 +4492,10 @@ async function exchangeCode(code, verifier, redirectUri) {
|
|
|
4430
4492
|
const refreshToken = tokenField(data, 'refresh_token', 'refreshToken');
|
|
4431
4493
|
const user = userFromIdToken(idToken);
|
|
4432
4494
|
await sessionManager().storeSession(String(user.address || ''), accessToken, idToken, refreshToken, base);
|
|
4495
|
+
try {
|
|
4496
|
+
getPlatform().storage.setItem(STORED_AUTH_METHOD_KEY$1, 'email');
|
|
4497
|
+
}
|
|
4498
|
+
catch ( /* storage unavailable */_b) { /* storage unavailable */ }
|
|
4433
4499
|
setCurrentUser(user);
|
|
4434
4500
|
setAuthProviderInstance(oidcProviderSingleton);
|
|
4435
4501
|
return user;
|
|
@@ -4440,7 +4506,10 @@ async function exchangeCode(code, verifier, redirectUri) {
|
|
|
4440
4506
|
// (react-dom) when this module is imported on RN.
|
|
4441
4507
|
let currentAuthProvider = null;
|
|
4442
4508
|
let currentAuthMethod = null;
|
|
4509
|
+
let currentAuthProviderConfigKey = null;
|
|
4443
4510
|
let initConfig = null;
|
|
4511
|
+
const objectIdentityKeys = new WeakMap();
|
|
4512
|
+
let nextObjectIdentityKey = 1;
|
|
4444
4513
|
// --- localStorage helpers: track which auth method created the active session ---
|
|
4445
4514
|
const STORED_AUTH_METHOD_KEY = 'bounded_last_auth_method';
|
|
4446
4515
|
function getStoredAuthMethod() {
|
|
@@ -4464,6 +4533,51 @@ function setStoredAuthMethod(method) {
|
|
|
4464
4533
|
// storage might not be available
|
|
4465
4534
|
}
|
|
4466
4535
|
}
|
|
4536
|
+
function objectIdentityKey(value) {
|
|
4537
|
+
if (!value || (typeof value !== 'object' && typeof value !== 'function'))
|
|
4538
|
+
return null;
|
|
4539
|
+
const obj = value;
|
|
4540
|
+
let id = objectIdentityKeys.get(obj);
|
|
4541
|
+
if (!id) {
|
|
4542
|
+
id = nextObjectIdentityKey++;
|
|
4543
|
+
objectIdentityKeys.set(obj, id);
|
|
4544
|
+
}
|
|
4545
|
+
return `object:${id}`;
|
|
4546
|
+
}
|
|
4547
|
+
function stableConfigValue(value, seen = new WeakSet()) {
|
|
4548
|
+
if (value === null || typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean')
|
|
4549
|
+
return value;
|
|
4550
|
+
if (typeof value === 'function')
|
|
4551
|
+
return '[function]';
|
|
4552
|
+
if (Array.isArray(value))
|
|
4553
|
+
return value.map((item) => stableConfigValue(item, seen));
|
|
4554
|
+
if (typeof value === 'object') {
|
|
4555
|
+
if (seen.has(value))
|
|
4556
|
+
return '[circular]';
|
|
4557
|
+
seen.add(value);
|
|
4558
|
+
const out = {};
|
|
4559
|
+
for (const key of Object.keys(value).sort()) {
|
|
4560
|
+
out[key] = stableConfigValue(value[key], seen);
|
|
4561
|
+
}
|
|
4562
|
+
seen.delete(value);
|
|
4563
|
+
return out;
|
|
4564
|
+
}
|
|
4565
|
+
return String(value);
|
|
4566
|
+
}
|
|
4567
|
+
function authProviderConfigKey(config) {
|
|
4568
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4569
|
+
return JSON.stringify({
|
|
4570
|
+
authMethod: (_a = config.authMethod) !== null && _a !== void 0 ? _a : null,
|
|
4571
|
+
chain: (_b = config.chain) !== null && _b !== void 0 ? _b : null,
|
|
4572
|
+
rpcUrl: normalizeSolanaRpcUrl(config.rpcUrl),
|
|
4573
|
+
name: (_c = config.name) !== null && _c !== void 0 ? _c : null,
|
|
4574
|
+
logoUrl: (_d = config.logoUrl) !== null && _d !== void 0 ? _d : null,
|
|
4575
|
+
phantomConfig: stableConfigValue((_e = config.phantomConfig) !== null && _e !== void 0 ? _e : null),
|
|
4576
|
+
privyConfig: stableConfigValue((_f = config.privyConfig) !== null && _f !== void 0 ? _f : null),
|
|
4577
|
+
mobileWalletConfig: stableConfigValue((_g = config.mobileWalletConfig) !== null && _g !== void 0 ? _g : null),
|
|
4578
|
+
privyExpoProvider: objectIdentityKey((_h = config.privyExpoProvider) !== null && _h !== void 0 ? _h : null),
|
|
4579
|
+
});
|
|
4580
|
+
}
|
|
4467
4581
|
/**
|
|
4468
4582
|
* Clears the session if it was created by a different auth method.
|
|
4469
4583
|
* Returns true if the session was cleared, false if the session is compatible.
|
|
@@ -4489,17 +4603,17 @@ function clearIncompatibleSession() {
|
|
|
4489
4603
|
// Lazy loaders for web-only providers.
|
|
4490
4604
|
// Using dynamic import() ensures Metro (RN) never resolves these modules.
|
|
4491
4605
|
async function loadPhantomWalletProvider() {
|
|
4492
|
-
const mod = await Promise.resolve().then(function () { return require('./phantom-wallet-provider-
|
|
4606
|
+
const mod = await Promise.resolve().then(function () { return require('./phantom-wallet-provider-BPRRcIaN.js'); });
|
|
4493
4607
|
return { PhantomWalletProvider: mod.PhantomWalletProvider };
|
|
4494
4608
|
}
|
|
4495
4609
|
// Web Privy provider (depends on react-dom + @privy-io/react-auth). Lazy so Metro
|
|
4496
4610
|
// never bundles it into the RN build — RN uses the @privy-io/expo provider instead.
|
|
4497
4611
|
async function loadPrivyWalletProvider() {
|
|
4498
|
-
const mod = await Promise.resolve().then(function () { return require('./privy-wallet-provider-
|
|
4612
|
+
const mod = await Promise.resolve().then(function () { return require('./privy-wallet-provider-D4W91sqG.js'); });
|
|
4499
4613
|
return mod.PrivyWalletProvider;
|
|
4500
4614
|
}
|
|
4501
4615
|
async function loadSolanaMobileWalletProvider() {
|
|
4502
|
-
const mod = await Promise.resolve().then(function () { return require('./solana-mobile-wallet-provider-
|
|
4616
|
+
const mod = await Promise.resolve().then(function () { return require('./solana-mobile-wallet-provider-B0O0BctB.js'); });
|
|
4503
4617
|
return mod.SolanaMobileWalletProvider;
|
|
4504
4618
|
}
|
|
4505
4619
|
function requireWebPrivyConfig(config) {
|
|
@@ -4569,6 +4683,7 @@ async function hotSwapToMWAProvider(config) {
|
|
|
4569
4683
|
}
|
|
4570
4684
|
currentAuthProvider = provider;
|
|
4571
4685
|
currentAuthMethod = 'mobile-wallet-adapter';
|
|
4686
|
+
currentAuthProviderConfigKey = authProviderConfigKey(Object.assign(Object.assign({}, config), { authMethod: 'mobile-wallet-adapter' }));
|
|
4572
4687
|
const coreConfig = await core.getConfig();
|
|
4573
4688
|
coreConfig.authProvider = provider;
|
|
4574
4689
|
// Send 'phantom' as authMethod so the server routes to Solana verification.
|
|
@@ -4579,12 +4694,18 @@ async function hotSwapToMWAProvider(config) {
|
|
|
4579
4694
|
}
|
|
4580
4695
|
async function getAuthProvider(config) {
|
|
4581
4696
|
var _a, _b;
|
|
4582
|
-
|
|
4697
|
+
const nextProviderConfigKey = config ? authProviderConfigKey(config) : null;
|
|
4698
|
+
if (currentAuthProvider && (!config || currentAuthProviderConfigKey === nextProviderConfigKey)) {
|
|
4583
4699
|
return currentAuthProvider;
|
|
4584
4700
|
}
|
|
4585
4701
|
if (!config) {
|
|
4586
4702
|
throw new Error("Config is required to initialize auth provider");
|
|
4587
4703
|
}
|
|
4704
|
+
if (currentAuthProvider && currentAuthProviderConfigKey !== nextProviderConfigKey) {
|
|
4705
|
+
currentAuthProvider = null;
|
|
4706
|
+
currentAuthMethod = null;
|
|
4707
|
+
currentAuthProviderConfigKey = null;
|
|
4708
|
+
}
|
|
4588
4709
|
initConfig = config;
|
|
4589
4710
|
const authMethod = config.authMethod;
|
|
4590
4711
|
if (!authMethod) {
|
|
@@ -4667,6 +4788,7 @@ async function getAuthProvider(config) {
|
|
|
4667
4788
|
console.log("[Offchain] Wrapping auth provider for Poofnet transaction tracking");
|
|
4668
4789
|
currentAuthProvider = new OffchainAuthProvider(currentAuthProvider);
|
|
4669
4790
|
}
|
|
4791
|
+
currentAuthProviderConfigKey = nextProviderConfigKey;
|
|
4670
4792
|
return currentAuthProvider;
|
|
4671
4793
|
}
|
|
4672
4794
|
/**
|
|
@@ -4696,6 +4818,7 @@ async function signInAnonymously() {
|
|
|
4696
4818
|
const provider = new GuestAuthProvider();
|
|
4697
4819
|
currentAuthProvider = provider;
|
|
4698
4820
|
currentAuthMethod = 'guest';
|
|
4821
|
+
currentAuthProviderConfigKey = 'direct:guest';
|
|
4699
4822
|
const coreConfig = await core.getConfig();
|
|
4700
4823
|
coreConfig.authProvider = provider;
|
|
4701
4824
|
coreConfig.authMethod = 'guest';
|
|
@@ -4740,6 +4863,7 @@ async function loginWithPrivy(options) {
|
|
|
4740
4863
|
provider = new OffchainAuthProvider(provider);
|
|
4741
4864
|
}
|
|
4742
4865
|
currentAuthProvider = provider;
|
|
4866
|
+
currentAuthProviderConfigKey = authProviderConfigKey(Object.assign(Object.assign({}, coreConfig), { authMethod: currentAuthMethod }));
|
|
4743
4867
|
coreConfig.authProvider = provider;
|
|
4744
4868
|
coreConfig.authMethod = currentAuthMethod;
|
|
4745
4869
|
setAuthProviderInstance(provider);
|
|
@@ -4756,6 +4880,7 @@ async function activateEmailProvider() {
|
|
|
4756
4880
|
const provider = new EmailAuthProvider();
|
|
4757
4881
|
currentAuthProvider = provider;
|
|
4758
4882
|
currentAuthMethod = 'email';
|
|
4883
|
+
currentAuthProviderConfigKey = 'direct:email';
|
|
4759
4884
|
const coreConfig = await core.getConfig();
|
|
4760
4885
|
coreConfig.authProvider = provider;
|
|
4761
4886
|
coreConfig.authMethod = 'email';
|
|
@@ -4882,6 +5007,7 @@ async function logout$1() {
|
|
|
4882
5007
|
setStoredAuthMethod(null);
|
|
4883
5008
|
currentAuthProvider = null;
|
|
4884
5009
|
currentAuthMethod = null;
|
|
5010
|
+
currentAuthProviderConfigKey = null;
|
|
4885
5011
|
}
|
|
4886
5012
|
|
|
4887
5013
|
/**
|
|
@@ -5567,4 +5693,4 @@ exports.signInAnonymously = signInAnonymously;
|
|
|
5567
5693
|
exports.useAuth = useAuth;
|
|
5568
5694
|
exports.verifyEmailOtp = verifyEmailOtp;
|
|
5569
5695
|
exports.verifyTextOtp = verifyTextOtp;
|
|
5570
|
-
//# sourceMappingURL=index.native-
|
|
5696
|
+
//# sourceMappingURL=index.native-C4a8IUpM.js.map
|