@bounded-sh/client 0.0.112 → 0.0.114
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-D1ygndjX.mjs → injected-wallet-provider-DxPcYxP-.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getActiveSessionManager, genAuthNonce, genSolanaSignInRequest, createSessionWithSignature } from '@bounded-sh/core';
|
|
2
|
-
import { e as bs58, f as getWallets, i as isSolanaMobileWallet, j as solanaMobileWalletLeavesPage, r as resolveSolanaWalletStandardChain, n as normalizeSolanaRpcUrl,
|
|
2
|
+
import { e as bs58, f as getWallets, i as isSolanaMobileWallet, j as solanaMobileWalletLeavesPage, k as solanaMobileWalletAnswersSignInFromCache, r as resolveSolanaWalletStandardChain, w as walletStandardFeatureName, n as normalizeSolanaRpcUrl, l as setAuthLoading, s as setCurrentUser, m as bufferExports, o as setStoredAuthMethod, g as getPlatform, t as transactionHasSignature, p as confirmAndCheckTransaction, q as resolveSolanaRpcUrl } from './index.native-DcW2klyn.mjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
const crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
|
|
@@ -2468,7 +2468,9 @@ function standardWalletToInjectedProvider(wallet, configuredNetwork) {
|
|
|
2468
2468
|
// mobile adapter fills DEFAULT_FEATURES in exactly that case. So an empty list
|
|
2469
2469
|
// means none, and reading it as "everything" picks an account that cannot sign
|
|
2470
2470
|
// and fails at the wallet instead of here.
|
|
2471
|
-
|
|
2471
|
+
// The mobile adapter hands a wallet app's own feature names through
|
|
2472
|
+
// untranslated, so each name is read as its Wallet Standard equivalent.
|
|
2473
|
+
const accountSupports = (account, feature) => account.features.some((f) => walletStandardFeatureName(f) === feature);
|
|
2472
2474
|
const pickSolanaAccount = (accounts) => {
|
|
2473
2475
|
// With a network configured, an account that does not support it is not a
|
|
2474
2476
|
// usable account: `WalletAccount.chains` is what that account can sign for,
|
|
@@ -2543,13 +2545,23 @@ function standardWalletToInjectedProvider(wallet, configuredNetwork) {
|
|
|
2543
2545
|
} }, (hasFeature(wallet, SolanaSignIn)
|
|
2544
2546
|
? {
|
|
2545
2547
|
async signIn(input) {
|
|
2546
|
-
|
|
2547
|
-
if (!accountSupports(acc, SolanaSignIn))
|
|
2548
|
-
throw new Error("Wallet account does not support solana:signIn");
|
|
2548
|
+
var _a;
|
|
2549
2549
|
const sign = feature(wallet, SolanaSignIn);
|
|
2550
2550
|
if (!sign)
|
|
2551
2551
|
throw new Error("Wallet does not support solana:signIn");
|
|
2552
|
+
const open = currentAccount();
|
|
2553
|
+
if (open && !accountSupports(open, SolanaSignIn))
|
|
2554
|
+
throw new Error("Wallet account does not support solana:signIn");
|
|
2555
|
+
if (solanaMobileWalletAnswersSignInFromCache(wallet.name)) {
|
|
2556
|
+
// Drop the cached authorization so this sign-in is performed by the
|
|
2557
|
+
// wallet app, with its payload, rather than answered from a record
|
|
2558
|
+
// that holds no sign-in result or an earlier sign-in's spent nonce.
|
|
2559
|
+
// Local to the page: the adapter's disconnect opens nothing.
|
|
2560
|
+
await ((_a = feature(wallet, StandardDisconnect)) === null || _a === void 0 ? void 0 : _a.disconnect());
|
|
2561
|
+
}
|
|
2552
2562
|
const [out] = await sign.signIn(input);
|
|
2563
|
+
if (!out)
|
|
2564
|
+
throw new Error("Wallet returned no sign-in result");
|
|
2553
2565
|
return { account: { address: out.account.address }, signedMessage: out.signedMessage, signature: out.signature };
|
|
2554
2566
|
},
|
|
2555
2567
|
}
|
|
@@ -2832,37 +2844,66 @@ class InjectedWalletProvider {
|
|
|
2832
2844
|
throw new Error('Wallet did not return a public key on connect');
|
|
2833
2845
|
return pk.toString();
|
|
2834
2846
|
}
|
|
2847
|
+
/**
|
|
2848
|
+
* The account the wallet already holds open for this page, named WITHOUT a
|
|
2849
|
+
* prompt: a live connection, else a silent connect (an injected wallet that
|
|
2850
|
+
* still trusts the page; the mobile wallet's cached authorization, read from
|
|
2851
|
+
* storage). Null when the wallet would have to ask the user.
|
|
2852
|
+
*/
|
|
2853
|
+
async trustedAddress(provider) {
|
|
2854
|
+
try {
|
|
2855
|
+
return await this.connectAddress(provider, true);
|
|
2856
|
+
}
|
|
2857
|
+
catch (_a) {
|
|
2858
|
+
return null;
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2835
2861
|
async login() {
|
|
2862
|
+
var _a;
|
|
2836
2863
|
setAuthLoading(true);
|
|
2837
2864
|
try {
|
|
2838
2865
|
const provider = this.resolveProvider();
|
|
2839
|
-
|
|
2840
|
-
//
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2866
|
+
// SEC-01: a wallet without Sign In With Solana is refused before it is
|
|
2867
|
+
// asked anything, never downgraded to plain message signing.
|
|
2868
|
+
if (typeof provider.signIn !== 'function')
|
|
2869
|
+
throw new Error(WALLET_SIGN_IN_UNSUPPORTED_ERR);
|
|
2870
|
+
// Reuse a still-valid session for THIS wallet, when the wallet names its
|
|
2871
|
+
// account without prompting. Nothing here opens the wallet: the sign-in
|
|
2872
|
+
// below is the one interactive step of a login.
|
|
2873
|
+
const trusted = await this.trustedAddress(provider);
|
|
2874
|
+
const existing = trusted ? await getActiveSessionManager().getSession() : null;
|
|
2875
|
+
if (trusted && existing && existing.address === trusted) {
|
|
2876
|
+
const user = { address: trusted, id: trusted, provider: this };
|
|
2877
|
+
this.authenticatedAddress = trusted;
|
|
2845
2878
|
setCurrentUser(user);
|
|
2846
2879
|
this.markAuthMethod();
|
|
2847
2880
|
return user;
|
|
2848
2881
|
}
|
|
2849
|
-
// Sign In With Solana (SEC-01)
|
|
2850
|
-
//
|
|
2851
|
-
//
|
|
2852
|
-
//
|
|
2853
|
-
//
|
|
2854
|
-
//
|
|
2855
|
-
//
|
|
2856
|
-
//
|
|
2857
|
-
// wallet
|
|
2858
|
-
|
|
2859
|
-
|
|
2882
|
+
// Sign In With Solana (SEC-01) is connect and sign in ONE wallet step:
|
|
2883
|
+
// the wallet authorizes an account, renders the standard sign-in text
|
|
2884
|
+
// for it and, with the domain left unset here, stamps THIS page's host;
|
|
2885
|
+
// the issuer refuses any other domain for the request's Origin, so a
|
|
2886
|
+
// phishing page cannot obtain a login for another site. Bounded chooses
|
|
2887
|
+
// only the nonce, the validity window and the app id (Request ID).
|
|
2888
|
+
// No separate connect comes first: the mobile adapter would answer the
|
|
2889
|
+
// sign-in from the authorization that connect cached, with no sign-in
|
|
2890
|
+
// result in it, and a second wallet prompt is friction for every other
|
|
2891
|
+
// wallet. The nonce is fetched BEFORE the gesture below, so nothing
|
|
2892
|
+
// async sits between the tap and the wallet handoff - a network round
|
|
2893
|
+
// trip there decays the transient activation the mobile wallet's intent
|
|
2894
|
+
// navigation needs.
|
|
2860
2895
|
const nonce = await genAuthNonce();
|
|
2861
2896
|
const request = await genSolanaSignInRequest(nonce);
|
|
2862
|
-
await this.freshActivation(provider, 'login',
|
|
2897
|
+
await this.freshActivation(provider, 'login', trusted);
|
|
2863
2898
|
const signedIn = normalizeSignInOutput(await provider.signIn(request));
|
|
2864
|
-
|
|
2865
|
-
|
|
2899
|
+
const address = signedIn.account.address;
|
|
2900
|
+
// The account the wallet now reports as open must be the one that signed
|
|
2901
|
+
// in: a proof for another account would bind this session to an identity
|
|
2902
|
+
// the wallet is not acting as (DS2-0369). A wallet that reports no account
|
|
2903
|
+
// leaves the sign-in output as the only word on which one it is.
|
|
2904
|
+
const active = (_a = provider.publicKey) === null || _a === void 0 ? void 0 : _a.toString();
|
|
2905
|
+
if (active && active !== address) {
|
|
2906
|
+
throw new Error(`The wallet signed in as ${address}, not the connected account ${active}. Sign in again.`);
|
|
2866
2907
|
}
|
|
2867
2908
|
// The issuer verifies the signature over the EXACT bytes the wallet signed
|
|
2868
2909
|
// and parses them, so the text travels as the wallet rendered it.
|
|
@@ -3180,4 +3221,4 @@ class InjectedWalletProvider {
|
|
|
3180
3221
|
}
|
|
3181
3222
|
|
|
3182
3223
|
export { InjectedWalletProvider, WALLET_SIGN_IN_UNSUPPORTED_ERR, defaultInjectedProvider };
|
|
3183
|
-
//# sourceMappingURL=injected-wallet-provider-
|
|
3224
|
+
//# sourceMappingURL=injected-wallet-provider-DxPcYxP-.mjs.map
|