@bounded-sh/client 0.0.24 → 0.0.26
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/oidc-auth.d.ts +38 -10
- package/dist/index.js +168 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +168 -70
- package/dist/index.mjs.map +1 -1
- package/dist/{index.native-DcetyeOb.js → index.native-BfAzgVuY.js} +171 -73
- package/dist/index.native-BfAzgVuY.js.map +1 -0
- package/dist/{index.native-D1YQ-LU7.mjs → index.native-DEWlFCQV.mjs} +171 -73
- package/dist/index.native-DEWlFCQV.mjs.map +1 -0
- package/dist/index.native.js +1 -1
- package/dist/index.native.mjs +1 -1
- package/dist/{phantom-wallet-provider-DgBk6o3j.js → phantom-wallet-provider-3xKduOOY.js} +2 -2
- package/dist/{phantom-wallet-provider-DgBk6o3j.js.map → phantom-wallet-provider-3xKduOOY.js.map} +1 -1
- package/dist/{phantom-wallet-provider-3_IulJlh.mjs → phantom-wallet-provider-B3ztJGu2.mjs} +2 -2
- package/dist/{phantom-wallet-provider-3_IulJlh.mjs.map → phantom-wallet-provider-B3ztJGu2.mjs.map} +1 -1
- package/dist/platform.d.ts +8 -0
- package/dist/{privy-wallet-provider-DNvtYCsQ.js → privy-wallet-provider-3LnqlNI-.js} +3 -3
- package/dist/{privy-wallet-provider-DNvtYCsQ.js.map → privy-wallet-provider-3LnqlNI-.js.map} +1 -1
- package/dist/{privy-wallet-provider-DQtXFGFF.mjs → privy-wallet-provider-D2i_xwYW.mjs} +3 -3
- package/dist/{privy-wallet-provider-DQtXFGFF.mjs.map → privy-wallet-provider-D2i_xwYW.mjs.map} +1 -1
- package/dist/{solana-mobile-wallet-provider-CcnkDdgZ.js → solana-mobile-wallet-provider-D2nTRj-4.js} +2 -2
- package/dist/{solana-mobile-wallet-provider-CcnkDdgZ.js.map → solana-mobile-wallet-provider-D2nTRj-4.js.map} +1 -1
- package/dist/{solana-mobile-wallet-provider-DE_zCpKE.mjs → solana-mobile-wallet-provider-dOWiujmo.mjs} +2 -2
- package/dist/{solana-mobile-wallet-provider-DE_zCpKE.mjs.map → solana-mobile-wallet-provider-dOWiujmo.mjs.map} +1 -1
- package/package.json +10 -2
- package/dist/index.native-D1YQ-LU7.mjs.map +0 -1
- package/dist/index.native-DcetyeOb.js.map +0 -1
|
@@ -67,6 +67,17 @@ function createWebPlatform() {
|
|
|
67
67
|
const hash = createHash('sha256').update(data).digest();
|
|
68
68
|
return hash.buffer.slice(hash.byteOffset, hash.byteOffset + hash.byteLength);
|
|
69
69
|
},
|
|
70
|
+
getRandomBytes(length) {
|
|
71
|
+
const out = new Uint8Array(length);
|
|
72
|
+
const g = typeof globalThis !== 'undefined' ? globalThis : undefined;
|
|
73
|
+
if (g && g.crypto && typeof g.crypto.getRandomValues === 'function') {
|
|
74
|
+
g.crypto.getRandomValues(out);
|
|
75
|
+
return out;
|
|
76
|
+
}
|
|
77
|
+
throw new Error('No secure random source available for PKCE. On React Native, either import ' +
|
|
78
|
+
"'react-native-get-random-values' once at your app entry, or pass getRandomBytes " +
|
|
79
|
+
'via setPlatform({ getRandomBytes }) (e.g. expo-crypto getRandomBytes).');
|
|
80
|
+
},
|
|
70
81
|
getUserAgent() {
|
|
71
82
|
if (hasWindow && typeof navigator !== 'undefined')
|
|
72
83
|
return navigator.userAgent;
|
|
@@ -4234,24 +4245,27 @@ async function issuerBase() {
|
|
|
4234
4245
|
const cfg = await getConfig();
|
|
4235
4246
|
return (cfg.humanAuthApiUrl || 'https://auth.bounded.sh').replace(/\/$/, '');
|
|
4236
4247
|
}
|
|
4248
|
+
// Base64url-encode raw bytes via the platform abstraction (web: window.btoa;
|
|
4249
|
+
// RN/Node: the polyfilled/Buffer btoa supplied by getPlatform()). On web this is
|
|
4250
|
+
// byte-identical to the previous direct `btoa(...)` call.
|
|
4237
4251
|
function b64url(buf) {
|
|
4238
4252
|
let s = '';
|
|
4239
|
-
const bytes = new Uint8Array(buf);
|
|
4253
|
+
const bytes = buf instanceof Uint8Array ? buf : new Uint8Array(buf);
|
|
4240
4254
|
for (let i = 0; i < bytes.length; i++)
|
|
4241
4255
|
s += String.fromCharCode(bytes[i]);
|
|
4242
|
-
return btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
4256
|
+
return getPlatform().btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
4243
4257
|
}
|
|
4258
|
+
// PKCE verifier + S256 challenge, fully platform-neutral: random bytes and the
|
|
4259
|
+
// SHA-256 digest both come from getPlatform() (web → WebCrypto, RN → polyfill/
|
|
4260
|
+
// expo-crypto). Web output is identical to the previous raw-crypto path.
|
|
4244
4261
|
async function makePkce() {
|
|
4245
|
-
const rnd =
|
|
4246
|
-
|
|
4247
|
-
const
|
|
4248
|
-
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(verifier));
|
|
4262
|
+
const rnd = getPlatform().getRandomBytes(32);
|
|
4263
|
+
const verifier = b64url(rnd);
|
|
4264
|
+
const digest = await getPlatform().sha256(getPlatform().textEncode(verifier));
|
|
4249
4265
|
return { verifier, challenge: b64url(digest) };
|
|
4250
4266
|
}
|
|
4251
4267
|
function randomState() {
|
|
4252
|
-
|
|
4253
|
-
crypto.getRandomValues(rnd);
|
|
4254
|
-
return b64url(rnd.buffer);
|
|
4268
|
+
return b64url(getPlatform().getRandomBytes(16));
|
|
4255
4269
|
}
|
|
4256
4270
|
function normalizeMethod(value) {
|
|
4257
4271
|
const normalized = String(value || '').trim().toLowerCase();
|
|
@@ -4267,84 +4281,171 @@ function appendHostedLoginHints(params, opts) {
|
|
|
4267
4281
|
const provider = normalizeMethod(opts.provider);
|
|
4268
4282
|
if (provider)
|
|
4269
4283
|
params.set('bounded_provider', provider);
|
|
4284
|
+
// Standard OIDC prompt (e.g. 'login' to force a fresh sign-in / account choice).
|
|
4285
|
+
const prompt = normalizeMethod(opts.prompt);
|
|
4286
|
+
if (prompt)
|
|
4287
|
+
params.set('prompt', prompt);
|
|
4270
4288
|
}
|
|
4271
|
-
|
|
4289
|
+
// Build the authorize URL + the PKCE state that pairs with it. PURE: no storage,
|
|
4290
|
+
// no navigation — so it's shared verbatim by the web redirect/popup paths and the
|
|
4291
|
+
// native (expo-web-browser) path. The caller decides where the PkceState lives
|
|
4292
|
+
// (web → sessionStorage across the full-page redirect; native → in-memory across
|
|
4293
|
+
// the awaited browser session).
|
|
4294
|
+
async function buildAuthorize(opts, guestHint) {
|
|
4272
4295
|
const cfg = await getConfig();
|
|
4273
4296
|
if (!cfg.appId)
|
|
4274
4297
|
throw new Error('appId is not configured (init the SDK with your appId)');
|
|
4275
4298
|
const redirectUri = opts.redirectUri;
|
|
4276
4299
|
const { verifier, challenge } = await makePkce();
|
|
4277
4300
|
const state = randomState();
|
|
4278
|
-
// Stash the verifier + state so the redirect_uri page can finish the exchange. sessionStorage
|
|
4279
|
-
// is per-tab and cleared on close — appropriate for a short-lived auth handshake.
|
|
4280
|
-
sessionStorage.setItem(PKCE_STORE_KEY, JSON.stringify({ verifier, state, redirectUri }));
|
|
4281
4301
|
const base = await issuerBase();
|
|
4282
4302
|
const params = new URLSearchParams({
|
|
4283
4303
|
client_id: cfg.appId, redirect_uri: redirectUri, response_type: 'code', scope: 'openid profile email',
|
|
4284
4304
|
code_challenge: challenge, code_challenge_method: 'S256', state,
|
|
4285
4305
|
});
|
|
4286
4306
|
appendHostedLoginHints(params, opts);
|
|
4287
|
-
|
|
4307
|
+
// Anonymous→real UPGRADE (linkWithRedirect): carry the guest's signed id-token THROUGH
|
|
4308
|
+
// the authorize request as a hint. The issuer signature-verifies it and binds it to this
|
|
4309
|
+
// request's PKCE code_challenge, so the link is completed single-use during the normal
|
|
4310
|
+
// code→token exchange — no retired /link/social, and the appId stays bound to client_id.
|
|
4311
|
+
if (guestHint)
|
|
4312
|
+
params.set('bounded_guest_hint', guestHint);
|
|
4313
|
+
return { url: `${base}/api/auth/oauth2/authorize?${params.toString()}`, pkce: { verifier, state, redirectUri } };
|
|
4314
|
+
}
|
|
4315
|
+
// Are we on React Native (no DOM)? OIDC dispatch uses this to choose the native
|
|
4316
|
+
// expo-web-browser driver vs. the web full-page-redirect/popup driver.
|
|
4317
|
+
function isNative() {
|
|
4318
|
+
return !getPlatform().hasDOM;
|
|
4319
|
+
}
|
|
4320
|
+
// ---------------------------------------------------------------------------
|
|
4321
|
+
// Native (React Native / Expo) redirect driver
|
|
4322
|
+
// ---------------------------------------------------------------------------
|
|
4323
|
+
// Lazily load expo-web-browser. It's an OPTIONAL peer dep — imported dynamically
|
|
4324
|
+
// so the web/Node bundle never requires it. Throws an actionable error if a native
|
|
4325
|
+
// app calls hosted login without installing it.
|
|
4326
|
+
async function loadExpoWebBrowser() {
|
|
4327
|
+
try {
|
|
4328
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
4329
|
+
return await import('expo-web-browser');
|
|
4330
|
+
}
|
|
4331
|
+
catch (_a) {
|
|
4332
|
+
throw new Error('React Native hosted login requires the optional peer dependency "expo-web-browser". ' +
|
|
4333
|
+
'Install it with `npx expo install expo-web-browser` (and `expo-crypto`), then retry.');
|
|
4334
|
+
}
|
|
4288
4335
|
}
|
|
4289
|
-
|
|
4290
|
-
|
|
4336
|
+
// Parse code/state out of the universal-link callback URL. Hand-rolled (no `new URL()`)
|
|
4337
|
+
// because React Native's URL implementation is non-spec-compliant for query parsing.
|
|
4338
|
+
function parseCallbackParams(callbackUrl) {
|
|
4339
|
+
var _a, _b;
|
|
4340
|
+
const qIndex = callbackUrl.indexOf('?');
|
|
4341
|
+
if (qIndex < 0)
|
|
4342
|
+
return { code: null, state: null };
|
|
4343
|
+
const query = callbackUrl.slice(qIndex + 1).split('#')[0];
|
|
4344
|
+
const out = {};
|
|
4345
|
+
for (const part of query.split('&')) {
|
|
4346
|
+
if (!part)
|
|
4347
|
+
continue;
|
|
4348
|
+
const eq = part.indexOf('=');
|
|
4349
|
+
const k = eq < 0 ? part : part.slice(0, eq);
|
|
4350
|
+
const v = eq < 0 ? '' : part.slice(eq + 1);
|
|
4351
|
+
try {
|
|
4352
|
+
out[decodeURIComponent(k)] = decodeURIComponent(v.replace(/\+/g, ' '));
|
|
4353
|
+
}
|
|
4354
|
+
catch (_c) {
|
|
4355
|
+
out[k] = v;
|
|
4356
|
+
}
|
|
4357
|
+
}
|
|
4358
|
+
return { code: (_a = out['code']) !== null && _a !== void 0 ? _a : null, state: (_b = out['state']) !== null && _b !== void 0 ? _b : null };
|
|
4359
|
+
}
|
|
4360
|
+
// Full native login: open the hosted page in the system auth session, await the
|
|
4361
|
+
// universal-link callback, verify state, and run the SAME PKCE code→token exchange
|
|
4362
|
+
// as web. Returns the signed-in User (native completes inline — there's no separate
|
|
4363
|
+
// completeLoginFromRedirect() round-trip the way the web full-page redirect needs).
|
|
4364
|
+
async function runNativeLogin(opts, guestHint) {
|
|
4365
|
+
var _a, _b;
|
|
4366
|
+
const { url, pkce } = await buildAuthorize(opts, guestHint);
|
|
4367
|
+
const WebBrowser = await loadExpoWebBrowser();
|
|
4368
|
+
const openAuthSession = WebBrowser.openAuthSessionAsync || ((_a = WebBrowser.default) === null || _a === void 0 ? void 0 : _a.openAuthSessionAsync);
|
|
4369
|
+
if (typeof openAuthSession !== 'function') {
|
|
4370
|
+
throw new Error('expo-web-browser.openAuthSessionAsync is unavailable — update expo-web-browser.');
|
|
4371
|
+
}
|
|
4372
|
+
setAuthLoading(true);
|
|
4373
|
+
try {
|
|
4374
|
+
// openAuthSessionAsync keeps JS alive while the system browser is shown, then
|
|
4375
|
+
// resolves with the callback URL once the universal link fires — so `pkce`
|
|
4376
|
+
// stays in scope and never needs to be persisted.
|
|
4377
|
+
const result = await openAuthSession(url, opts.redirectUri);
|
|
4378
|
+
if (!result || result.type === 'cancel' || result.type === 'dismiss') {
|
|
4379
|
+
throw new Error('Login cancelled');
|
|
4380
|
+
}
|
|
4381
|
+
if (result.type !== 'success' || typeof result.url !== 'string') {
|
|
4382
|
+
throw new Error(`Hosted login did not complete (result: ${(_b = result === null || result === void 0 ? void 0 : result.type) !== null && _b !== void 0 ? _b : 'unknown'})`);
|
|
4383
|
+
}
|
|
4384
|
+
const { code, state: returnedState } = parseCallbackParams(result.url);
|
|
4385
|
+
if (!code)
|
|
4386
|
+
throw new Error('No authorization code in the callback URL');
|
|
4387
|
+
if (!returnedState || returnedState !== pkce.state) {
|
|
4388
|
+
throw new Error('OAuth state mismatch — possible CSRF; aborting');
|
|
4389
|
+
}
|
|
4390
|
+
return await exchangeCode(code, pkce.verifier, pkce.redirectUri);
|
|
4391
|
+
}
|
|
4392
|
+
finally {
|
|
4393
|
+
setAuthLoading(false);
|
|
4394
|
+
}
|
|
4395
|
+
}
|
|
4396
|
+
/** Start hosted login (Google / Apple / email / hosted phone). Works on WEB and REACT NATIVE.
|
|
4397
|
+
*
|
|
4398
|
+
* WEB: navigates the whole page to the hosted Bounded login and resolves (void) as the page
|
|
4399
|
+
* unloads; on return to `redirectUri?code=...` you call completeLoginFromRedirect().
|
|
4400
|
+
*
|
|
4401
|
+
* REACT NATIVE: opens the hosted page via expo-web-browser, awaits the https universal-link
|
|
4402
|
+
* callback, runs the PKCE exchange INLINE, and resolves with the signed-in User. No
|
|
4403
|
+
* completeLoginFromRedirect() call is needed on native. Requires `redirectUri` to be an
|
|
4404
|
+
* https UNIVERSAL LINK whose origin the app owner registered in the app's allowedOrigins
|
|
4405
|
+
* (custom `myapp://` schemes are rejected by the issuer). Needs the optional peer deps
|
|
4406
|
+
* expo-web-browser + (expo-crypto or react-native-get-random-values). */
|
|
4291
4407
|
async function loginWithRedirect(opts) {
|
|
4408
|
+
if (isNative())
|
|
4409
|
+
return runNativeLogin(opts);
|
|
4292
4410
|
if (!hasDOM())
|
|
4293
|
-
throw new Error('loginWithRedirect
|
|
4294
|
-
const url = await
|
|
4411
|
+
throw new Error('loginWithRedirect requires a browser or a configured React Native platform');
|
|
4412
|
+
const { url, pkce } = await buildAuthorize(opts);
|
|
4413
|
+
// Stash the verifier + state so the redirect_uri page can finish the exchange. sessionStorage
|
|
4414
|
+
// is per-tab and cleared on close — appropriate for a short-lived auth handshake.
|
|
4415
|
+
sessionStorage.setItem(PKCE_STORE_KEY, JSON.stringify(pkce));
|
|
4295
4416
|
window.location.href = url;
|
|
4296
4417
|
}
|
|
4297
|
-
const LINK_GUEST_KEY = 'bounded.link.guest';
|
|
4298
4418
|
/** UPGRADE the current anonymous (guest) session by linking a SOCIAL/redirect login
|
|
4299
|
-
* (e.g. Google) — Firebase `linkWithPopup`/redirect parity.
|
|
4300
|
-
*
|
|
4301
|
-
*
|
|
4302
|
-
*
|
|
4419
|
+
* (e.g. Google) — Firebase `linkWithPopup`/redirect parity. Carries the guest's signed
|
|
4420
|
+
* id-token THROUGH the OIDC authorize request (as a single-use hint bound to the PKCE
|
|
4421
|
+
* challenge), then runs the normal redirect login. The issuer completes the link during
|
|
4422
|
+
* the standard code→token exchange: if the chosen account is brand-new the guest's
|
|
4423
|
+
* `@user.id` is preserved (the returned id_token is minted under it), else the account
|
|
4424
|
+
* stays separate (guest id discarded). Requires an active guest session.
|
|
4425
|
+
*
|
|
4426
|
+
* Works on WEB (navigates, finish with completeLoginFromRedirect) and REACT NATIVE
|
|
4427
|
+
* (opens expo-web-browser and resolves with the upgraded User inline). */
|
|
4303
4428
|
async function linkWithRedirect(opts) {
|
|
4304
|
-
if (!hasDOM())
|
|
4305
|
-
throw new Error('linkWithRedirect is web-only');
|
|
4306
4429
|
const guestToken = sessionManager().getIdToken();
|
|
4307
4430
|
if (!guestToken)
|
|
4308
4431
|
throw new Error('linkWithRedirect requires an active anonymous session — call signInAnonymously() first.');
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
window.location.href = url;
|
|
4312
|
-
}
|
|
4313
|
-
// If a guest-link is pending (linkWithRedirect stashed a guest token before this
|
|
4314
|
-
// redirect), exchange it + the fresh social token for an UPGRADED token via
|
|
4315
|
-
// /link/social and replace the session. Returns the upgraded user, or null if no
|
|
4316
|
-
// link was pending / the link failed (in which case the plain social login stands).
|
|
4317
|
-
async function finishGuestLinkIfPending(socialIdToken) {
|
|
4432
|
+
if (isNative())
|
|
4433
|
+
return runNativeLogin(opts, guestToken);
|
|
4318
4434
|
if (!hasDOM())
|
|
4319
|
-
|
|
4320
|
-
const
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
sessionStorage.removeItem(LINK_GUEST_KEY);
|
|
4324
|
-
try {
|
|
4325
|
-
const cfg = await getConfig();
|
|
4326
|
-
const base = await issuerBase();
|
|
4327
|
-
const res = await fetch(`${base}/link/social`, {
|
|
4328
|
-
method: 'POST', headers: { 'content-type': 'application/json' },
|
|
4329
|
-
body: JSON.stringify({ appId: cfg.appId, guestToken, socialToken: socialIdToken }),
|
|
4330
|
-
});
|
|
4331
|
-
const data = await res.json().catch(() => null);
|
|
4332
|
-
const idToken = tokenField(data, 'id_token', 'idToken');
|
|
4333
|
-
if (!res.ok || !idToken)
|
|
4334
|
-
return null; // link failed -> keep the plain social session
|
|
4335
|
-
const upgraded = userFromIdToken(idToken);
|
|
4336
|
-
const accessToken = tokenField(data, 'access_token', 'accessToken') || idToken;
|
|
4337
|
-
const refreshToken = boundedRefreshTokenField(data);
|
|
4338
|
-
await sessionManager().storeSession(String(upgraded.address || ''), accessToken, idToken, refreshToken, base);
|
|
4339
|
-
setCurrentUser(upgraded);
|
|
4340
|
-
return upgraded;
|
|
4341
|
-
}
|
|
4342
|
-
catch (_a) {
|
|
4343
|
-
return null;
|
|
4344
|
-
}
|
|
4435
|
+
throw new Error('linkWithRedirect requires a browser or a configured React Native platform');
|
|
4436
|
+
const { url, pkce } = await buildAuthorize(opts, guestToken);
|
|
4437
|
+
sessionStorage.setItem(PKCE_STORE_KEY, JSON.stringify(pkce));
|
|
4438
|
+
window.location.href = url;
|
|
4345
4439
|
}
|
|
4346
|
-
/** Finish login on the redirect_uri page: exchange ?code= for a token (PKCE-verified),
|
|
4347
|
-
* the session, and return the User. Idempotent: returns null if there's no ?code= in the URL.
|
|
4440
|
+
/** Finish login on the redirect_uri page (WEB ONLY): exchange ?code= for a token (PKCE-verified),
|
|
4441
|
+
* store the session, and return the User. Idempotent: returns null if there's no ?code= in the URL.
|
|
4442
|
+
* When the redirect was a guest UPGRADE (linkWithRedirect) and the issuer adopted the guest
|
|
4443
|
+
* id, the exchanged id_token already carries the preserved `@user.id`, so the returned User
|
|
4444
|
+
* reflects it automatically (no extra round-trip).
|
|
4445
|
+
*
|
|
4446
|
+
* On REACT NATIVE this returns null and is a no-op: native login completes INLINE inside
|
|
4447
|
+
* loginWithRedirect()/linkWithRedirect() (which resolve with the User), so there is no
|
|
4448
|
+
* separate redirect page to finish from. Calling it on RN is harmless. */
|
|
4348
4449
|
async function completeLoginFromRedirect() {
|
|
4349
4450
|
if (!hasDOM())
|
|
4350
4451
|
return null;
|
|
@@ -4363,15 +4464,11 @@ async function completeLoginFromRedirect() {
|
|
|
4363
4464
|
throw new Error('OAuth state mismatch — possible CSRF; aborting');
|
|
4364
4465
|
const user = await exchangeCode(code, pkce.verifier, pkce.redirectUri);
|
|
4365
4466
|
sessionStorage.removeItem(PKCE_STORE_KEY);
|
|
4366
|
-
// If this redirect was a guest UPGRADE (linkWithRedirect), finish the link now:
|
|
4367
|
-
// swap the fresh social session for one minted under the guest's preserved id.
|
|
4368
|
-
const socialIdToken = sessionManager().getIdToken();
|
|
4369
|
-
const upgraded = socialIdToken ? await finishGuestLinkIfPending(socialIdToken) : null;
|
|
4370
4467
|
// Strip code/state from the URL so a reload doesn't re-exchange (codes are single-use anyway).
|
|
4371
4468
|
url.searchParams.delete('code');
|
|
4372
4469
|
url.searchParams.delete('state');
|
|
4373
4470
|
window.history.replaceState({}, document.title, url.pathname + url.search + url.hash);
|
|
4374
|
-
return
|
|
4471
|
+
return user;
|
|
4375
4472
|
}
|
|
4376
4473
|
finally {
|
|
4377
4474
|
setAuthLoading(false);
|
|
@@ -4381,8 +4478,9 @@ async function completeLoginFromRedirect() {
|
|
|
4381
4478
|
* redirect_uri page posts the code back. The redirect_uri page must call completeLoginInPopup(). */
|
|
4382
4479
|
async function loginWithPopup(opts) {
|
|
4383
4480
|
if (!hasDOM())
|
|
4384
|
-
throw new Error('loginWithPopup is web-only');
|
|
4385
|
-
const url = await
|
|
4481
|
+
throw new Error('loginWithPopup is web-only — on React Native use loginWithRedirect()');
|
|
4482
|
+
const { url, pkce } = await buildAuthorize(opts);
|
|
4483
|
+
sessionStorage.setItem(PKCE_STORE_KEY, JSON.stringify(pkce));
|
|
4386
4484
|
const w = opts.width || 480, h = opts.height || 720;
|
|
4387
4485
|
const left = window.screenX + (window.outerWidth - w) / 2;
|
|
4388
4486
|
const top = window.screenY + (window.outerHeight - h) / 2;
|
|
@@ -4589,17 +4687,17 @@ function clearIncompatibleSession() {
|
|
|
4589
4687
|
// Lazy loaders for web-only providers.
|
|
4590
4688
|
// Using dynamic import() ensures Metro (RN) never resolves these modules.
|
|
4591
4689
|
async function loadPhantomWalletProvider() {
|
|
4592
|
-
const mod = await import('./phantom-wallet-provider-
|
|
4690
|
+
const mod = await import('./phantom-wallet-provider-B3ztJGu2.mjs');
|
|
4593
4691
|
return { PhantomWalletProvider: mod.PhantomWalletProvider };
|
|
4594
4692
|
}
|
|
4595
4693
|
// Web Privy provider (depends on react-dom + @privy-io/react-auth). Lazy so Metro
|
|
4596
4694
|
// never bundles it into the RN build — RN uses the @privy-io/expo provider instead.
|
|
4597
4695
|
async function loadPrivyWalletProvider() {
|
|
4598
|
-
const mod = await import('./privy-wallet-provider-
|
|
4696
|
+
const mod = await import('./privy-wallet-provider-D2i_xwYW.mjs');
|
|
4599
4697
|
return mod.PrivyWalletProvider;
|
|
4600
4698
|
}
|
|
4601
4699
|
async function loadSolanaMobileWalletProvider() {
|
|
4602
|
-
const mod = await import('./solana-mobile-wallet-provider-
|
|
4700
|
+
const mod = await import('./solana-mobile-wallet-provider-dOWiujmo.mjs');
|
|
4603
4701
|
return mod.SolanaMobileWalletProvider;
|
|
4604
4702
|
}
|
|
4605
4703
|
function requireWebPrivyConfig(config) {
|
|
@@ -5641,4 +5739,4 @@ class PrivyExpoProvider {
|
|
|
5641
5739
|
}
|
|
5642
5740
|
|
|
5643
5741
|
export { loginWithRedirect as A, linkWithRedirect as B, completeLoginFromRedirect as C, loginWithPopup as D, completeLoginInPopup as E, useAuth as F, deserializeTransaction as G, getIdToken as H, setPlatform as I, index as J, OffchainAuthProvider as O, PrivyExpoProvider as P, SURFNET_RPC_URL as S, detectAndroid as a, bufferExports as b, confirmAndCheckTransaction as c, detectMobile as d, setAuthLoading as e, resolveSolanaWalletStandardChain as f, getPlatform as g, bs58 as h, init as i, getCurrentUser as j, onAuthLoadingChanged as k, getAuthLoading as l, login as m, normalizeSolanaRpcUrl as n, onAuthStateChanged as o, logout as p, getAuthProvider as q, resolveSolanaRpcUrl as r, setCurrentUser as s, signInAnonymously as t, sendEmailOtp as u, sendTextOtp as v, verifyEmailOtp as w, verifyTextOtp as x, linkEmail as y, loginWithPrivy as z };
|
|
5644
|
-
//# sourceMappingURL=index.native-
|
|
5742
|
+
//# sourceMappingURL=index.native-DEWlFCQV.mjs.map
|