@bounded-sh/client 0.0.112 → 0.0.113
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/providers/injected-wallet-provider.d.ts +7 -0
- package/dist/auth/providers/injected-wallet-types.d.ts +2 -0
- package/dist/auth/providers/solana-mobile-registration.d.ts +18 -0
- package/dist/{email-auth-provider-D0_iXVYk.mjs → email-auth-provider-Bk5GSpYT.mjs} +2 -2
- package/dist/{email-auth-provider-D0_iXVYk.mjs.map → email-auth-provider-Bk5GSpYT.mjs.map} +1 -1
- package/dist/{email-auth-provider-OVzQ63dn.js → email-auth-provider-Cr66GaKw.js} +2 -2
- package/dist/{email-auth-provider-OVzQ63dn.js.map → email-auth-provider-Cr66GaKw.js.map} +1 -1
- package/dist/{email-auth-provider-CyFsnSzx.js → email-auth-provider-DeORQbTK.js} +2 -2
- package/dist/{email-auth-provider-CyFsnSzx.js.map → email-auth-provider-DeORQbTK.js.map} +1 -1
- package/dist/{email-auth-provider-BV1Iea4A.mjs → email-auth-provider-nDZjRDpj.mjs} +2 -2
- package/dist/{email-auth-provider-BV1Iea4A.mjs.map → email-auth-provider-nDZjRDpj.mjs.map} +1 -1
- package/dist/{guest-auth-provider-B4WIWOjV.js → guest-auth-provider-5bX-xt6K.js} +2 -2
- package/dist/{guest-auth-provider-B4WIWOjV.js.map → guest-auth-provider-5bX-xt6K.js.map} +1 -1
- package/dist/{guest-auth-provider-0WlOutqU.js → guest-auth-provider-CUNkZVFK.js} +2 -2
- package/dist/{guest-auth-provider-0WlOutqU.js.map → guest-auth-provider-CUNkZVFK.js.map} +1 -1
- package/dist/{guest-auth-provider-AP80a700.mjs → guest-auth-provider-DDudqqxY.mjs} +2 -2
- package/dist/{guest-auth-provider-Cqx1zH23.mjs.map → guest-auth-provider-DDudqqxY.mjs.map} +1 -1
- package/dist/{guest-auth-provider-Cqx1zH23.mjs → guest-auth-provider-ejUTbjCC.mjs} +2 -2
- package/dist/{guest-auth-provider-AP80a700.mjs.map → guest-auth-provider-ejUTbjCC.mjs.map} +1 -1
- package/dist/{index-D76-cZcD.mjs → index-BAiLpNEQ.mjs} +71 -17
- package/dist/index-BAiLpNEQ.mjs.map +1 -0
- package/dist/{index-BmNNZlTl.js → index-BZ0X1Z9X.js} +71 -17
- package/dist/index-BZ0X1Z9X.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{index.native-C5glqiTU.js → index.native-DJSOqyKQ.js} +49 -7
- package/dist/index.native-DJSOqyKQ.js.map +1 -0
- package/dist/{index.native-DyR93n8K.mjs → index.native-DcW2klyn.mjs} +48 -8
- package/dist/index.native-DcW2klyn.mjs.map +1 -0
- package/dist/index.native.js +1 -1
- package/dist/index.native.mjs +1 -1
- package/dist/{injected-evm-wallet-provider-4ICYUEU4.js → injected-evm-wallet-provider-BDYWjIOQ.js} +2 -2
- package/dist/{injected-evm-wallet-provider-4ICYUEU4.js.map → injected-evm-wallet-provider-BDYWjIOQ.js.map} +1 -1
- package/dist/{injected-evm-wallet-provider-CS4R8c51.mjs → injected-evm-wallet-provider-BQ_kG1vI.mjs} +2 -2
- package/dist/{injected-evm-wallet-provider-CS4R8c51.mjs.map → injected-evm-wallet-provider-BQ_kG1vI.mjs.map} +1 -1
- package/dist/{injected-evm-wallet-provider-WxUbyMZL.mjs → injected-evm-wallet-provider-C4aKa2v1.mjs} +2 -2
- package/dist/{injected-evm-wallet-provider-WxUbyMZL.mjs.map → injected-evm-wallet-provider-C4aKa2v1.mjs.map} +1 -1
- package/dist/{injected-evm-wallet-provider-C8YItSiB.js → injected-evm-wallet-provider-D06arDQD.js} +2 -2
- package/dist/{injected-evm-wallet-provider-C8YItSiB.js.map → injected-evm-wallet-provider-D06arDQD.js.map} +1 -1
- package/dist/{injected-wallet-provider-D8vIsUHf.js → injected-wallet-provider-B9jvzDM5.js} +51 -22
- package/dist/{injected-wallet-provider-D8vIsUHf.js.map → injected-wallet-provider-B9jvzDM5.js.map} +1 -1
- package/dist/{injected-wallet-provider-UuGrzdNW.mjs → injected-wallet-provider-Dj-F69gb.mjs} +51 -22
- package/dist/{injected-wallet-provider-UuGrzdNW.mjs.map → injected-wallet-provider-Dj-F69gb.mjs.map} +1 -1
- package/dist/{injected-wallet-provider-nwd3ialR.js → injected-wallet-provider-Dqmk-m4V.js} +67 -26
- package/dist/{injected-wallet-provider-nwd3ialR.js.map → injected-wallet-provider-Dqmk-m4V.js.map} +1 -1
- package/dist/{injected-wallet-provider-D1ygndjX.mjs → injected-wallet-provider-DxPcYxP-.mjs} +67 -26
- package/dist/{injected-wallet-provider-D1ygndjX.mjs.map → injected-wallet-provider-DxPcYxP-.mjs.map} +1 -1
- package/package.json +2 -2
- package/dist/index-BmNNZlTl.js.map +0 -1
- package/dist/index-D76-cZcD.mjs.map +0 -1
- package/dist/index.native-C5glqiTU.js.map +0 -1
- package/dist/index.native-DyR93n8K.mjs.map +0 -1
package/dist/{injected-wallet-provider-UuGrzdNW.mjs → injected-wallet-provider-Dj-F69gb.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getActiveSessionManager, genAuthNonce, genSolanaSignInRequest, createSessionWithSignature } from '@bounded-sh/core';
|
|
2
|
-
import { e as bs58, n as normalizeSolanaRpcUrl, f as defaultInjectedProvider, i as firstStandardWalletProvider, j as setAuthLoading, s as setCurrentUser, k as bufferExports, l as setStoredAuthMethod, g as getPlatform, t as transactionHasSignature, m as confirmAndCheckTransaction, r as resolveSolanaRpcUrl } from './index-
|
|
2
|
+
import { e as bs58, n as normalizeSolanaRpcUrl, f as defaultInjectedProvider, i as firstStandardWalletProvider, j as setAuthLoading, s as setCurrentUser, k as bufferExports, l as setStoredAuthMethod, g as getPlatform, t as transactionHasSignature, m as confirmAndCheckTransaction, r as resolveSolanaRpcUrl } from './index-BAiLpNEQ.mjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
const crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
|
|
@@ -2465,37 +2465,66 @@ class InjectedWalletProvider {
|
|
|
2465
2465
|
throw new Error('Wallet did not return a public key on connect');
|
|
2466
2466
|
return pk.toString();
|
|
2467
2467
|
}
|
|
2468
|
+
/**
|
|
2469
|
+
* The account the wallet already holds open for this page, named WITHOUT a
|
|
2470
|
+
* prompt: a live connection, else a silent connect (an injected wallet that
|
|
2471
|
+
* still trusts the page; the mobile wallet's cached authorization, read from
|
|
2472
|
+
* storage). Null when the wallet would have to ask the user.
|
|
2473
|
+
*/
|
|
2474
|
+
async trustedAddress(provider) {
|
|
2475
|
+
try {
|
|
2476
|
+
return await this.connectAddress(provider, true);
|
|
2477
|
+
}
|
|
2478
|
+
catch (_a) {
|
|
2479
|
+
return null;
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2468
2482
|
async login() {
|
|
2483
|
+
var _a;
|
|
2469
2484
|
setAuthLoading(true);
|
|
2470
2485
|
try {
|
|
2471
2486
|
const provider = this.resolveProvider();
|
|
2472
|
-
|
|
2473
|
-
//
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2487
|
+
// SEC-01: a wallet without Sign In With Solana is refused before it is
|
|
2488
|
+
// asked anything, never downgraded to plain message signing.
|
|
2489
|
+
if (typeof provider.signIn !== 'function')
|
|
2490
|
+
throw new Error(WALLET_SIGN_IN_UNSUPPORTED_ERR);
|
|
2491
|
+
// Reuse a still-valid session for THIS wallet, when the wallet names its
|
|
2492
|
+
// account without prompting. Nothing here opens the wallet: the sign-in
|
|
2493
|
+
// below is the one interactive step of a login.
|
|
2494
|
+
const trusted = await this.trustedAddress(provider);
|
|
2495
|
+
const existing = trusted ? await getActiveSessionManager().getSession() : null;
|
|
2496
|
+
if (trusted && existing && existing.address === trusted) {
|
|
2497
|
+
const user = { address: trusted, id: trusted, provider: this };
|
|
2498
|
+
this.authenticatedAddress = trusted;
|
|
2478
2499
|
setCurrentUser(user);
|
|
2479
2500
|
this.markAuthMethod();
|
|
2480
2501
|
return user;
|
|
2481
2502
|
}
|
|
2482
|
-
// Sign In With Solana (SEC-01)
|
|
2483
|
-
//
|
|
2484
|
-
//
|
|
2485
|
-
//
|
|
2486
|
-
//
|
|
2487
|
-
//
|
|
2488
|
-
//
|
|
2489
|
-
//
|
|
2490
|
-
// wallet
|
|
2491
|
-
|
|
2492
|
-
|
|
2503
|
+
// Sign In With Solana (SEC-01) is connect and sign in ONE wallet step:
|
|
2504
|
+
// the wallet authorizes an account, renders the standard sign-in text
|
|
2505
|
+
// for it and, with the domain left unset here, stamps THIS page's host;
|
|
2506
|
+
// the issuer refuses any other domain for the request's Origin, so a
|
|
2507
|
+
// phishing page cannot obtain a login for another site. Bounded chooses
|
|
2508
|
+
// only the nonce, the validity window and the app id (Request ID).
|
|
2509
|
+
// No separate connect comes first: the mobile adapter would answer the
|
|
2510
|
+
// sign-in from the authorization that connect cached, with no sign-in
|
|
2511
|
+
// result in it, and a second wallet prompt is friction for every other
|
|
2512
|
+
// wallet. The nonce is fetched BEFORE the gesture below, so nothing
|
|
2513
|
+
// async sits between the tap and the wallet handoff - a network round
|
|
2514
|
+
// trip there decays the transient activation the mobile wallet's intent
|
|
2515
|
+
// navigation needs.
|
|
2493
2516
|
const nonce = await genAuthNonce();
|
|
2494
2517
|
const request = await genSolanaSignInRequest(nonce);
|
|
2495
|
-
await this.freshActivation(provider, 'login',
|
|
2518
|
+
await this.freshActivation(provider, 'login', trusted);
|
|
2496
2519
|
const signedIn = normalizeSignInOutput(await provider.signIn(request));
|
|
2497
|
-
|
|
2498
|
-
|
|
2520
|
+
const address = signedIn.account.address;
|
|
2521
|
+
// The account the wallet now reports as open must be the one that signed
|
|
2522
|
+
// in: a proof for another account would bind this session to an identity
|
|
2523
|
+
// the wallet is not acting as (DS2-0369). A wallet that reports no account
|
|
2524
|
+
// leaves the sign-in output as the only word on which one it is.
|
|
2525
|
+
const active = (_a = provider.publicKey) === null || _a === void 0 ? void 0 : _a.toString();
|
|
2526
|
+
if (active && active !== address) {
|
|
2527
|
+
throw new Error(`The wallet signed in as ${address}, not the connected account ${active}. Sign in again.`);
|
|
2499
2528
|
}
|
|
2500
2529
|
// The issuer verifies the signature over the EXACT bytes the wallet signed
|
|
2501
2530
|
// and parses them, so the text travels as the wallet rendered it.
|
|
@@ -2813,4 +2842,4 @@ class InjectedWalletProvider {
|
|
|
2813
2842
|
}
|
|
2814
2843
|
|
|
2815
2844
|
export { InjectedWalletProvider, WALLET_SIGN_IN_UNSUPPORTED_ERR, defaultInjectedProvider };
|
|
2816
|
-
//# sourceMappingURL=injected-wallet-provider-
|
|
2845
|
+
//# sourceMappingURL=injected-wallet-provider-Dj-F69gb.mjs.map
|