@bounded-sh/client 0.0.19 → 0.0.21

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 (31) hide show
  1. package/README.md +2 -2
  2. package/dist/auth/providers/offchain-auth-provider.d.ts +2 -4
  3. package/dist/index.d.ts +0 -1
  4. package/dist/index.js +150 -214
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +151 -213
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/{index.native-DI_Xgv-n.js → index.native-DdKzAUjN.js} +154 -218
  9. package/dist/index.native-DdKzAUjN.js.map +1 -0
  10. package/dist/{index.native-DWI_i6-6.mjs → index.native-N3xLU862.mjs} +155 -217
  11. package/dist/index.native-N3xLU862.mjs.map +1 -0
  12. package/dist/index.native.d.ts +0 -1
  13. package/dist/index.native.js +1 -3
  14. package/dist/index.native.js.map +1 -1
  15. package/dist/index.native.mjs +1 -1
  16. package/dist/{phantom-wallet-provider-DDwgNMg_.mjs → phantom-wallet-provider-DcE4A2_e.mjs} +2 -2
  17. package/dist/{phantom-wallet-provider-DDwgNMg_.mjs.map → phantom-wallet-provider-DcE4A2_e.mjs.map} +1 -1
  18. package/dist/{phantom-wallet-provider-fyOrJZP6.js → phantom-wallet-provider-Dz9lQvNv.js} +2 -2
  19. package/dist/{phantom-wallet-provider-fyOrJZP6.js.map → phantom-wallet-provider-Dz9lQvNv.js.map} +1 -1
  20. package/dist/{privy-wallet-provider-BIr9lDS7.js → privy-wallet-provider-DUvjxNXK.js} +3 -3
  21. package/dist/{privy-wallet-provider-BIr9lDS7.js.map → privy-wallet-provider-DUvjxNXK.js.map} +1 -1
  22. package/dist/{privy-wallet-provider-D7VoQCYf.mjs → privy-wallet-provider-oG3o5vko.mjs} +3 -3
  23. package/dist/{privy-wallet-provider-D7VoQCYf.mjs.map → privy-wallet-provider-oG3o5vko.mjs.map} +1 -1
  24. package/dist/{solana-mobile-wallet-provider-Cush-URL.js → solana-mobile-wallet-provider-DdBoG6c2.js} +2 -2
  25. package/dist/{solana-mobile-wallet-provider-Cush-URL.js.map → solana-mobile-wallet-provider-DdBoG6c2.js.map} +1 -1
  26. package/dist/{solana-mobile-wallet-provider-DgcGxDoL.mjs → solana-mobile-wallet-provider-aS60_GZR.mjs} +2 -2
  27. package/dist/{solana-mobile-wallet-provider-DgcGxDoL.mjs.map → solana-mobile-wallet-provider-aS60_GZR.mjs.map} +1 -1
  28. package/package.json +2 -2
  29. package/dist/auth/providers/mock-auth-provider.d.ts +0 -49
  30. package/dist/index.native-DI_Xgv-n.js.map +0 -1
  31. package/dist/index.native-DWI_i6-6.mjs.map +0 -1
@@ -178,142 +178,11 @@ function detectAndroid() {
178
178
  return false;
179
179
  }
180
180
 
181
- // Default test wallet address (Solana devnet address)
182
- const DEFAULT_TEST_ADDRESS = 'HKbZbRR7jWWR5VRN8KFjvTCHEzJQgameYxKQxh2gPoof';
183
- // Session storage key to track if user explicitly called login()
184
- const EXPLICIT_LOGIN_KEY = 'mock-auth-explicit-login';
185
- /**
186
- * MockAuthProvider bypasses real wallet authentication for testing purposes.
187
- * Uses session storage to simulate logged-in user, with fallback to default test address.
188
- *
189
- * This is enabled by passing mockAuth: true to init()
190
- */
191
- class MockAuthProvider {
192
- /**
193
- * Mock login - reads user from session storage or uses default test address
194
- */
195
- async login() {
196
- let address = getPlatform().sessionStorage.getItem('test-user-address');
197
- if (!address) {
198
- address = DEFAULT_TEST_ADDRESS;
199
- // Store default address in session storage so it gets used in API calls
200
- getPlatform().sessionStorage.setItem('test-user-address', DEFAULT_TEST_ADDRESS);
201
- console.log('[MockAuth] Using default test address:', address);
202
- }
203
- // Mark that user explicitly called login() - allows restoreSession on refresh
204
- getPlatform().sessionStorage.setItem(EXPLICIT_LOGIN_KEY, 'true');
205
- console.log('[MockAuth] Mock login successful:', address);
206
- return {
207
- address,
208
- provider: this
209
- };
210
- }
211
- /**
212
- * Mock transaction - returns fake signature without actual blockchain interaction
213
- * The real transaction will be handled by the backend using test headers
214
- */
215
- async runTransaction(evmTransactionData, solTransactionData, options) {
216
- const address = getPlatform().sessionStorage.getItem('test-user-address') || DEFAULT_TEST_ADDRESS;
217
- // Generate a fake transaction signature
218
- const fakeSignature = `mock_tx_${Math.random().toString(36).substring(2, 15)}`;
219
- console.log('[MockAuth] Mock transaction executed:', {
220
- address,
221
- signature: fakeSignature,
222
- evmTx: evmTransactionData,
223
- solTx: solTransactionData
224
- });
225
- return {
226
- transactionSignature: fakeSignature,
227
- signedTransaction: fakeSignature,
228
- blockNumber: 0,
229
- gasUsed: '0'
230
- };
231
- }
232
- /**
233
- * Mock message signing
234
- */
235
- async signMessage(message) {
236
- const address = getPlatform().sessionStorage.getItem('test-user-address') || DEFAULT_TEST_ADDRESS;
237
- // Generate a fake signature
238
- const fakeSignature = `mock_sig_${Math.random().toString(36).substring(2, 15)}`;
239
- console.log('[MockAuth] Mock message signed:', {
240
- address,
241
- message,
242
- signature: fakeSignature
243
- });
244
- return fakeSignature;
245
- }
246
- async signMessageMock(message) {
247
- const address = getPlatform().sessionStorage.getItem('test-user-address') || DEFAULT_TEST_ADDRESS;
248
- const signature = `mock_sig_${Math.random().toString(36).substring(2, 15)}`;
249
- console.log('[MockAuth] Mock message signed:', {
250
- address,
251
- message,
252
- signature
253
- });
254
- return signature;
255
- }
256
- /**
257
- * Mock transaction signing - returns the transaction as-is (no actual signing)
258
- */
259
- async signTransaction(transaction) {
260
- console.log('[MockAuth] Mock transaction signing (no-op)');
261
- return transaction;
262
- }
263
- /**
264
- * Sign and submit transaction - not supported in mock environment.
265
- * See the real providers (PhantomWalletProvider, SolanaKeypairProvider)
266
- * for the full implementation with blockhash handling and feePayer support.
267
- */
268
- async signAndSubmitTransaction(_transaction, _feePayer) {
269
- throw new Error('signAndSubmitTransaction is not supported in the mock environment');
270
- }
271
- /**
272
- * Restore session - only restores if user previously called login() explicitly.
273
- * This prevents auto-login on first page load, but allows session persistence after login.
274
- */
275
- async restoreSession() {
276
- const explicitlyLoggedIn = getPlatform().sessionStorage.getItem(EXPLICIT_LOGIN_KEY);
277
- if (!explicitlyLoggedIn) {
278
- console.log('[MockAuth] No explicit login found. Call login() to authenticate.');
279
- return null;
280
- }
281
- const address = getPlatform().sessionStorage.getItem('test-user-address');
282
- if (!address) {
283
- console.log('[MockAuth] No previous session found');
284
- return null;
285
- }
286
- console.log('[MockAuth] Session restored:', address);
287
- return {
288
- address,
289
- provider: this
290
- };
291
- }
292
- /**
293
- * Mock logout - clears test user from session storage
294
- */
295
- async logout() {
296
- getPlatform().sessionStorage.removeItem('test-user-address');
297
- getPlatform().sessionStorage.removeItem('test-user-id');
298
- getPlatform().sessionStorage.removeItem(EXPLICIT_LOGIN_KEY);
299
- console.log('[MockAuth] Mock logout successful');
300
- }
301
- /**
302
- * Get native wallet methods (not needed for mock auth)
303
- */
304
- async getNativeMethods() {
305
- return {
306
- // Return empty object - no native methods needed for mock auth
307
- };
308
- }
309
- }
310
-
311
181
  /**
312
182
  * OffchainAuthProvider wraps a real auth provider (e.g., Phantom) for the poofnet environment.
313
183
  *
314
- * For signMessageMock, this shows a custom confirmation modal and then delegates
315
- * to the wrapped provider for a real detached signature over the exact offchain
316
- * transaction message.
184
+ * signMessage shows a custom confirmation modal and then delegates to the wrapped
185
+ * provider for a real detached signature over the exact offchain transaction message.
317
186
  */
318
187
  class OffchainAuthProvider {
319
188
  constructor(wrappedProvider, config = {}) {
@@ -364,13 +233,7 @@ class OffchainAuthProvider {
364
233
  }
365
234
  // ============ signMessage delegates to wrapped provider ============
366
235
  async signMessage(message) {
367
- // Delegate to wrapped provider for real wallet signing
368
- return this.wrappedProvider.signMessage(message);
369
- }
370
- // ============ Mock signMessage with Custom Modal for Offchain Transactions ============
371
- async signMessageMock(message) {
372
236
  var _a, _b, _c, _d, _e, _f;
373
- // Callback: signing started
374
237
  (_b = (_a = this.config).onSigningStart) === null || _b === void 0 ? void 0 : _b.call(_a);
375
238
  try {
376
239
  // On RN (no DOM), auto-confirm — there's no modal to show.
@@ -387,7 +250,6 @@ class OffchainAuthProvider {
387
250
  return signature;
388
251
  }
389
252
  catch (error) {
390
- // Callback: signing error
391
253
  (_f = (_e = this.config).onSigningError) === null || _f === void 0 ? void 0 : _f.call(_e, error);
392
254
  throw error;
393
255
  }
@@ -4125,13 +3987,33 @@ function createEmailModalTree() {
4125
3987
  close.type = 'button';
4126
3988
  close.textContent = '×';
4127
3989
  card.appendChild(close);
3990
+ // Brand row — the real Bounded mark (same geometry as bounded.sh) + wordmark.
4128
3991
  const brand = document.createElement('div');
4129
3992
  brand.className = 'ba-brand';
4130
- const dot = document.createElement('span');
4131
- dot.className = 'ba-dot';
4132
- brand.appendChild(dot);
4133
- brand.appendChild(document.createTextNode(' Sign in'));
3993
+ const mark = document.createElement('span');
3994
+ mark.className = 'ba-mark';
3995
+ mark.setAttribute('aria-hidden', 'true');
3996
+ mark.innerHTML =
3997
+ '<svg width="24" height="24" viewBox="0 0 32 32" fill="none">' +
3998
+ '<path class="ba-c ba-c1" d="M16 5 H5 V16"/>' +
3999
+ '<path class="ba-c ba-c2" d="M16 5 H27 V16"/>' +
4000
+ '<path class="ba-c ba-c3" d="M5 16 V27 H16"/>' +
4001
+ '<path class="ba-c ba-c4" d="M27 16 V27 H16"/>' +
4002
+ '</svg>';
4003
+ brand.appendChild(mark);
4004
+ const word = document.createElement('span');
4005
+ word.className = 'ba-word';
4006
+ word.textContent = 'bounded';
4007
+ brand.appendChild(word);
4134
4008
  card.appendChild(brand);
4009
+ const title = document.createElement('h1');
4010
+ title.className = 'ba-title';
4011
+ title.textContent = 'Sign in';
4012
+ card.appendChild(title);
4013
+ const sub = document.createElement('p');
4014
+ sub.className = 'ba-subtitle';
4015
+ sub.textContent = 'Continue with your email — no wallet needed.';
4016
+ card.appendChild(sub);
4135
4017
  const emailStep = document.createElement('div');
4136
4018
  emailStep.id = 'ba-email-step';
4137
4019
  card.appendChild(emailStep);
@@ -4152,7 +4034,7 @@ function createEmailModalTree() {
4152
4034
  emailButton.id = 'ba-email-btn';
4153
4035
  emailButton.className = 'ba-btn';
4154
4036
  emailButton.type = 'button';
4155
- emailButton.textContent = 'Continue';
4037
+ emailButton.textContent = 'Continue with email';
4156
4038
  emailStep.appendChild(emailButton);
4157
4039
  const otpStep = document.createElement('div');
4158
4040
  otpStep.id = 'ba-otp-step';
@@ -4197,37 +4079,67 @@ function createEmailModalTree() {
4197
4079
  card.appendChild(foot);
4198
4080
  return root;
4199
4081
  }
4082
+ // Design language matches the hosted Bounded login (auth.bounded.sh) and bounded.sh:
4083
+ // dark editorial panel, green accent, Schibsted Grotesk / Newsreader / JetBrains Mono,
4084
+ // the Bounded mark drawing itself in. Fonts load best-effort (scoped @import); every
4085
+ // rule has a system fallback so the modal looks right even if Google Fonts is blocked.
4086
+ // All selectors are scoped under #bounded-auth-modal so we never leak into the host page.
4200
4087
  const MODAL_CSS = `
4201
- #bounded-auth-modal .ba-overlay{position:fixed;inset:0;background:rgba(8,10,18,.62);backdrop-filter:blur(4px);
4088
+ @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');
4089
+ #bounded-auth-modal{--ba-bg:#0a0a0b;--ba-panel:#0e0f11;--ba-inset:#060607;--ba-raise:#131416;
4090
+ --ba-line:rgba(232,230,222,.08);--ba-line-strong:rgba(232,230,222,.16);
4091
+ --ba-text:#e8e6de;--ba-dim:#9b9991;--ba-faint:#85837c;--ba-green:#58c98f;
4092
+ --ba-green-bg:rgba(88,201,143,.09);--ba-green-line:rgba(88,201,143,.28);--ba-red:#ec8488;
4093
+ --ba-body:'Schibsted Grotesk',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;
4094
+ --ba-display:'Newsreader','Iowan Old Style',Georgia,serif;
4095
+ --ba-mono:'JetBrains Mono',ui-monospace,'SF Mono',Menlo,monospace;}
4096
+ #bounded-auth-modal .ba-overlay{position:fixed;inset:0;background:rgba(6,6,7,.66);backdrop-filter:blur(4px);
4202
4097
  display:flex;align-items:center;justify-content:center;z-index:2147483000;opacity:1;transition:opacity .16s ease;
4203
- font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;padding:16px;}
4098
+ font-family:var(--ba-body);padding:16px;}
4204
4099
  #bounded-auth-modal .ba-overlay.out{opacity:0;}
4205
- #bounded-auth-modal .ba-card{width:100%;max-width:380px;background:#0f1117;color:#f4f5f7;border:1px solid #232838;
4206
- border-radius:18px;padding:24px 22px 18px;box-shadow:0 24px 70px rgba(0,0,0,.5);position:relative;
4207
- animation:ba-in .18s ease;}
4208
- @keyframes ba-in{from{transform:translateY(10px);opacity:.6}to{transform:translateY(0);opacity:1}}
4209
- #bounded-auth-modal .ba-x{position:absolute;top:12px;right:12px;width:30px;height:30px;border:none;background:#1a1e2b;
4210
- color:#9aa3b2;border-radius:9px;font-size:20px;line-height:1;cursor:pointer;}
4211
- #bounded-auth-modal .ba-x:hover{background:#222838;color:#fff;}
4212
- #bounded-auth-modal .ba-brand{display:flex;align-items:center;gap:8px;font-weight:600;font-size:15px;margin:0 0 18px;}
4213
- #bounded-auth-modal .ba-dot{width:10px;height:10px;border-radius:50%;background:linear-gradient(135deg,#8b5cf6,#22d3ee);}
4214
- #bounded-auth-modal .ba-label{display:block;font-size:13px;color:#aab2c0;margin:0 0 8px;}
4215
- #bounded-auth-modal .ba-em{color:#fff;font-weight:600;}
4216
- #bounded-auth-modal .ba-input{width:100%;box-sizing:border-box;background:#171b26;border:1px solid #2a3040;color:#fff;
4217
- border-radius:11px;padding:13px 14px;font-size:16px;outline:none;transition:border-color .12s;}
4218
- #bounded-auth-modal .ba-input:focus{border-color:#7c5cff;}
4219
- #bounded-auth-modal .ba-code{letter-spacing:8px;text-align:center;font-size:22px;font-variant-numeric:tabular-nums;}
4220
- #bounded-auth-modal .ba-btn{width:100%;margin-top:12px;background:linear-gradient(135deg,#7c5cff,#5b8cff);color:#fff;
4221
- border:none;border-radius:11px;padding:13px;font-size:15px;font-weight:600;cursor:pointer;transition:filter .12s;}
4222
- #bounded-auth-modal .ba-btn:hover{filter:brightness(1.08);}
4223
- #bounded-auth-modal .ba-btn:disabled{opacity:.6;cursor:default;}
4224
- #bounded-auth-modal .ba-link{width:100%;margin-top:10px;background:none;border:none;color:#8aa0c6;font-size:13px;cursor:pointer;}
4225
- #bounded-auth-modal .ba-link:hover{color:#bcd0f0;}
4226
- #bounded-auth-modal .ba-msg{min-height:18px;margin-top:10px;font-size:13px;color:#8aa0c6;text-align:center;}
4227
- #bounded-auth-modal .ba-msg.err{color:#ff8a8a;}
4228
- #bounded-auth-modal .ba-foot{margin-top:14px;text-align:center;font-size:11px;color:#5a6273;}
4100
+ #bounded-auth-modal *{box-sizing:border-box;}
4101
+ #bounded-auth-modal .ba-card{width:100%;max-width:372px;background:var(--ba-panel);color:var(--ba-text);
4102
+ border:1px solid var(--ba-line);border-radius:12px;padding:28px 28px 22px;position:relative;
4103
+ 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;}
4104
+ @keyframes ba-in{from{transform:translateY(8px);opacity:.5}to{transform:translateY(0);opacity:1}}
4105
+ #bounded-auth-modal .ba-x{position:absolute;top:14px;right:14px;width:28px;height:28px;border:1px solid var(--ba-line);
4106
+ background:var(--ba-raise);color:var(--ba-faint);border-radius:7px;font-size:18px;line-height:1;cursor:pointer;
4107
+ transition:color .15s,border-color .15s;}
4108
+ #bounded-auth-modal .ba-x:hover{color:var(--ba-text);border-color:var(--ba-faint);}
4109
+ #bounded-auth-modal .ba-brand{display:flex;align-items:center;gap:10px;margin:0 0 24px;}
4110
+ #bounded-auth-modal .ba-mark{display:flex;color:var(--ba-text);}
4111
+ #bounded-auth-modal .ba-mark svg{overflow:visible;display:block;}
4112
+ #bounded-auth-modal .ba-c{stroke:currentColor;stroke-width:2.4;fill:none;}
4113
+ @media (prefers-reduced-motion:no-preference){
4114
+ #bounded-auth-modal .ba-c{stroke-dasharray:23;stroke-dashoffset:23;animation:ba-draw .4s cubic-bezier(.45,0,.2,1) forwards;}
4115
+ #bounded-auth-modal .ba-c1{animation-delay:.1s}#bounded-auth-modal .ba-c2{animation-delay:.38s}
4116
+ #bounded-auth-modal .ba-c3{animation-delay:.66s}#bounded-auth-modal .ba-c4{animation-delay:.94s}}
4117
+ @keyframes ba-draw{to{stroke-dashoffset:0}}
4118
+ #bounded-auth-modal .ba-word{font-family:var(--ba-body);font-weight:500;font-size:15px;letter-spacing:.2px;color:var(--ba-text);}
4119
+ #bounded-auth-modal .ba-title{font-family:var(--ba-display);font-weight:400;font-size:25px;letter-spacing:-.01em;margin:0 0 5px;}
4120
+ #bounded-auth-modal .ba-subtitle{color:var(--ba-dim);font-size:14px;margin:0 0 22px;}
4121
+ #bounded-auth-modal .ba-label{display:block;font-size:12px;color:var(--ba-dim);margin:0 0 7px;}
4122
+ #bounded-auth-modal .ba-em{color:var(--ba-text);font-weight:600;}
4123
+ #bounded-auth-modal .ba-input{width:100%;background:var(--ba-inset);border:1px solid var(--ba-line-strong);color:var(--ba-text);
4124
+ border-radius:6px;padding:11px 13px;font-family:var(--ba-body);font-size:15px;outline:none;transition:border-color .15s,box-shadow .15s;}
4125
+ #bounded-auth-modal .ba-input::placeholder{color:var(--ba-faint);}
4126
+ #bounded-auth-modal .ba-input:focus{border-color:var(--ba-green-line);box-shadow:0 0 0 3px var(--ba-green-bg);}
4127
+ #bounded-auth-modal .ba-code{font-family:var(--ba-mono);letter-spacing:8px;text-align:center;font-size:21px;padding-left:8px;}
4128
+ #bounded-auth-modal .ba-btn{width:100%;margin-top:16px;background:var(--ba-text);color:var(--ba-bg);
4129
+ border:0;border-radius:6px;padding:12px;font-family:var(--ba-body);font-size:14px;font-weight:600;cursor:pointer;
4130
+ transition:opacity .15s,transform .04s;}
4131
+ #bounded-auth-modal .ba-btn:hover{opacity:.9;}
4132
+ #bounded-auth-modal .ba-btn:active{transform:translateY(.5px);}
4133
+ #bounded-auth-modal .ba-btn:disabled{opacity:.45;cursor:default;}
4134
+ #bounded-auth-modal .ba-link{width:100%;margin-top:14px;background:none;border:none;color:var(--ba-dim);
4135
+ font-family:var(--ba-body);font-size:12.5px;cursor:pointer;}
4136
+ #bounded-auth-modal .ba-link:hover{color:var(--ba-text);}
4137
+ #bounded-auth-modal .ba-msg{min-height:16px;margin-top:16px;font-size:12.5px;color:var(--ba-dim);text-align:center;}
4138
+ #bounded-auth-modal .ba-msg.err{color:var(--ba-red);}
4139
+ #bounded-auth-modal .ba-foot{margin-top:26px;padding-top:16px;border-top:1px solid var(--ba-line);
4140
+ text-align:center;font-size:11px;color:var(--ba-faint);}
4229
4141
  #bounded-auth-modal .hidden{display:none;}
4230
- @media (max-width:480px){#bounded-auth-modal .ba-card{max-width:none;border-radius:16px;}}`;
4142
+ @media (max-width:480px){#bounded-auth-modal .ba-card{max-width:none;}}`;
4231
4143
 
4232
4144
  const SURFNET_RPC_URL = "https://surfpool.fly.dev";
4233
4145
  const SUPPORTED_SOLANA_NETWORKS = new Set([
@@ -4274,6 +4186,7 @@ function resolveSolanaRpcUrl(explicitRpcUrl, network, context) {
4274
4186
  }
4275
4187
 
4276
4188
  const PKCE_STORE_KEY = 'bounded.oidc.pkce';
4189
+ const STORED_AUTH_METHOD_KEY$1 = 'bounded_last_auth_method';
4277
4190
  // Active session store (Web on web, RN on React Native) — selected by config,
4278
4191
  // not by `typeof window` (truthy on RN). OIDC redirect/popup is web-only, but the
4279
4192
  // session it mints is read back through this same selector everywhere.
@@ -4568,6 +4481,10 @@ async function exchangeCode(code, verifier, redirectUri) {
4568
4481
  const refreshToken = tokenField(data, 'refresh_token', 'refreshToken');
4569
4482
  const user = userFromIdToken(idToken);
4570
4483
  await sessionManager().storeSession(String(user.address || ''), accessToken, idToken, refreshToken, base);
4484
+ try {
4485
+ getPlatform().storage.setItem(STORED_AUTH_METHOD_KEY$1, 'email');
4486
+ }
4487
+ catch ( /* storage unavailable */_b) { /* storage unavailable */ }
4571
4488
  setCurrentUser(user);
4572
4489
  setAuthProviderInstance(oidcProviderSingleton);
4573
4490
  return user;
@@ -4578,7 +4495,10 @@ async function exchangeCode(code, verifier, redirectUri) {
4578
4495
  // (react-dom) when this module is imported on RN.
4579
4496
  let currentAuthProvider = null;
4580
4497
  let currentAuthMethod = null;
4498
+ let currentAuthProviderConfigKey = null;
4581
4499
  let initConfig = null;
4500
+ const objectIdentityKeys = new WeakMap();
4501
+ let nextObjectIdentityKey = 1;
4582
4502
  // --- localStorage helpers: track which auth method created the active session ---
4583
4503
  const STORED_AUTH_METHOD_KEY = 'bounded_last_auth_method';
4584
4504
  function getStoredAuthMethod() {
@@ -4602,6 +4522,51 @@ function setStoredAuthMethod(method) {
4602
4522
  // storage might not be available
4603
4523
  }
4604
4524
  }
4525
+ function objectIdentityKey(value) {
4526
+ if (!value || (typeof value !== 'object' && typeof value !== 'function'))
4527
+ return null;
4528
+ const obj = value;
4529
+ let id = objectIdentityKeys.get(obj);
4530
+ if (!id) {
4531
+ id = nextObjectIdentityKey++;
4532
+ objectIdentityKeys.set(obj, id);
4533
+ }
4534
+ return `object:${id}`;
4535
+ }
4536
+ function stableConfigValue(value, seen = new WeakSet()) {
4537
+ if (value === null || typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean')
4538
+ return value;
4539
+ if (typeof value === 'function')
4540
+ return '[function]';
4541
+ if (Array.isArray(value))
4542
+ return value.map((item) => stableConfigValue(item, seen));
4543
+ if (typeof value === 'object') {
4544
+ if (seen.has(value))
4545
+ return '[circular]';
4546
+ seen.add(value);
4547
+ const out = {};
4548
+ for (const key of Object.keys(value).sort()) {
4549
+ out[key] = stableConfigValue(value[key], seen);
4550
+ }
4551
+ seen.delete(value);
4552
+ return out;
4553
+ }
4554
+ return String(value);
4555
+ }
4556
+ function authProviderConfigKey(config) {
4557
+ var _a, _b, _c, _d, _e, _f, _g, _h;
4558
+ return JSON.stringify({
4559
+ authMethod: (_a = config.authMethod) !== null && _a !== void 0 ? _a : null,
4560
+ chain: (_b = config.chain) !== null && _b !== void 0 ? _b : null,
4561
+ rpcUrl: normalizeSolanaRpcUrl(config.rpcUrl),
4562
+ name: (_c = config.name) !== null && _c !== void 0 ? _c : null,
4563
+ logoUrl: (_d = config.logoUrl) !== null && _d !== void 0 ? _d : null,
4564
+ phantomConfig: stableConfigValue((_e = config.phantomConfig) !== null && _e !== void 0 ? _e : null),
4565
+ privyConfig: stableConfigValue((_f = config.privyConfig) !== null && _f !== void 0 ? _f : null),
4566
+ mobileWalletConfig: stableConfigValue((_g = config.mobileWalletConfig) !== null && _g !== void 0 ? _g : null),
4567
+ privyExpoProvider: objectIdentityKey((_h = config.privyExpoProvider) !== null && _h !== void 0 ? _h : null),
4568
+ });
4569
+ }
4605
4570
  /**
4606
4571
  * Clears the session if it was created by a different auth method.
4607
4572
  * Returns true if the session was cleared, false if the session is compatible.
@@ -4627,17 +4592,17 @@ function clearIncompatibleSession() {
4627
4592
  // Lazy loaders for web-only providers.
4628
4593
  // Using dynamic import() ensures Metro (RN) never resolves these modules.
4629
4594
  async function loadPhantomWalletProvider() {
4630
- const mod = await Promise.resolve().then(function () { return require('./phantom-wallet-provider-fyOrJZP6.js'); });
4595
+ const mod = await Promise.resolve().then(function () { return require('./phantom-wallet-provider-Dz9lQvNv.js'); });
4631
4596
  return { PhantomWalletProvider: mod.PhantomWalletProvider };
4632
4597
  }
4633
4598
  // Web Privy provider (depends on react-dom + @privy-io/react-auth). Lazy so Metro
4634
4599
  // never bundles it into the RN build — RN uses the @privy-io/expo provider instead.
4635
4600
  async function loadPrivyWalletProvider() {
4636
- const mod = await Promise.resolve().then(function () { return require('./privy-wallet-provider-BIr9lDS7.js'); });
4601
+ const mod = await Promise.resolve().then(function () { return require('./privy-wallet-provider-DUvjxNXK.js'); });
4637
4602
  return mod.PrivyWalletProvider;
4638
4603
  }
4639
4604
  async function loadSolanaMobileWalletProvider() {
4640
- const mod = await Promise.resolve().then(function () { return require('./solana-mobile-wallet-provider-Cush-URL.js'); });
4605
+ const mod = await Promise.resolve().then(function () { return require('./solana-mobile-wallet-provider-DdBoG6c2.js'); });
4641
4606
  return mod.SolanaMobileWalletProvider;
4642
4607
  }
4643
4608
  function requireWebPrivyConfig(config) {
@@ -4683,38 +4648,6 @@ function requireMobileWalletConfig(config) {
4683
4648
  }
4684
4649
  return Object.assign(Object.assign({}, ((_c = config.mobileWalletConfig) !== null && _c !== void 0 ? _c : {})), { cluster });
4685
4650
  }
4686
- function isLocalOrTestUrl(value) {
4687
- if (!value)
4688
- return false;
4689
- try {
4690
- const hostname = new URL(value).hostname.toLowerCase();
4691
- return hostname === 'localhost' ||
4692
- hostname === '127.0.0.1' ||
4693
- hostname === '::1' ||
4694
- hostname.endsWith('.localhost') ||
4695
- hostname.endsWith('.test');
4696
- }
4697
- catch (_a) {
4698
- return false;
4699
- }
4700
- }
4701
- function assertMockAuthLocalOnly(config) {
4702
- const requiredEndpoints = [
4703
- config.apiUrl,
4704
- config.wsApiUrl,
4705
- config.authApiUrl,
4706
- ];
4707
- const optionalEndpoints = [
4708
- config.rpcUrl,
4709
- config.humanAuthApiUrl,
4710
- config.functionsUrl,
4711
- ].filter((value) => typeof value === 'string' && value.trim() !== '');
4712
- if (requiredEndpoints.every(isLocalOrTestUrl) && optionalEndpoints.every(isLocalOrTestUrl)) {
4713
- return;
4714
- }
4715
- throw new Error("mockAuth is local/test-only. Pass explicit localhost/.test apiUrl, wsApiUrl, and authApiUrl values; " +
4716
- "mockAuth cannot be used with Bounded production or staging endpoints.");
4717
- }
4718
4651
  async function hotSwapToMWAProvider(config) {
4719
4652
  var _a;
4720
4653
  const rpcUrl = normalizeSolanaRpcUrl(config.rpcUrl);
@@ -4739,6 +4672,7 @@ async function hotSwapToMWAProvider(config) {
4739
4672
  }
4740
4673
  currentAuthProvider = provider;
4741
4674
  currentAuthMethod = 'mobile-wallet-adapter';
4675
+ currentAuthProviderConfigKey = authProviderConfigKey(Object.assign(Object.assign({}, config), { authMethod: 'mobile-wallet-adapter' }));
4742
4676
  const coreConfig = await core.getConfig();
4743
4677
  coreConfig.authProvider = provider;
4744
4678
  // Send 'phantom' as authMethod so the server routes to Solana verification.
@@ -4749,20 +4683,19 @@ async function hotSwapToMWAProvider(config) {
4749
4683
  }
4750
4684
  async function getAuthProvider(config) {
4751
4685
  var _a, _b;
4752
- if (currentAuthProvider) {
4686
+ const nextProviderConfigKey = config ? authProviderConfigKey(config) : null;
4687
+ if (currentAuthProvider && (!config || currentAuthProviderConfigKey === nextProviderConfigKey)) {
4753
4688
  return currentAuthProvider;
4754
4689
  }
4755
4690
  if (!config) {
4756
4691
  throw new Error("Config is required to initialize auth provider");
4757
4692
  }
4758
- initConfig = config;
4759
- // If mockAuth is enabled, use MockAuthProvider regardless of authMethod
4760
- if (config.mockAuth) {
4761
- assertMockAuthLocalOnly(config);
4762
- console.log("[MockAuth] Mock authentication enabled");
4763
- currentAuthProvider = new MockAuthProvider();
4764
- return currentAuthProvider;
4693
+ if (currentAuthProvider && currentAuthProviderConfigKey !== nextProviderConfigKey) {
4694
+ currentAuthProvider = null;
4695
+ currentAuthMethod = null;
4696
+ currentAuthProviderConfigKey = null;
4765
4697
  }
4698
+ initConfig = config;
4766
4699
  const authMethod = config.authMethod;
4767
4700
  if (!authMethod) {
4768
4701
  throw new Error("authMethod is required to initialize auth provider; configure the single intended auth method explicitly.");
@@ -4844,6 +4777,7 @@ async function getAuthProvider(config) {
4844
4777
  console.log("[Offchain] Wrapping auth provider for Poofnet transaction tracking");
4845
4778
  currentAuthProvider = new OffchainAuthProvider(currentAuthProvider);
4846
4779
  }
4780
+ currentAuthProviderConfigKey = nextProviderConfigKey;
4847
4781
  return currentAuthProvider;
4848
4782
  }
4849
4783
  /**
@@ -4873,6 +4807,7 @@ async function signInAnonymously() {
4873
4807
  const provider = new GuestAuthProvider();
4874
4808
  currentAuthProvider = provider;
4875
4809
  currentAuthMethod = 'guest';
4810
+ currentAuthProviderConfigKey = 'direct:guest';
4876
4811
  const coreConfig = await core.getConfig();
4877
4812
  coreConfig.authProvider = provider;
4878
4813
  coreConfig.authMethod = 'guest';
@@ -4917,6 +4852,7 @@ async function loginWithPrivy(options) {
4917
4852
  provider = new OffchainAuthProvider(provider);
4918
4853
  }
4919
4854
  currentAuthProvider = provider;
4855
+ currentAuthProviderConfigKey = authProviderConfigKey(Object.assign(Object.assign({}, coreConfig), { authMethod: currentAuthMethod }));
4920
4856
  coreConfig.authProvider = provider;
4921
4857
  coreConfig.authMethod = currentAuthMethod;
4922
4858
  setAuthProviderInstance(provider);
@@ -4933,6 +4869,7 @@ async function activateEmailProvider() {
4933
4869
  const provider = new EmailAuthProvider();
4934
4870
  currentAuthProvider = provider;
4935
4871
  currentAuthMethod = 'email';
4872
+ currentAuthProviderConfigKey = 'direct:email';
4936
4873
  const coreConfig = await core.getConfig();
4937
4874
  coreConfig.authProvider = provider;
4938
4875
  coreConfig.authMethod = 'email';
@@ -5059,6 +4996,7 @@ async function logout$1() {
5059
4996
  setStoredAuthMethod(null);
5060
4997
  currentAuthProvider = null;
5061
4998
  currentAuthMethod = null;
4999
+ currentAuthProviderConfigKey = null;
5062
5000
  }
5063
5001
 
5064
5002
  /**
@@ -5705,8 +5643,6 @@ class PrivyExpoProvider {
5705
5643
  }
5706
5644
  }
5707
5645
 
5708
- exports.DEFAULT_TEST_ADDRESS = DEFAULT_TEST_ADDRESS;
5709
- exports.MockAuthProvider = MockAuthProvider;
5710
5646
  exports.OffchainAuthProvider = OffchainAuthProvider;
5711
5647
  exports.PrivyExpoProvider = PrivyExpoProvider;
5712
5648
  exports.SURFNET_RPC_URL = SURFNET_RPC_URL;
@@ -5746,4 +5682,4 @@ exports.signInAnonymously = signInAnonymously;
5746
5682
  exports.useAuth = useAuth;
5747
5683
  exports.verifyEmailOtp = verifyEmailOtp;
5748
5684
  exports.verifyTextOtp = verifyTextOtp;
5749
- //# sourceMappingURL=index.native-DI_Xgv-n.js.map
5685
+ //# sourceMappingURL=index.native-DdKzAUjN.js.map