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