@bounded-sh/client 0.0.118 → 0.0.120-expo.0

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 (60) hide show
  1. package/dist/auth/oidc-auth.d.ts +2 -1
  2. package/dist/auth/providers/email-auth-provider.d.ts +2 -1
  3. package/dist/auth/providers/offchain-auth-provider.d.ts +2 -1
  4. package/dist/auth/turnkey-signer-bridge.d.ts +16 -0
  5. package/dist/auth/turnkey-wallet-widget.d.ts +4 -0
  6. package/dist/{email-auth-provider-C-qQ46kD.js → email-auth-provider-Bb_0mHJ_.js} +7 -2
  7. package/dist/email-auth-provider-Bb_0mHJ_.js.map +1 -0
  8. package/dist/{email-auth-provider-BYiK3ZCv.js → email-auth-provider-IsiArtx0.js} +7 -2
  9. package/dist/email-auth-provider-IsiArtx0.js.map +1 -0
  10. package/dist/{email-auth-provider-B9cZ-puM.mjs → email-auth-provider-TA2AbU5Y.mjs} +7 -2
  11. package/dist/email-auth-provider-TA2AbU5Y.mjs.map +1 -0
  12. package/dist/{email-auth-provider-DFHalX9c.mjs → email-auth-provider-ao5ce_SN.mjs} +7 -2
  13. package/dist/email-auth-provider-ao5ce_SN.mjs.map +1 -0
  14. package/dist/{guest-auth-provider-g5-T58yA.js → guest-auth-provider-CJUbifdu.js} +2 -2
  15. package/dist/{guest-auth-provider-g5-T58yA.js.map → guest-auth-provider-CJUbifdu.js.map} +1 -1
  16. package/dist/{guest-auth-provider-D1q3C5uC.js → guest-auth-provider-DTEwf7qP.js} +2 -2
  17. package/dist/{guest-auth-provider-D1q3C5uC.js.map → guest-auth-provider-DTEwf7qP.js.map} +1 -1
  18. package/dist/{guest-auth-provider-i8-RL0js.mjs → guest-auth-provider-Dw-bF10B.mjs} +2 -2
  19. package/dist/{guest-auth-provider-BRq3JB0_.mjs.map → guest-auth-provider-Dw-bF10B.mjs.map} +1 -1
  20. package/dist/{guest-auth-provider-BRq3JB0_.mjs → guest-auth-provider-DxQG3JvU.mjs} +2 -2
  21. package/dist/{guest-auth-provider-i8-RL0js.mjs.map → guest-auth-provider-DxQG3JvU.mjs.map} +1 -1
  22. package/dist/{index-xNGb1ROp.mjs → index-BdzGX8fS.mjs} +113 -23
  23. package/dist/index-BdzGX8fS.mjs.map +1 -0
  24. package/dist/{index-eMCWYiRe.js → index-KUBcQdTX.js} +113 -22
  25. package/dist/index-KUBcQdTX.js.map +1 -0
  26. package/dist/index.d.ts +2 -1
  27. package/dist/index.js +5 -1
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +2 -2
  30. package/dist/{index.native-ByI3rRu4.js → index.native-CZSRvIAb.js} +130 -23
  31. package/dist/index.native-CZSRvIAb.js.map +1 -0
  32. package/dist/{index.native-YmmnwqEw.mjs → index.native-N5zxPEYK.mjs} +130 -24
  33. package/dist/index.native-N5zxPEYK.mjs.map +1 -0
  34. package/dist/index.native.js +1 -1
  35. package/dist/index.native.mjs +1 -1
  36. package/dist/{injected-evm-wallet-provider-BIYAL_NZ.js → injected-evm-wallet-provider--XJFh-7d.js} +2 -2
  37. package/dist/{injected-evm-wallet-provider-BIYAL_NZ.js.map → injected-evm-wallet-provider--XJFh-7d.js.map} +1 -1
  38. package/dist/{injected-evm-wallet-provider-BMjQaUiB.js → injected-evm-wallet-provider-4T_-2UQI.js} +2 -2
  39. package/dist/{injected-evm-wallet-provider-BMjQaUiB.js.map → injected-evm-wallet-provider-4T_-2UQI.js.map} +1 -1
  40. package/dist/{injected-evm-wallet-provider--x3yWNps.mjs → injected-evm-wallet-provider-BlSFIzEA.mjs} +2 -2
  41. package/dist/{injected-evm-wallet-provider--x3yWNps.mjs.map → injected-evm-wallet-provider-BlSFIzEA.mjs.map} +1 -1
  42. package/dist/{injected-evm-wallet-provider-BoLGCVqD.mjs → injected-evm-wallet-provider-CtPPhtMh.mjs} +2 -2
  43. package/dist/{injected-evm-wallet-provider-BoLGCVqD.mjs.map → injected-evm-wallet-provider-CtPPhtMh.mjs.map} +1 -1
  44. package/dist/{injected-wallet-provider-DuWTw-fM.mjs → injected-wallet-provider-Bnsfazum.mjs} +2 -2
  45. package/dist/{injected-wallet-provider-DuWTw-fM.mjs.map → injected-wallet-provider-Bnsfazum.mjs.map} +1 -1
  46. package/dist/{injected-wallet-provider-D3fVFadN.js → injected-wallet-provider-CJ0v5Sgn.js} +2 -2
  47. package/dist/{injected-wallet-provider-D3fVFadN.js.map → injected-wallet-provider-CJ0v5Sgn.js.map} +1 -1
  48. package/dist/{injected-wallet-provider-zXw__lyf.js → injected-wallet-provider-Ckljhcbu.js} +2 -2
  49. package/dist/{injected-wallet-provider-zXw__lyf.js.map → injected-wallet-provider-Ckljhcbu.js.map} +1 -1
  50. package/dist/{injected-wallet-provider-DSOjJP3u.mjs → injected-wallet-provider-yyJfuVgv.mjs} +2 -2
  51. package/dist/{injected-wallet-provider-DSOjJP3u.mjs.map → injected-wallet-provider-yyJfuVgv.mjs.map} +1 -1
  52. package/package.json +2 -2
  53. package/dist/email-auth-provider-B9cZ-puM.mjs.map +0 -1
  54. package/dist/email-auth-provider-BYiK3ZCv.js.map +0 -1
  55. package/dist/email-auth-provider-C-qQ46kD.js.map +0 -1
  56. package/dist/email-auth-provider-DFHalX9c.mjs.map +0 -1
  57. package/dist/index-eMCWYiRe.js.map +0 -1
  58. package/dist/index-xNGb1ROp.mjs.map +0 -1
  59. package/dist/index.native-ByI3rRu4.js.map +0 -1
  60. package/dist/index.native-YmmnwqEw.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index_native = require('./index.native-ByI3rRu4.js');
3
+ var index_native = require('./index.native-CZSRvIAb.js');
4
4
  var core = require('@bounded-sh/core');
5
5
  require('react');
6
6
 
@@ -1,4 +1,4 @@
1
- export { a3 as BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA, a2 as BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA, a1 as BUILD_REVIEW_CAPABILITY_SCHEMA, W as BuildsApiError, a0 as FAILURE_REASONS, Y as NON_TERMINAL_STATES, T as OffchainAuthProvider, $ as PARK_REASONS, U as PrivyExpoProvider, _ as RUN_STATES, Z as TERMINAL_STATES, N as apps, V as builds, H as completeLoginFromRedirect, z as getAuthLoading, D as getAuthProvider, v as getCurrentUser, O as getIdToken, I as getLoginReturnError, g as getPlatform, u as init, B as login, J as loginWithPopup, F as loginWithPrivy, G as loginWithRedirect, C as logout, X as mediaAgentTools, y as onAuthLoadingChanged, x as onAuthStateChanged, P as onramp, Q as onrampQuote, R as onrampStatus, S as setPlatform, E as signInAnonymously, K as useAuth, M as useBuildRun, L as useQuery, A as waitForAuthReady } from './index.native-YmmnwqEw.mjs';
1
+ export { a4 as BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA, a3 as BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA, a2 as BUILD_REVIEW_CAPABILITY_SCHEMA, X as BuildsApiError, a1 as FAILURE_REASONS, Z as NON_TERMINAL_STATES, U as OffchainAuthProvider, a0 as PARK_REASONS, V as PrivyExpoProvider, $ as RUN_STATES, _ as TERMINAL_STATES, O as apps, W as builds, I as completeLoginFromRedirect, A as getAuthLoading, E as getAuthProvider, x as getCurrentUser, P as getIdToken, J as getLoginReturnError, g as getPlatform, v as init, C as login, K as loginWithPopup, G as loginWithPrivy, H as loginWithRedirect, D as logout, Y as mediaAgentTools, z as onAuthLoadingChanged, y as onAuthStateChanged, Q as onramp, R as onrampQuote, S as onrampStatus, T as setPlatform, F as signInAnonymously, L as useAuth, N as useBuildRun, M as useQuery, B as waitForAuthReady } from './index.native-N5zxPEYK.mjs';
2
2
  export * from '@bounded-sh/core';
3
3
  export { AppTokenExchangeError, BoundedDeclineError, DECLINE_EVENT_NAME, ScopedClientReadOnlyError, aggregate, clearAppTokenCache, count, createAppTokenAuthHeaders, createClient, deriveDecline, dispatchDeclineEvent, docId, exchangeAppToken, get, getConfig, getFiles, getMany, queryAggregate, reconcileSetResult, runExpression, runExpressionMany, runQuery, runQueryMany, search, set, setFile, setMany, signAndSubmitTransaction, signMessage, signTransaction, subscribe, waitForSetResult } from '@bounded-sh/core';
4
4
  import 'react';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var core = require('@bounded-sh/core');
4
- var index = require('./index-eMCWYiRe.js');
4
+ var index = require('./index-KUBcQdTX.js');
5
5
  require('react');
6
6
 
7
7
  // Must equal the authMethod the registry (auth/index.ts) sets as currentAuthMethod,
@@ -186,4 +186,4 @@ InjectedEvmWalletProvider.instance = null;
186
186
 
187
187
  exports.defaultInjectedEvmProvider = index.defaultInjectedEvmProvider;
188
188
  exports.InjectedEvmWalletProvider = InjectedEvmWalletProvider;
189
- //# sourceMappingURL=injected-evm-wallet-provider-BIYAL_NZ.js.map
189
+ //# sourceMappingURL=injected-evm-wallet-provider--XJFh-7d.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"injected-evm-wallet-provider-BIYAL_NZ.js","sources":["../.rollup-tmp/auth/providers/injected-evm-wallet-provider.js"],"sourcesContent":["import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSiweMessage, getConfig, normalizeEvmAddress, } from '@bounded-sh/core';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { setStoredAuthMethod } from '../stored-auth-method';\nimport { defaultInjectedEvmProvider, } from './injected-evm-wallet-types';\n// Re-export the type surface + discovery helper for callers who import the\n// provider module directly.\nexport { defaultInjectedEvmProvider };\n// Must equal the authMethod the registry (auth/index.ts) sets as currentAuthMethod,\n// so clearIncompatibleSession() keeps (not wipes) this session on the next init().\nconst INJECTED_EVM_AUTH_METHOD = 'evm-wallet';\n// The /session issuer's discriminator for the SIWE (EIP-4361 secp256k1) exchange.\nconst SIWE_SESSION_METHOD = 'siwe';\nconst NO_WALLET_ERR = 'No injected EVM wallet found. Install a wallet like MetaMask (metamask.io) or Rabby and try again, ' +\n 'or pass config.evmWalletConfig.getProvider to point at your wallet.';\nconst NO_SOL_TX_ERR = 'EVM wallet login is a LOGIN-ONLY surface (SIWE + personal_sign) and has no Solana ' +\n 'transaction surface: signTransaction/signAndSubmitTransaction are unavailable.';\nfunction normalizeConfig(config) {\n if (config.chainId !== undefined && (!Number.isSafeInteger(config.chainId) || config.chainId <= 0)) {\n throw new Error('EVM wallet chainId must be a positive safe integer');\n }\n return Object.assign({}, config);\n}\nexport class InjectedEvmWalletProvider {\n constructor(config = {}) {\n this.authenticatedAddress = null;\n if (typeof window === 'undefined') {\n throw new Error('InjectedEvmWalletProvider can only be instantiated in a browser environment');\n }\n const normalized = normalizeConfig(config);\n // Singleton so the SDK reuses one instance (mirrors the other providers).\n if (InjectedEvmWalletProvider.instance) {\n InjectedEvmWalletProvider.instance.config = normalized;\n InjectedEvmWalletProvider.instance.authenticatedAddress = null;\n return InjectedEvmWalletProvider.instance;\n }\n this.config = normalized;\n InjectedEvmWalletProvider.instance = this;\n }\n // @user.address (the Solana wallet) is null for an EVM-wallet login: the user\n // authenticated with an EVM wallet and has no Solana address. User.address is\n // typed `string | null`, so this is a plain null, not a cast.\n evmUser(address) {\n return { id: address, address: null, evmAddress: address, provider: this };\n }\n resolveProvider() {\n var _a;\n const provider = (_a = (this.config.getProvider ? this.config.getProvider() : null)) !== null && _a !== void 0 ? _a : defaultInjectedEvmProvider();\n if (!provider)\n throw new Error(NO_WALLET_ERR);\n return provider;\n }\n /** Connect the injected wallet and return its canonical lowercase EVM address. */\n async connectAddress(provider) {\n const accounts = await provider.request({ method: 'eth_requestAccounts' });\n const raw = Array.isArray(accounts) ? accounts[0] : undefined;\n const address = normalizeEvmAddress(raw);\n if (!address)\n throw new Error('Wallet did not return a valid EVM address on connect');\n return address;\n }\n /** Current chain id the wallet is connected to (EIP-155 number), or null. */\n async currentChainId(provider) {\n try {\n const hex = await provider.request({ method: 'eth_chainId' });\n if (typeof hex !== 'string' || !/^0x[0-9a-fA-F]+$/.test(hex))\n return null;\n const n = Number(BigInt(hex));\n return Number.isSafeInteger(n) && n > 0 ? n : null;\n }\n catch (_a) {\n return null;\n }\n }\n async login() {\n var _a;\n setAuthLoading(true);\n try {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n // Reuse a still-valid session for THIS wallet.\n const existing = await SessionManager().getSession();\n if (existing && existing.address === address) {\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n this.markAuthMethod();\n return user;\n }\n // SIWE: nonce -> canonical EIP-4361 prompt -> the wallet personal_sign's it.\n const nonce = await genAuthNonce();\n const appId = (await getConfig()).appId;\n const chainId = (_a = this.config.chainId) !== null && _a !== void 0 ? _a : await this.currentChainId(provider);\n if (chainId === null)\n throw new Error('Could not verify the EVM wallet chain for SIWE login');\n const message = genSiweMessage(address, nonce, appId, this.resolveDomain(), this.resolveUri(), { chainId });\n // personal_sign(message, address) -> 0x r‖s‖v hex (the shape the\n // bounded-auth verifier's recoverSiweSigner consumes). The raw UTF-8\n // message is signed under the EIP-191 envelope the verifier hashes.\n const signature = await provider.request({\n method: 'personal_sign',\n params: [message, address],\n });\n const result = await createSessionWithSignature(address, message, signature, SIWE_SESSION_METHOD);\n await SessionManager().storeSession(address, result.accessToken, result.idToken, result.refreshToken);\n this.markAuthMethod();\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n return user;\n }\n finally {\n setAuthLoading(false);\n }\n }\n resolveDomain() {\n const actual = window.location.host.toLowerCase();\n if (this.config.domain && this.config.domain.toLowerCase() !== actual) {\n throw new Error('SIWE domain override must match the current browser origin');\n }\n return actual;\n }\n resolveUri() {\n const actual = window.location.origin.toLowerCase();\n if (this.config.uri) {\n let configured;\n try {\n configured = new URL(this.config.uri).origin.toLowerCase();\n }\n catch (_a) {\n throw new Error('SIWE URI override must be an absolute URL');\n }\n if (configured !== actual)\n throw new Error('SIWE URI override must match the current browser origin');\n }\n return actual;\n }\n markAuthMethod() {\n setStoredAuthMethod(INJECTED_EVM_AUTH_METHOD);\n }\n async restoreSession(beforeCommit) {\n const session = await SessionManager().getSession();\n beforeCommit === null || beforeCommit === void 0 ? void 0 : beforeCommit();\n if (!session)\n return null;\n // An EVM-wallet session stores the EVM address as its address; @user.address\n // (the Solana wallet) is null for this login.\n const address = normalizeEvmAddress(session.address);\n if (!address) {\n await SessionManager().clearSession();\n return null;\n }\n this.authenticatedAddress = address;\n const user = this.evmUser(address);\n setCurrentUser(user);\n return user;\n }\n async logout() {\n // EIP-1193 has no standard disconnect; clearing the Bounded session is the\n // logout. (wallet_revokePermissions is non-standard/opt-in — skip it.)\n await SessionManager().clearSession();\n this.authenticatedAddress = null;\n setCurrentUser(null);\n }\n // --- Signing surface -------------------------------------------------------\n /** App-facing message signing: EIP-191 personal_sign, returns 0x r‖s‖v hex. */\n async signMessage(message) {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n if (!this.authenticatedAddress || address !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before signing.');\n }\n return provider.request({ method: 'personal_sign', params: [message, address] });\n }\n // Solana-typed methods are structurally unsupported on an EVM wallet, and\n // this provider is login-only, so there is no transaction surface at all.\n async signTransaction(_transaction) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async signAndSubmitTransaction(_transaction, _feePayer) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async getNativeMethods() {\n return this.resolveProvider();\n }\n}\nInjectedEvmWalletProvider.instance = null;\n"],"names":["defaultInjectedEvmProvider","normalizeEvmAddress","setAuthLoading","SessionManager","setCurrentUser","genAuthNonce","getConfig","genSiweMessage","createSessionWithSignature","setStoredAuthMethod"],"mappings":";;;;;;AAOA;AACA;AACA,MAAM,wBAAwB,GAAG,YAAY;AAC7C;AACA,MAAM,mBAAmB,GAAG,MAAM;AAClC,MAAM,aAAa,GAAG,qGAAqG;AAC3H,IAAI,qEAAqE;AACzE,MAAM,aAAa,GAAG,oFAAoF;AAC1G,IAAI,gFAAgF;AACpF,SAAS,eAAe,CAAC,MAAM,EAAE;AACjC,IAAI,IAAI,MAAM,CAAC,OAAO,KAAK,S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,MAAM,WAAW,CAAC,OAAO,EAAE;AAC/B,QAAQ,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,EAAE;AAC/C,QAAQ,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC;AAC3D,QAAQ,IAAI,CAAC,IAAI,CAAC,oBAAoB,IAAI,OAAO,KAAK,IAAI,CAAC,oBAAoB,EAAE;AACjF,YAAY,MAAM,IAAI,KAAK,CAAC,qFAAqF,CAAC;AAClH,QAAQ;AACR,QAAQ,OAAO,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;AACxF,IAAI;AACJ;AACA;AACA,IAAI,MAAM,eAAe,CAAC,YAAY,EAAE;AACxC,QAAQ,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC;AACtC,IAAI;AACJ,IAAI,MAAM,wBAAwB,CAAC,YAAY,EAAE,SAAS,EAAE;AAC5D,QAAQ,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC;AACtC,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,IAAI,CAAC,eAAe,EAAE;AACrC,IAAI;AACJ;AACA,yBAAyB,CAAC,QAAQ,GAAG,IAAI;;;;;"}
1
+ {"version":3,"file":"injected-evm-wallet-provider--XJFh-7d.js","sources":["../.rollup-tmp/auth/providers/injected-evm-wallet-provider.js"],"sourcesContent":["import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSiweMessage, getConfig, normalizeEvmAddress, } from '@bounded-sh/core';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { setStoredAuthMethod } from '../stored-auth-method';\nimport { defaultInjectedEvmProvider, } from './injected-evm-wallet-types';\n// Re-export the type surface + discovery helper for callers who import the\n// provider module directly.\nexport { defaultInjectedEvmProvider };\n// Must equal the authMethod the registry (auth/index.ts) sets as currentAuthMethod,\n// so clearIncompatibleSession() keeps (not wipes) this session on the next init().\nconst INJECTED_EVM_AUTH_METHOD = 'evm-wallet';\n// The /session issuer's discriminator for the SIWE (EIP-4361 secp256k1) exchange.\nconst SIWE_SESSION_METHOD = 'siwe';\nconst NO_WALLET_ERR = 'No injected EVM wallet found. Install a wallet like MetaMask (metamask.io) or Rabby and try again, ' +\n 'or pass config.evmWalletConfig.getProvider to point at your wallet.';\nconst NO_SOL_TX_ERR = 'EVM wallet login is a LOGIN-ONLY surface (SIWE + personal_sign) and has no Solana ' +\n 'transaction surface: signTransaction/signAndSubmitTransaction are unavailable.';\nfunction normalizeConfig(config) {\n if (config.chainId !== undefined && (!Number.isSafeInteger(config.chainId) || config.chainId <= 0)) {\n throw new Error('EVM wallet chainId must be a positive safe integer');\n }\n return Object.assign({}, config);\n}\nexport class InjectedEvmWalletProvider {\n constructor(config = {}) {\n this.authenticatedAddress = null;\n if (typeof window === 'undefined') {\n throw new Error('InjectedEvmWalletProvider can only be instantiated in a browser environment');\n }\n const normalized = normalizeConfig(config);\n // Singleton so the SDK reuses one instance (mirrors the other providers).\n if (InjectedEvmWalletProvider.instance) {\n InjectedEvmWalletProvider.instance.config = normalized;\n InjectedEvmWalletProvider.instance.authenticatedAddress = null;\n return InjectedEvmWalletProvider.instance;\n }\n this.config = normalized;\n InjectedEvmWalletProvider.instance = this;\n }\n // @user.address (the Solana wallet) is null for an EVM-wallet login: the user\n // authenticated with an EVM wallet and has no Solana address. User.address is\n // typed `string | null`, so this is a plain null, not a cast.\n evmUser(address) {\n return { id: address, address: null, evmAddress: address, provider: this };\n }\n resolveProvider() {\n var _a;\n const provider = (_a = (this.config.getProvider ? this.config.getProvider() : null)) !== null && _a !== void 0 ? _a : defaultInjectedEvmProvider();\n if (!provider)\n throw new Error(NO_WALLET_ERR);\n return provider;\n }\n /** Connect the injected wallet and return its canonical lowercase EVM address. */\n async connectAddress(provider) {\n const accounts = await provider.request({ method: 'eth_requestAccounts' });\n const raw = Array.isArray(accounts) ? accounts[0] : undefined;\n const address = normalizeEvmAddress(raw);\n if (!address)\n throw new Error('Wallet did not return a valid EVM address on connect');\n return address;\n }\n /** Current chain id the wallet is connected to (EIP-155 number), or null. */\n async currentChainId(provider) {\n try {\n const hex = await provider.request({ method: 'eth_chainId' });\n if (typeof hex !== 'string' || !/^0x[0-9a-fA-F]+$/.test(hex))\n return null;\n const n = Number(BigInt(hex));\n return Number.isSafeInteger(n) && n > 0 ? n : null;\n }\n catch (_a) {\n return null;\n }\n }\n async login() {\n var _a;\n setAuthLoading(true);\n try {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n // Reuse a still-valid session for THIS wallet.\n const existing = await SessionManager().getSession();\n if (existing && existing.address === address) {\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n this.markAuthMethod();\n return user;\n }\n // SIWE: nonce -> canonical EIP-4361 prompt -> the wallet personal_sign's it.\n const nonce = await genAuthNonce();\n const appId = (await getConfig()).appId;\n const chainId = (_a = this.config.chainId) !== null && _a !== void 0 ? _a : await this.currentChainId(provider);\n if (chainId === null)\n throw new Error('Could not verify the EVM wallet chain for SIWE login');\n const message = genSiweMessage(address, nonce, appId, this.resolveDomain(), this.resolveUri(), { chainId });\n // personal_sign(message, address) -> 0x r‖s‖v hex (the shape the\n // bounded-auth verifier's recoverSiweSigner consumes). The raw UTF-8\n // message is signed under the EIP-191 envelope the verifier hashes.\n const signature = await provider.request({\n method: 'personal_sign',\n params: [message, address],\n });\n const result = await createSessionWithSignature(address, message, signature, SIWE_SESSION_METHOD);\n await SessionManager().storeSession(address, result.accessToken, result.idToken, result.refreshToken);\n this.markAuthMethod();\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n return user;\n }\n finally {\n setAuthLoading(false);\n }\n }\n resolveDomain() {\n const actual = window.location.host.toLowerCase();\n if (this.config.domain && this.config.domain.toLowerCase() !== actual) {\n throw new Error('SIWE domain override must match the current browser origin');\n }\n return actual;\n }\n resolveUri() {\n const actual = window.location.origin.toLowerCase();\n if (this.config.uri) {\n let configured;\n try {\n configured = new URL(this.config.uri).origin.toLowerCase();\n }\n catch (_a) {\n throw new Error('SIWE URI override must be an absolute URL');\n }\n if (configured !== actual)\n throw new Error('SIWE URI override must match the current browser origin');\n }\n return actual;\n }\n markAuthMethod() {\n setStoredAuthMethod(INJECTED_EVM_AUTH_METHOD);\n }\n async restoreSession(beforeCommit) {\n const session = await SessionManager().getSession();\n beforeCommit === null || beforeCommit === void 0 ? void 0 : beforeCommit();\n if (!session)\n return null;\n // An EVM-wallet session stores the EVM address as its address; @user.address\n // (the Solana wallet) is null for this login.\n const address = normalizeEvmAddress(session.address);\n if (!address) {\n await SessionManager().clearSession();\n return null;\n }\n this.authenticatedAddress = address;\n const user = this.evmUser(address);\n setCurrentUser(user);\n return user;\n }\n async logout() {\n // EIP-1193 has no standard disconnect; clearing the Bounded session is the\n // logout. (wallet_revokePermissions is non-standard/opt-in — skip it.)\n await SessionManager().clearSession();\n this.authenticatedAddress = null;\n setCurrentUser(null);\n }\n // --- Signing surface -------------------------------------------------------\n /** App-facing message signing: EIP-191 personal_sign, returns 0x r‖s‖v hex. */\n async signMessage(message) {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n if (!this.authenticatedAddress || address !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before signing.');\n }\n return provider.request({ method: 'personal_sign', params: [message, address] });\n }\n // Solana-typed methods are structurally unsupported on an EVM wallet, and\n // this provider is login-only, so there is no transaction surface at all.\n async signTransaction(_transaction) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async signAndSubmitTransaction(_transaction, _feePayer) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async getNativeMethods() {\n return this.resolveProvider();\n }\n}\nInjectedEvmWalletProvider.instance = null;\n"],"names":["defaultInjectedEvmProvider","normalizeEvmAddress","setAuthLoading","SessionManager","setCurrentUser","genAuthNonce","getConfig","genSiweMessage","createSession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');
4
+ var index_native = require('./index.native-CZSRvIAb.js');
5
5
  require('react');
6
6
 
7
7
  // injected-evm-wallet-types.ts — tiny, dependency-free surface for the EVM
@@ -252,4 +252,4 @@ InjectedEvmWalletProvider.instance = null;
252
252
 
253
253
  exports.InjectedEvmWalletProvider = InjectedEvmWalletProvider;
254
254
  exports.defaultInjectedEvmProvider = defaultInjectedEvmProvider;
255
- //# sourceMappingURL=injected-evm-wallet-provider-BMjQaUiB.js.map
255
+ //# sourceMappingURL=injected-evm-wallet-provider-4T_-2UQI.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"injected-evm-wallet-provider-BMjQaUiB.js","sources":["../.rollup-tmp/auth/providers/injected-evm-wallet-types.js","../.rollup-tmp/auth/providers/injected-evm-wallet-provider.js"],"sourcesContent":["// injected-evm-wallet-types.ts — tiny, dependency-free surface for the EVM\n// WALLET LOGIN path (BYO wallet via SIWE). The EVM twin of\n// injected-wallet-types.ts: kept separate from injected-evm-wallet-provider.ts\n// so the SDK entry can eagerly export the type surface + the provider-discovery\n// helper WITHOUT dragging the provider class into the default bundle. The\n// provider is lazy-loaded by getAuthProvider() when an app opts into\n// authMethod:'evm-wallet'.\n//\n// It rides the standard EIP-1193 injected provider a browser wallet exposes\n// (MetaMask / Rabby / Coinbase Wallet / any window.ethereum), discovered via\n// EIP-6963 (multi-wallet, collision-free) with a window.ethereum fallback. It\n// needs NO viem/ethers and NO React — EIP-1193 request() + hex strings suffice.\n// EIP-6963 is announcement-based: wallets add an `eip6963:requestProvider`\n// listener and synchronously dispatch `eip6963:announceProvider` in response. We\n// keep a persistent collector so announcements (including late ones) are\n// captured, and re-request on demand.\nconst announcedProviders = [];\nlet announceListenerAttached = false;\nfunction attachAnnounceListener() {\n if (announceListenerAttached || typeof window === 'undefined')\n return;\n announceListenerAttached = true;\n window.addEventListener('eip6963:announceProvider', (event) => {\n const detail = event === null || event === void 0 ? void 0 : event.detail;\n if (detail &&\n detail.provider &&\n typeof detail.provider.request === 'function' &&\n !announcedProviders.some((d) => { var _a, _b; return ((_a = d.info) === null || _a === void 0 ? void 0 : _a.uuid) === ((_b = detail.info) === null || _b === void 0 ? void 0 : _b.uuid); })) {\n announcedProviders.push(detail);\n }\n });\n}\n/**\n * Request + collect EIP-6963 providers. Dispatches `eip6963:requestProvider`\n * (synchronous — already-loaded wallets announce in the same tick) and returns\n * every wallet announced so far. Kept synchronous so it works inside a user\n * gesture and can be eagerly exported from the SDK entry.\n */\nexport function requestEip6963Providers() {\n if (typeof window === 'undefined')\n return [];\n attachAnnounceListener();\n try {\n window.dispatchEvent(new Event('eip6963:requestProvider'));\n }\n catch (_a) {\n /* older browsers without Event constructor — fall through to window.ethereum */\n }\n return announcedProviders.slice();\n}\n/**\n * Default EVM provider discovery: EIP-6963 first (multi-wallet, collision-free),\n * then legacy `window.ethereum`. Returns null when no injected wallet is present.\n */\nexport function defaultInjectedEvmProvider() {\n if (typeof window === 'undefined')\n return null;\n const details = requestEip6963Providers();\n if (details.length > 0)\n return details[0].provider;\n const eth = window.ethereum;\n if (eth && typeof eth.request === 'function')\n return eth;\n return null;\n}\n","import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSiweMessage, getConfig, normalizeEvmAddress, } from '@bounded-sh/core';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { setStoredAuthMethod } from '../stored-auth-method';\nimport { defaultInjectedEvmProvider, } from './injected-evm-wallet-types';\n// Re-export the type surface + discovery helper for callers who import the\n// provider module directly.\nexport { defaultInjectedEvmProvider };\n// Must equal the authMethod the registry (auth/index.ts) sets as currentAuthMethod,\n// so clearIncompatibleSession() keeps (not wipes) this session on the next init().\nconst INJECTED_EVM_AUTH_METHOD = 'evm-wallet';\n// The /session issuer's discriminator for the SIWE (EIP-4361 secp256k1) exchange.\nconst SIWE_SESSION_METHOD = 'siwe';\nconst NO_WALLET_ERR = 'No injected EVM wallet found. Install a wallet like MetaMask (metamask.io) or Rabby and try again, ' +\n 'or pass config.evmWalletConfig.getProvider to point at your wallet.';\nconst NO_SOL_TX_ERR = 'EVM wallet login is a LOGIN-ONLY surface (SIWE + personal_sign) and has no Solana ' +\n 'transaction surface: signTransaction/signAndSubmitTransaction are unavailable.';\nfunction normalizeConfig(config) {\n if (config.chainId !== undefined && (!Number.isSafeInteger(config.chainId) || config.chainId <= 0)) {\n throw new Error('EVM wallet chainId must be a positive safe integer');\n }\n return Object.assign({}, config);\n}\nexport class InjectedEvmWalletProvider {\n constructor(config = {}) {\n this.authenticatedAddress = null;\n if (typeof window === 'undefined') {\n throw new Error('InjectedEvmWalletProvider can only be instantiated in a browser environment');\n }\n const normalized = normalizeConfig(config);\n // Singleton so the SDK reuses one instance (mirrors the other providers).\n if (InjectedEvmWalletProvider.instance) {\n InjectedEvmWalletProvider.instance.config = normalized;\n InjectedEvmWalletProvider.instance.authenticatedAddress = null;\n return InjectedEvmWalletProvider.instance;\n }\n this.config = normalized;\n InjectedEvmWalletProvider.instance = this;\n }\n // @user.address (the Solana wallet) is null for an EVM-wallet login: the user\n // authenticated with an EVM wallet and has no Solana address. User.address is\n // typed `string | null`, so this is a plain null, not a cast.\n evmUser(address) {\n return { id: address, address: null, evmAddress: address, provider: this };\n }\n resolveProvider() {\n var _a;\n const provider = (_a = (this.config.getProvider ? this.config.getProvider() : null)) !== null && _a !== void 0 ? _a : defaultInjectedEvmProvider();\n if (!provider)\n throw new Error(NO_WALLET_ERR);\n return provider;\n }\n /** Connect the injected wallet and return its canonical lowercase EVM address. */\n async connectAddress(provider) {\n const accounts = await provider.request({ method: 'eth_requestAccounts' });\n const raw = Array.isArray(accounts) ? accounts[0] : undefined;\n const address = normalizeEvmAddress(raw);\n if (!address)\n throw new Error('Wallet did not return a valid EVM address on connect');\n return address;\n }\n /** Current chain id the wallet is connected to (EIP-155 number), or null. */\n async currentChainId(provider) {\n try {\n const hex = await provider.request({ method: 'eth_chainId' });\n if (typeof hex !== 'string' || !/^0x[0-9a-fA-F]+$/.test(hex))\n return null;\n const n = Number(BigInt(hex));\n return Number.isSafeInteger(n) && n > 0 ? n : null;\n }\n catch (_a) {\n return null;\n }\n }\n async login() {\n var _a;\n setAuthLoading(true);\n try {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n // Reuse a still-valid session for THIS wallet.\n const existing = await SessionManager().getSession();\n if (existing && existing.address === address) {\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n this.markAuthMethod();\n return user;\n }\n // SIWE: nonce -> canonical EIP-4361 prompt -> the wallet personal_sign's it.\n const nonce = await genAuthNonce();\n const appId = (await getConfig()).appId;\n const chainId = (_a = this.config.chainId) !== null && _a !== void 0 ? _a : await this.currentChainId(provider);\n if (chainId === null)\n throw new Error('Could not verify the EVM wallet chain for SIWE login');\n const message = genSiweMessage(address, nonce, appId, this.resolveDomain(), this.resolveUri(), { chainId });\n // personal_sign(message, address) -> 0x r‖s‖v hex (the shape the\n // bounded-auth verifier's recoverSiweSigner consumes). The raw UTF-8\n // message is signed under the EIP-191 envelope the verifier hashes.\n const signature = await provider.request({\n method: 'personal_sign',\n params: [message, address],\n });\n const result = await createSessionWithSignature(address, message, signature, SIWE_SESSION_METHOD);\n await SessionManager().storeSession(address, result.accessToken, result.idToken, result.refreshToken);\n this.markAuthMethod();\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n return user;\n }\n finally {\n setAuthLoading(false);\n }\n }\n resolveDomain() {\n const actual = window.location.host.toLowerCase();\n if (this.config.domain && this.config.domain.toLowerCase() !== actual) {\n throw new Error('SIWE domain override must match the current browser origin');\n }\n return actual;\n }\n resolveUri() {\n const actual = window.location.origin.toLowerCase();\n if (this.config.uri) {\n let configured;\n try {\n configured = new URL(this.config.uri).origin.toLowerCase();\n }\n catch (_a) {\n throw new Error('SIWE URI override must be an absolute URL');\n }\n if (configured !== actual)\n throw new Error('SIWE URI override must match the current browser origin');\n }\n return actual;\n }\n markAuthMethod() {\n setStoredAuthMethod(INJECTED_EVM_AUTH_METHOD);\n }\n async restoreSession(beforeCommit) {\n const session = await SessionManager().getSession();\n beforeCommit === null || beforeCommit === void 0 ? void 0 : beforeCommit();\n if (!session)\n return null;\n // An EVM-wallet session stores the EVM address as its address; @user.address\n // (the Solana wallet) is null for this login.\n const address = normalizeEvmAddress(session.address);\n if (!address) {\n await SessionManager().clearSession();\n return null;\n }\n this.authenticatedAddress = address;\n const user = this.evmUser(address);\n setCurrentUser(user);\n return user;\n }\n async logout() {\n // EIP-1193 has no standard disconnect; clearing the Bounded session is the\n // logout. (wallet_revokePermissions is non-standard/opt-in — skip it.)\n await SessionManager().clearSession();\n this.authenticatedAddress = null;\n setCurrentUser(null);\n }\n // --- Signing surface -------------------------------------------------------\n /** App-facing message signing: EIP-191 personal_sign, returns 0x r‖s‖v hex. */\n async signMessage(message) {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n if (!this.authenticatedAddress || address !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before signing.');\n }\n return provider.request({ method: 'personal_sign', params: [message, address] });\n }\n // Solana-typed methods are structurally unsupported on an EVM wallet, and\n // this provider is login-only, so there is no transaction surface at all.\n async signTransaction(_transaction) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async signAndSubmitTransaction(_transaction, _feePayer) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async getNativeMethods() {\n return this.resolveProvider();\n }\n}\nInjectedEvmWalletProvider.instance = null;\n"],"names":["normalizeEvmAddress","setAuthLoading","SessionManager","setCurrentUser","genAuthNonce","getConfig","genSiweMessage","createSessionWithSignature","setStoredAuthMethod"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,kBAAkB,GAAG,EAAE;AAC7B,IAAI,wBAAwB,GAAG,KAAK;AACpC,SAAS,sBAAsB,GAAG;AAClC,IAAI,IAAI,wBAAwB,IAAI,OAAO,MAAM,KAAK,WAAW;AACjE,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AC,YAAY,EAAE,SAAS,EAAE;AAC5D,QAAQ,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC;AACtC,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,IAAI,CAAC,eAAe,EAAE;AACrC,IAAI;AACJ;AACA,yBAAyB,CAAC,QAAQ,GAAG,IAAI;;;;;"}
1
+ {"version":3,"file":"injected-evm-wallet-provider-4T_-2UQI.js","sources":["../.rollup-tmp/auth/providers/injected-evm-wallet-types.js","../.rollup-tmp/auth/providers/injected-evm-wallet-provider.js"],"sourcesContent":["// injected-evm-wallet-types.ts — tiny, dependency-free surface for the EVM\n// WALLET LOGIN path (BYO wallet via SIWE). The EVM twin of\n// injected-wallet-types.ts: kept separate from injected-evm-wallet-provider.ts\n// so the SDK entry can eagerly export the type surface + the provider-discovery\n// helper WITHOUT dragging the provider class into the default bundle. The\n// provider is lazy-loaded by getAuthProvider() when an app opts into\n// authMethod:'evm-wallet'.\n//\n// It rides the standard EIP-1193 injected provider a browser wallet exposes\n// (MetaMask / Rabby / Coinbase Wallet / any window.ethereum), discovered via\n// EIP-6963 (multi-wallet, collision-free) with a window.ethereum fallback. It\n// needs NO viem/ethers and NO React — EIP-1193 request() + hex strings suffice.\n// EIP-6963 is announcement-based: wallets add an `eip6963:requestProvider`\n// listener and synchronously dispatch `eip6963:announceProvider` in response. We\n// keep a persistent collector so announcements (including late ones) are\n// captured, and re-request on demand.\nconst announcedProviders = [];\nlet announceListenerAttached = false;\nfunction attachAnnounceListener() {\n if (announceListenerAttached || typeof window === 'undefined')\n return;\n announceListenerAttached = true;\n window.addEventListener('eip6963:announceProvider', (event) => {\n const detail = event === null || event === void 0 ? void 0 : event.detail;\n if (detail &&\n detail.provider &&\n typeof detail.provider.request === 'function' &&\n !announcedProviders.some((d) => { var _a, _b; return ((_a = d.info) === null || _a === void 0 ? void 0 : _a.uuid) === ((_b = detail.info) === null || _b === void 0 ? void 0 : _b.uuid); })) {\n announcedProviders.push(detail);\n }\n });\n}\n/**\n * Request + collect EIP-6963 providers. Dispatches `eip6963:requestProvider`\n * (synchronous — already-loaded wallets announce in the same tick) and returns\n * every wallet announced so far. Kept synchronous so it works inside a user\n * gesture and can be eagerly exported from the SDK entry.\n */\nexport function requestEip6963Providers() {\n if (typeof window === 'undefined')\n return [];\n attachAnnounceListener();\n try {\n window.dispatchEvent(new Event('eip6963:requestProvider'));\n }\n catch (_a) {\n /* older browsers without Event constructor — fall through to window.ethereum */\n }\n return announcedProviders.slice();\n}\n/**\n * Default EVM provider discovery: EIP-6963 first (multi-wallet, collision-free),\n * then legacy `window.ethereum`. Returns null when no injected wallet is present.\n */\nexport function defaultInjectedEvmProvider() {\n if (typeof window === 'undefined')\n return null;\n const details = requestEip6963Providers();\n if (details.length > 0)\n return details[0].provider;\n const eth = window.ethereum;\n if (eth && typeof eth.request === 'function')\n return eth;\n return null;\n}\n","import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSiweMessage, getConfig, normalizeEvmAddress, } from '@bounded-sh/core';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { setStoredAuthMethod } from '../stored-auth-method';\nimport { defaultInjectedEvmProvider, } from './injected-evm-wallet-types';\n// Re-export the type surface + discovery helper for callers who import the\n// provider module directly.\nexport { defaultInjectedEvmProvider };\n// Must equal the authMethod the registry (auth/index.ts) sets as currentAuthMethod,\n// so clearIncompatibleSession() keeps (not wipes) this session on the next init().\nconst INJECTED_EVM_AUTH_METHOD = 'evm-wallet';\n// The /session issuer's discriminator for the SIWE (EIP-4361 secp256k1) exchange.\nconst SIWE_SESSION_METHOD = 'siwe';\nconst NO_WALLET_ERR = 'No injected EVM wallet found. Install a wallet like MetaMask (metamask.io) or Rabby and try again, ' +\n 'or pass config.evmWalletConfig.getProvider to point at your wallet.';\nconst NO_SOL_TX_ERR = 'EVM wallet login is a LOGIN-ONLY surface (SIWE + personal_sign) and has no Solana ' +\n 'transaction surface: signTransaction/signAndSubmitTransaction are unavailable.';\nfunction normalizeConfig(config) {\n if (config.chainId !== undefined && (!Number.isSafeInteger(config.chainId) || config.chainId <= 0)) {\n throw new Error('EVM wallet chainId must be a positive safe integer');\n }\n return Object.assign({}, config);\n}\nexport class InjectedEvmWalletProvider {\n constructor(config = {}) {\n this.authenticatedAddress = null;\n if (typeof window === 'undefined') {\n throw new Error('InjectedEvmWalletProvider can only be instantiated in a browser environment');\n }\n const normalized = normalizeConfig(config);\n // Singleton so the SDK reuses one instance (mirrors the other providers).\n if (InjectedEvmWalletProvider.instance) {\n InjectedEvmWalletProvider.instance.config = normalized;\n InjectedEvmWalletProvider.instance.authenticatedAddress = null;\n return InjectedEvmWalletProvider.instance;\n }\n this.config = normalized;\n InjectedEvmWalletProvider.instance = this;\n }\n // @user.address (the Solana wallet) is null for an EVM-wallet login: the user\n // authenticated with an EVM wallet and has no Solana address. User.address is\n // typed `string | null`, so this is a plain null, not a cast.\n evmUser(address) {\n return { id: address, address: null, evmAddress: address, provider: this };\n }\n resolveProvider() {\n var _a;\n const provider = (_a = (this.config.getProvider ? this.config.getProvider() : null)) !== null && _a !== void 0 ? _a : defaultInjectedEvmProvider();\n if (!provider)\n throw new Error(NO_WALLET_ERR);\n return provider;\n }\n /** Connect the injected wallet and return its canonical lowercase EVM address. */\n async connectAddress(provider) {\n const accounts = await provider.request({ method: 'eth_requestAccounts' });\n const raw = Array.isArray(accounts) ? accounts[0] : undefined;\n const address = normalizeEvmAddress(raw);\n if (!address)\n throw new Error('Wallet did not return a valid EVM address on connect');\n return address;\n }\n /** Current chain id the wallet is connected to (EIP-155 number), or null. */\n async currentChainId(provider) {\n try {\n const hex = await provider.request({ method: 'eth_chainId' });\n if (typeof hex !== 'string' || !/^0x[0-9a-fA-F]+$/.test(hex))\n return null;\n const n = Number(BigInt(hex));\n return Number.isSafeInteger(n) && n > 0 ? n : null;\n }\n catch (_a) {\n return null;\n }\n }\n async login() {\n var _a;\n setAuthLoading(true);\n try {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n // Reuse a still-valid session for THIS wallet.\n const existing = await SessionManager().getSession();\n if (existing && existing.address === address) {\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n this.markAuthMethod();\n return user;\n }\n // SIWE: nonce -> canonical EIP-4361 prompt -> the wallet personal_sign's it.\n const nonce = await genAuthNonce();\n const appId = (await getConfig()).appId;\n const chainId = (_a = this.config.chainId) !== null && _a !== void 0 ? _a : await this.currentChainId(provider);\n if (chainId === null)\n throw new Error('Could not verify the EVM wallet chain for SIWE login');\n const message = genSiweMessage(address, nonce, appId, this.resolveDomain(), this.resolveUri(), { chainId });\n // personal_sign(message, address) -> 0x r‖s‖v hex (the shape the\n // bounded-auth verifier's recoverSiweSigner consumes). The raw UTF-8\n // message is signed under the EIP-191 envelope the verifier hashes.\n const signature = await provider.request({\n method: 'personal_sign',\n params: [message, address],\n });\n const result = await createSessionWithSignature(address, message, signature, SIWE_SESSION_METHOD);\n await SessionManager().storeSession(address, result.accessToken, result.idToken, result.refreshToken);\n this.markAuthMethod();\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n return user;\n }\n finally {\n setAuthLoading(false);\n }\n }\n resolveDomain() {\n const actual = window.location.host.toLowerCase();\n if (this.config.domain && this.config.domain.toLowerCase() !== actual) {\n throw new Error('SIWE domain override must match the current browser origin');\n }\n return actual;\n }\n resolveUri() {\n const actual = window.location.origin.toLowerCase();\n if (this.config.uri) {\n let configured;\n try {\n configured = new URL(this.config.uri).origin.toLowerCase();\n }\n catch (_a) {\n throw new Error('SIWE URI override must be an absolute URL');\n }\n if (configured !== actual)\n throw new Error('SIWE URI override must match the current browser origin');\n }\n return actual;\n }\n markAuthMethod() {\n setStoredAuthMethod(INJECTED_EVM_AUTH_METHOD);\n }\n async restoreSession(beforeCommit) {\n const session = await SessionManager().getSession();\n beforeCommit === null || beforeCommit === void 0 ? void 0 : beforeCommit();\n if (!session)\n return null;\n // An EVM-wallet session stores the EVM address as its address; @user.address\n // (the Solana wallet) is null for this login.\n const address = normalizeEvmAddress(session.address);\n if (!address) {\n await SessionManager().clearSession();\n return null;\n }\n this.authenticatedAddress = address;\n const user = this.evmUser(address);\n setCurrentUser(user);\n return user;\n }\n async logout() {\n // EIP-1193 has no standard disconnect; clearing the Bounded session is the\n // logout. (wallet_revokePermissions is non-standard/opt-in — skip it.)\n await SessionManager().clearSession();\n this.authenticatedAddress = null;\n setCurrentUser(null);\n }\n // --- Signing surface -------------------------------------------------------\n /** App-facing message signing: EIP-191 personal_sign, returns 0x r‖s‖v hex. */\n async signMessage(message) {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n if (!this.authenticatedAddress || address !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before signing.');\n }\n return provider.request({ method: 'personal_sign', params: [message, address] });\n }\n // Solana-typed methods are structurally unsupported on an EVM wallet, and\n // this provider is login-only, so there is no transaction surface at all.\n async signTransaction(_transaction) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async signAndSubmitTransaction(_transaction, _feePayer) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async getNativeMethods() {\n return this.resolveProvider();\n }\n}\nInjectedEvmWalletProvider.instance = null;\n"],"names":["normalizeEvmAddress","setAuthLoading","SessionManager","setCurrentUser","genAuthNonce","getConfig","genSiweMessage","createSessionWithSignature","setStoredAuthMethod"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,kBAAkB,GAAG,EAAE;AAC7B,IAAI,wBAAwB,GAAG,KAAK;AACpC,SAAS,sBAAsB,GAAG;AAClC,IAAI,IAAI,wBAAwB,IAAI,OAAO,MAAM,KAAK,WAAW;AACjE,QAAQ;AACR,IAAI,wBAAwB,GAAG,IAAI;AACnC,IAAI,MAAM,CAAC,gBAAgB,CAAC,0BAA0B,EAAE,CAAC,KAAK,KAAK;AACnE,QAA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AG;AAC7B,QAAQ,OAAO,IAAI,CAAC,eAAe,EAAE;AACrC,IAAI;AACJ;AACA,yBAAyB,CAAC,QAAQ,GAAG,IAAI;;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { normalizeEvmAddress, getActiveSessionManager, genAuthNonce, getConfig, genSiweMessage, createSessionWithSignature } from '@bounded-sh/core';
2
- import { p as defaultInjectedEvmProvider, j as setAuthLoading, s as setCurrentUser, m as setStoredAuthMethod } from './index-xNGb1ROp.mjs';
2
+ import { q as defaultInjectedEvmProvider, k as setAuthLoading, s as setCurrentUser, o as setStoredAuthMethod } from './index-BdzGX8fS.mjs';
3
3
  import 'react';
4
4
 
5
5
  // Must equal the authMethod the registry (auth/index.ts) sets as currentAuthMethod,
@@ -183,4 +183,4 @@ class InjectedEvmWalletProvider {
183
183
  InjectedEvmWalletProvider.instance = null;
184
184
 
185
185
  export { InjectedEvmWalletProvider, defaultInjectedEvmProvider };
186
- //# sourceMappingURL=injected-evm-wallet-provider--x3yWNps.mjs.map
186
+ //# sourceMappingURL=injected-evm-wallet-provider-BlSFIzEA.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"injected-evm-wallet-provider--x3yWNps.mjs","sources":["../.rollup-tmp/auth/providers/injected-evm-wallet-provider.js"],"sourcesContent":["import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSiweMessage, getConfig, normalizeEvmAddress, } from '@bounded-sh/core';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { setStoredAuthMethod } from '../stored-auth-method';\nimport { defaultInjectedEvmProvider, } from './injected-evm-wallet-types';\n// Re-export the type surface + discovery helper for callers who import the\n// provider module directly.\nexport { defaultInjectedEvmProvider };\n// Must equal the authMethod the registry (auth/index.ts) sets as currentAuthMethod,\n// so clearIncompatibleSession() keeps (not wipes) this session on the next init().\nconst INJECTED_EVM_AUTH_METHOD = 'evm-wallet';\n// The /session issuer's discriminator for the SIWE (EIP-4361 secp256k1) exchange.\nconst SIWE_SESSION_METHOD = 'siwe';\nconst NO_WALLET_ERR = 'No injected EVM wallet found. Install a wallet like MetaMask (metamask.io) or Rabby and try again, ' +\n 'or pass config.evmWalletConfig.getProvider to point at your wallet.';\nconst NO_SOL_TX_ERR = 'EVM wallet login is a LOGIN-ONLY surface (SIWE + personal_sign) and has no Solana ' +\n 'transaction surface: signTransaction/signAndSubmitTransaction are unavailable.';\nfunction normalizeConfig(config) {\n if (config.chainId !== undefined && (!Number.isSafeInteger(config.chainId) || config.chainId <= 0)) {\n throw new Error('EVM wallet chainId must be a positive safe integer');\n }\n return Object.assign({}, config);\n}\nexport class InjectedEvmWalletProvider {\n constructor(config = {}) {\n this.authenticatedAddress = null;\n if (typeof window === 'undefined') {\n throw new Error('InjectedEvmWalletProvider can only be instantiated in a browser environment');\n }\n const normalized = normalizeConfig(config);\n // Singleton so the SDK reuses one instance (mirrors the other providers).\n if (InjectedEvmWalletProvider.instance) {\n InjectedEvmWalletProvider.instance.config = normalized;\n InjectedEvmWalletProvider.instance.authenticatedAddress = null;\n return InjectedEvmWalletProvider.instance;\n }\n this.config = normalized;\n InjectedEvmWalletProvider.instance = this;\n }\n // @user.address (the Solana wallet) is null for an EVM-wallet login: the user\n // authenticated with an EVM wallet and has no Solana address. User.address is\n // typed `string | null`, so this is a plain null, not a cast.\n evmUser(address) {\n return { id: address, address: null, evmAddress: address, provider: this };\n }\n resolveProvider() {\n var _a;\n const provider = (_a = (this.config.getProvider ? this.config.getProvider() : null)) !== null && _a !== void 0 ? _a : defaultInjectedEvmProvider();\n if (!provider)\n throw new Error(NO_WALLET_ERR);\n return provider;\n }\n /** Connect the injected wallet and return its canonical lowercase EVM address. */\n async connectAddress(provider) {\n const accounts = await provider.request({ method: 'eth_requestAccounts' });\n const raw = Array.isArray(accounts) ? accounts[0] : undefined;\n const address = normalizeEvmAddress(raw);\n if (!address)\n throw new Error('Wallet did not return a valid EVM address on connect');\n return address;\n }\n /** Current chain id the wallet is connected to (EIP-155 number), or null. */\n async currentChainId(provider) {\n try {\n const hex = await provider.request({ method: 'eth_chainId' });\n if (typeof hex !== 'string' || !/^0x[0-9a-fA-F]+$/.test(hex))\n return null;\n const n = Number(BigInt(hex));\n return Number.isSafeInteger(n) && n > 0 ? n : null;\n }\n catch (_a) {\n return null;\n }\n }\n async login() {\n var _a;\n setAuthLoading(true);\n try {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n // Reuse a still-valid session for THIS wallet.\n const existing = await SessionManager().getSession();\n if (existing && existing.address === address) {\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n this.markAuthMethod();\n return user;\n }\n // SIWE: nonce -> canonical EIP-4361 prompt -> the wallet personal_sign's it.\n const nonce = await genAuthNonce();\n const appId = (await getConfig()).appId;\n const chainId = (_a = this.config.chainId) !== null && _a !== void 0 ? _a : await this.currentChainId(provider);\n if (chainId === null)\n throw new Error('Could not verify the EVM wallet chain for SIWE login');\n const message = genSiweMessage(address, nonce, appId, this.resolveDomain(), this.resolveUri(), { chainId });\n // personal_sign(message, address) -> 0x r‖s‖v hex (the shape the\n // bounded-auth verifier's recoverSiweSigner consumes). The raw UTF-8\n // message is signed under the EIP-191 envelope the verifier hashes.\n const signature = await provider.request({\n method: 'personal_sign',\n params: [message, address],\n });\n const result = await createSessionWithSignature(address, message, signature, SIWE_SESSION_METHOD);\n await SessionManager().storeSession(address, result.accessToken, result.idToken, result.refreshToken);\n this.markAuthMethod();\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n return user;\n }\n finally {\n setAuthLoading(false);\n }\n }\n resolveDomain() {\n const actual = window.location.host.toLowerCase();\n if (this.config.domain && this.config.domain.toLowerCase() !== actual) {\n throw new Error('SIWE domain override must match the current browser origin');\n }\n return actual;\n }\n resolveUri() {\n const actual = window.location.origin.toLowerCase();\n if (this.config.uri) {\n let configured;\n try {\n configured = new URL(this.config.uri).origin.toLowerCase();\n }\n catch (_a) {\n throw new Error('SIWE URI override must be an absolute URL');\n }\n if (configured !== actual)\n throw new Error('SIWE URI override must match the current browser origin');\n }\n return actual;\n }\n markAuthMethod() {\n setStoredAuthMethod(INJECTED_EVM_AUTH_METHOD);\n }\n async restoreSession(beforeCommit) {\n const session = await SessionManager().getSession();\n beforeCommit === null || beforeCommit === void 0 ? void 0 : beforeCommit();\n if (!session)\n return null;\n // An EVM-wallet session stores the EVM address as its address; @user.address\n // (the Solana wallet) is null for this login.\n const address = normalizeEvmAddress(session.address);\n if (!address) {\n await SessionManager().clearSession();\n return null;\n }\n this.authenticatedAddress = address;\n const user = this.evmUser(address);\n setCurrentUser(user);\n return user;\n }\n async logout() {\n // EIP-1193 has no standard disconnect; clearing the Bounded session is the\n // logout. (wallet_revokePermissions is non-standard/opt-in — skip it.)\n await SessionManager().clearSession();\n this.authenticatedAddress = null;\n setCurrentUser(null);\n }\n // --- Signing surface -------------------------------------------------------\n /** App-facing message signing: EIP-191 personal_sign, returns 0x r‖s‖v hex. */\n async signMessage(message) {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n if (!this.authenticatedAddress || address !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before signing.');\n }\n return provider.request({ method: 'personal_sign', params: [message, address] });\n }\n // Solana-typed methods are structurally unsupported on an EVM wallet, and\n // this provider is login-only, so there is no transaction surface at all.\n async signTransaction(_transaction) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async signAndSubmitTransaction(_transaction, _feePayer) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async getNativeMethods() {\n return this.resolveProvider();\n }\n}\nInjectedEvmWalletProvider.instance = null;\n"],"names":["SessionManager"],"mappings":";;;;AAOA;AACA;AACA,MAAM,wBAAwB,GAAG,YAAY;AAC7C;AACA,MAAM,mBAAmB,GAAG,MAAM;AAClC,MAAM,aAAa,GAAG,qGAAqG;AAC3H,IAAI,qEAAqE;AACzE,MAAM,aAAa,GAAG,oFAAoF;AAC1G,IAAI,gFAAgF;AACpF,SAAS,eAAe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AI,CAAC;AAC5B,IAAI;AACJ;AACA;AACA,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;AAC/B,QAAQ,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,EAAE;AAC/C,QAAQ,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC;AAC3D,QAAQ,IAAI,CAAC,IAAI,CAAC,oBAAoB,IAAI,OAAO,KAAK,IAAI,CAAC,oBAAoB,EAAE;AACjF,YAAY,MAAM,IAAI,KAAK,CAAC,qFAAqF,CAAC;AAClH,QAAQ;AACR,QAAQ,OAAO,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;AACxF,IAAI;AACJ;AACA;AACA,IAAI,MAAM,eAAe,CAAC,YAAY,EAAE;AACxC,QAAQ,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC;AACtC,IAAI;AACJ,IAAI,MAAM,wBAAwB,CAAC,YAAY,EAAE,SAAS,EAAE;AAC5D,QAAQ,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC;AACtC,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,IAAI,CAAC,eAAe,EAAE;AACrC,IAAI;AACJ;AACA,yBAAyB,CAAC,QAAQ,GAAG,IAAI;;;;"}
1
+ {"version":3,"file":"injected-evm-wallet-provider-BlSFIzEA.mjs","sources":["../.rollup-tmp/auth/providers/injected-evm-wallet-provider.js"],"sourcesContent":["import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSiweMessage, getConfig, normalizeEvmAddress, } from '@bounded-sh/core';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { setStoredAuthMethod } from '../stored-auth-method';\nimport { defaultInjectedEvmProvider, } from './injected-evm-wallet-types';\n// Re-export the type surface + discovery helper for callers who import the\n// provider module directly.\nexport { defaultInjectedEvmProvider };\n// Must equal the authMethod the registry (auth/index.ts) sets as currentAuthMethod,\n// so clearIncompatibleSession() keeps (not wipes) this session on the next init().\nconst INJECTED_EVM_AUTH_METHOD = 'evm-wallet';\n// The /session issuer's discriminator for the SIWE (EIP-4361 secp256k1) exchange.\nconst SIWE_SESSION_METHOD = 'siwe';\nconst NO_WALLET_ERR = 'No injected EVM wallet found. Install a wallet like MetaMask (metamask.io) or Rabby and try again, ' +\n 'or pass config.evmWalletConfig.getProvider to point at your wallet.';\nconst NO_SOL_TX_ERR = 'EVM wallet login is a LOGIN-ONLY surface (SIWE + personal_sign) and has no Solana ' +\n 'transaction surface: signTransaction/signAndSubmitTransaction are unavailable.';\nfunction normalizeConfig(config) {\n if (config.chainId !== undefined && (!Number.isSafeInteger(config.chainId) || config.chainId <= 0)) {\n throw new Error('EVM wallet chainId must be a positive safe integer');\n }\n return Object.assign({}, config);\n}\nexport class InjectedEvmWalletProvider {\n constructor(config = {}) {\n this.authenticatedAddress = null;\n if (typeof window === 'undefined') {\n throw new Error('InjectedEvmWalletProvider can only be instantiated in a browser environment');\n }\n const normalized = normalizeConfig(config);\n // Singleton so the SDK reuses one instance (mirrors the other providers).\n if (InjectedEvmWalletProvider.instance) {\n InjectedEvmWalletProvider.instance.config = normalized;\n InjectedEvmWalletProvider.instance.authenticatedAddress = null;\n return InjectedEvmWalletProvider.instance;\n }\n this.config = normalized;\n InjectedEvmWalletProvider.instance = this;\n }\n // @user.address (the Solana wallet) is null for an EVM-wallet login: the user\n // authenticated with an EVM wallet and has no Solana address. User.address is\n // typed `string | null`, so this is a plain null, not a cast.\n evmUser(address) {\n return { id: address, address: null, evmAddress: address, provider: this };\n }\n resolveProvider() {\n var _a;\n const provider = (_a = (this.config.getProvider ? this.config.getProvider() : null)) !== null && _a !== void 0 ? _a : defaultInjectedEvmProvider();\n if (!provider)\n throw new Error(NO_WALLET_ERR);\n return provider;\n }\n /** Connect the injected wallet and return its canonical lowercase EVM address. */\n async connectAddress(provider) {\n const accounts = await provider.request({ method: 'eth_requestAccounts' });\n const raw = Array.isArray(accounts) ? accounts[0] : undefined;\n const address = normalizeEvmAddress(raw);\n if (!address)\n throw new Error('Wallet did not return a valid EVM address on connect');\n return address;\n }\n /** Current chain id the wallet is connected to (EIP-155 number), or null. */\n async currentChainId(provider) {\n try {\n const hex = await provider.request({ method: 'eth_chainId' });\n if (typeof hex !== 'string' || !/^0x[0-9a-fA-F]+$/.test(hex))\n return null;\n const n = Number(BigInt(hex));\n return Number.isSafeInteger(n) && n > 0 ? n : null;\n }\n catch (_a) {\n return null;\n }\n }\n async login() {\n var _a;\n setAuthLoading(true);\n try {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n // Reuse a still-valid session for THIS wallet.\n const existing = await SessionManager().getSession();\n if (existing && existing.address === address) {\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n this.markAuthMethod();\n return user;\n }\n // SIWE: nonce -> canonical EIP-4361 prompt -> the wallet personal_sign's it.\n const nonce = await genAuthNonce();\n const appId = (await getConfig()).appId;\n const chainId = (_a = this.config.chainId) !== null && _a !== void 0 ? _a : await this.currentChainId(provider);\n if (chainId === null)\n throw new Error('Could not verify the EVM wallet chain for SIWE login');\n const message = genSiweMessage(address, nonce, appId, this.resolveDomain(), this.resolveUri(), { chainId });\n // personal_sign(message, address) -> 0x r‖s‖v hex (the shape the\n // bounded-auth verifier's recoverSiweSigner consumes). The raw UTF-8\n // message is signed under the EIP-191 envelope the verifier hashes.\n const signature = await provider.request({\n method: 'personal_sign',\n params: [message, address],\n });\n const result = await createSessionWithSignature(address, message, signature, SIWE_SESSION_METHOD);\n await SessionManager().storeSession(address, result.accessToken, result.idToken, result.refreshToken);\n this.markAuthMethod();\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n return user;\n }\n finally {\n setAuthLoading(false);\n }\n }\n resolveDomain() {\n const actual = window.location.host.toLowerCase();\n if (this.config.domain && this.config.domain.toLowerCase() !== actual) {\n throw new Error('SIWE domain override must match the current browser origin');\n }\n return actual;\n }\n resolveUri() {\n const actual = window.location.origin.toLowerCase();\n if (this.config.uri) {\n let configured;\n try {\n configured = new URL(this.config.uri).origin.toLowerCase();\n }\n catch (_a) {\n throw new Error('SIWE URI override must be an absolute URL');\n }\n if (configured !== actual)\n throw new Error('SIWE URI override must match the current browser origin');\n }\n return actual;\n }\n markAuthMethod() {\n setStoredAuthMethod(INJECTED_EVM_AUTH_METHOD);\n }\n async restoreSession(beforeCommit) {\n const session = await SessionManager().getSession();\n beforeCommit === null || beforeCommit === void 0 ? void 0 : beforeCommit();\n if (!session)\n return null;\n // An EVM-wallet session stores the EVM address as its address; @user.address\n // (the Solana wallet) is null for this login.\n const address = normalizeEvmAddress(session.address);\n if (!address) {\n await SessionManager().clearSession();\n return null;\n }\n this.authenticatedAddress = address;\n const user = this.evmUser(address);\n setCurrentUser(user);\n return user;\n }\n async logout() {\n // EIP-1193 has no standard disconnect; clearing the Bounded session is the\n // logout. (wallet_revokePermissions is non-standard/opt-in — skip it.)\n await SessionManager().clearSession();\n this.authenticatedAddress = null;\n setCurrentUser(null);\n }\n // --- Signing surface -------------------------------------------------------\n /** App-facing message signing: EIP-191 personal_sign, returns 0x r‖s‖v hex. */\n async signMessage(message) {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n if (!this.authenticatedAddress || address !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before signing.');\n }\n return provider.request({ method: 'personal_sign', params: [message, address] });\n }\n // Solana-typed methods are structurally unsupported on an EVM wallet, and\n // this provider is login-only, so there is no transaction surface at all.\n async signTransaction(_transaction) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async signAndSubmitTransaction(_transaction, _feePayer) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async getNativeMethods() {\n return this.resolveProvider();\n }\n}\nInjectedEvmWalletProvider.instance = null;\n"],"names":["SessionManager"],"mappings":";;;;AAOA;AACA;AACA,MAAM,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IAAI;AACnB,IAAI;AACJ,IAAI,MAAM,MAAM,GAAG;AACnB;AACA;AACA,QAAQ,MAAMA,uBAAc,EAAE,CAAC,YAAY,EAAE;AAC7C,QAAQ,IAAI,CAAC,oBAAoB,GAAG,IAAI;AACxC,QAAQ,cAAc,CAAC,IAAI,CAAC;AAC5B,IAAI;AACJ;AACA;AACA,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;AAC/B,QAAQ,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,EAAE;AAC/C,QAAQ,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC;AAC3D,QAAQ,IAAI,CAAC,IAAI,CAAC,oBAAoB,IAAI,OAAO,KAAK,IAAI,CAAC,oBAAoB,EAAE;AACjF,YAAY,MAAM,IAAI,KAAK,CAAC,qFAAqF,CAAC;AAClH,QAAQ;AACR,QAAQ,OAAO,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;AACxF,IAAI;AACJ;AACA;AACA,IAAI,MAAM,eAAe,CAAC,YAAY,EAAE;AACxC,QAAQ,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC;AACtC,IAAI;AACJ,IAAI,MAAM,wBAAwB,CAAC,YAAY,EAAE,SAAS,EAAE;AAC5D,QAAQ,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC;AACtC,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,IAAI,CAAC,eAAe,EAAE;AACrC,IAAI;AACJ;AACA,yBAAyB,CAAC,QAAQ,GAAG,IAAI;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { normalizeEvmAddress, getActiveSessionManager, genAuthNonce, getConfig, genSiweMessage, createSessionWithSignature } from '@bounded-sh/core';
2
- import { l as setAuthLoading, s as setCurrentUser, o as setStoredAuthMethod } from './index.native-YmmnwqEw.mjs';
2
+ import { m as setAuthLoading, s as setCurrentUser, p as setStoredAuthMethod } from './index.native-N5zxPEYK.mjs';
3
3
  import 'react';
4
4
 
5
5
  // injected-evm-wallet-types.ts — tiny, dependency-free surface for the EVM
@@ -249,4 +249,4 @@ class InjectedEvmWalletProvider {
249
249
  InjectedEvmWalletProvider.instance = null;
250
250
 
251
251
  export { InjectedEvmWalletProvider, defaultInjectedEvmProvider };
252
- //# sourceMappingURL=injected-evm-wallet-provider-BoLGCVqD.mjs.map
252
+ //# sourceMappingURL=injected-evm-wallet-provider-CtPPhtMh.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"injected-evm-wallet-provider-BoLGCVqD.mjs","sources":["../.rollup-tmp/auth/providers/injected-evm-wallet-types.js","../.rollup-tmp/auth/providers/injected-evm-wallet-provider.js"],"sourcesContent":["// injected-evm-wallet-types.ts — tiny, dependency-free surface for the EVM\n// WALLET LOGIN path (BYO wallet via SIWE). The EVM twin of\n// injected-wallet-types.ts: kept separate from injected-evm-wallet-provider.ts\n// so the SDK entry can eagerly export the type surface + the provider-discovery\n// helper WITHOUT dragging the provider class into the default bundle. The\n// provider is lazy-loaded by getAuthProvider() when an app opts into\n// authMethod:'evm-wallet'.\n//\n// It rides the standard EIP-1193 injected provider a browser wallet exposes\n// (MetaMask / Rabby / Coinbase Wallet / any window.ethereum), discovered via\n// EIP-6963 (multi-wallet, collision-free) with a window.ethereum fallback. It\n// needs NO viem/ethers and NO React — EIP-1193 request() + hex strings suffice.\n// EIP-6963 is announcement-based: wallets add an `eip6963:requestProvider`\n// listener and synchronously dispatch `eip6963:announceProvider` in response. We\n// keep a persistent collector so announcements (including late ones) are\n// captured, and re-request on demand.\nconst announcedProviders = [];\nlet announceListenerAttached = false;\nfunction attachAnnounceListener() {\n if (announceListenerAttached || typeof window === 'undefined')\n return;\n announceListenerAttached = true;\n window.addEventListener('eip6963:announceProvider', (event) => {\n const detail = event === null || event === void 0 ? void 0 : event.detail;\n if (detail &&\n detail.provider &&\n typeof detail.provider.request === 'function' &&\n !announcedProviders.some((d) => { var _a, _b; return ((_a = d.info) === null || _a === void 0 ? void 0 : _a.uuid) === ((_b = detail.info) === null || _b === void 0 ? void 0 : _b.uuid); })) {\n announcedProviders.push(detail);\n }\n });\n}\n/**\n * Request + collect EIP-6963 providers. Dispatches `eip6963:requestProvider`\n * (synchronous — already-loaded wallets announce in the same tick) and returns\n * every wallet announced so far. Kept synchronous so it works inside a user\n * gesture and can be eagerly exported from the SDK entry.\n */\nexport function requestEip6963Providers() {\n if (typeof window === 'undefined')\n return [];\n attachAnnounceListener();\n try {\n window.dispatchEvent(new Event('eip6963:requestProvider'));\n }\n catch (_a) {\n /* older browsers without Event constructor — fall through to window.ethereum */\n }\n return announcedProviders.slice();\n}\n/**\n * Default EVM provider discovery: EIP-6963 first (multi-wallet, collision-free),\n * then legacy `window.ethereum`. Returns null when no injected wallet is present.\n */\nexport function defaultInjectedEvmProvider() {\n if (typeof window === 'undefined')\n return null;\n const details = requestEip6963Providers();\n if (details.length > 0)\n return details[0].provider;\n const eth = window.ethereum;\n if (eth && typeof eth.request === 'function')\n return eth;\n return null;\n}\n","import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSiweMessage, getConfig, normalizeEvmAddress, } from '@bounded-sh/core';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { setStoredAuthMethod } from '../stored-auth-method';\nimport { defaultInjectedEvmProvider, } from './injected-evm-wallet-types';\n// Re-export the type surface + discovery helper for callers who import the\n// provider module directly.\nexport { defaultInjectedEvmProvider };\n// Must equal the authMethod the registry (auth/index.ts) sets as currentAuthMethod,\n// so clearIncompatibleSession() keeps (not wipes) this session on the next init().\nconst INJECTED_EVM_AUTH_METHOD = 'evm-wallet';\n// The /session issuer's discriminator for the SIWE (EIP-4361 secp256k1) exchange.\nconst SIWE_SESSION_METHOD = 'siwe';\nconst NO_WALLET_ERR = 'No injected EVM wallet found. Install a wallet like MetaMask (metamask.io) or Rabby and try again, ' +\n 'or pass config.evmWalletConfig.getProvider to point at your wallet.';\nconst NO_SOL_TX_ERR = 'EVM wallet login is a LOGIN-ONLY surface (SIWE + personal_sign) and has no Solana ' +\n 'transaction surface: signTransaction/signAndSubmitTransaction are unavailable.';\nfunction normalizeConfig(config) {\n if (config.chainId !== undefined && (!Number.isSafeInteger(config.chainId) || config.chainId <= 0)) {\n throw new Error('EVM wallet chainId must be a positive safe integer');\n }\n return Object.assign({}, config);\n}\nexport class InjectedEvmWalletProvider {\n constructor(config = {}) {\n this.authenticatedAddress = null;\n if (typeof window === 'undefined') {\n throw new Error('InjectedEvmWalletProvider can only be instantiated in a browser environment');\n }\n const normalized = normalizeConfig(config);\n // Singleton so the SDK reuses one instance (mirrors the other providers).\n if (InjectedEvmWalletProvider.instance) {\n InjectedEvmWalletProvider.instance.config = normalized;\n InjectedEvmWalletProvider.instance.authenticatedAddress = null;\n return InjectedEvmWalletProvider.instance;\n }\n this.config = normalized;\n InjectedEvmWalletProvider.instance = this;\n }\n // @user.address (the Solana wallet) is null for an EVM-wallet login: the user\n // authenticated with an EVM wallet and has no Solana address. User.address is\n // typed `string | null`, so this is a plain null, not a cast.\n evmUser(address) {\n return { id: address, address: null, evmAddress: address, provider: this };\n }\n resolveProvider() {\n var _a;\n const provider = (_a = (this.config.getProvider ? this.config.getProvider() : null)) !== null && _a !== void 0 ? _a : defaultInjectedEvmProvider();\n if (!provider)\n throw new Error(NO_WALLET_ERR);\n return provider;\n }\n /** Connect the injected wallet and return its canonical lowercase EVM address. */\n async connectAddress(provider) {\n const accounts = await provider.request({ method: 'eth_requestAccounts' });\n const raw = Array.isArray(accounts) ? accounts[0] : undefined;\n const address = normalizeEvmAddress(raw);\n if (!address)\n throw new Error('Wallet did not return a valid EVM address on connect');\n return address;\n }\n /** Current chain id the wallet is connected to (EIP-155 number), or null. */\n async currentChainId(provider) {\n try {\n const hex = await provider.request({ method: 'eth_chainId' });\n if (typeof hex !== 'string' || !/^0x[0-9a-fA-F]+$/.test(hex))\n return null;\n const n = Number(BigInt(hex));\n return Number.isSafeInteger(n) && n > 0 ? n : null;\n }\n catch (_a) {\n return null;\n }\n }\n async login() {\n var _a;\n setAuthLoading(true);\n try {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n // Reuse a still-valid session for THIS wallet.\n const existing = await SessionManager().getSession();\n if (existing && existing.address === address) {\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n this.markAuthMethod();\n return user;\n }\n // SIWE: nonce -> canonical EIP-4361 prompt -> the wallet personal_sign's it.\n const nonce = await genAuthNonce();\n const appId = (await getConfig()).appId;\n const chainId = (_a = this.config.chainId) !== null && _a !== void 0 ? _a : await this.currentChainId(provider);\n if (chainId === null)\n throw new Error('Could not verify the EVM wallet chain for SIWE login');\n const message = genSiweMessage(address, nonce, appId, this.resolveDomain(), this.resolveUri(), { chainId });\n // personal_sign(message, address) -> 0x r‖s‖v hex (the shape the\n // bounded-auth verifier's recoverSiweSigner consumes). The raw UTF-8\n // message is signed under the EIP-191 envelope the verifier hashes.\n const signature = await provider.request({\n method: 'personal_sign',\n params: [message, address],\n });\n const result = await createSessionWithSignature(address, message, signature, SIWE_SESSION_METHOD);\n await SessionManager().storeSession(address, result.accessToken, result.idToken, result.refreshToken);\n this.markAuthMethod();\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n return user;\n }\n finally {\n setAuthLoading(false);\n }\n }\n resolveDomain() {\n const actual = window.location.host.toLowerCase();\n if (this.config.domain && this.config.domain.toLowerCase() !== actual) {\n throw new Error('SIWE domain override must match the current browser origin');\n }\n return actual;\n }\n resolveUri() {\n const actual = window.location.origin.toLowerCase();\n if (this.config.uri) {\n let configured;\n try {\n configured = new URL(this.config.uri).origin.toLowerCase();\n }\n catch (_a) {\n throw new Error('SIWE URI override must be an absolute URL');\n }\n if (configured !== actual)\n throw new Error('SIWE URI override must match the current browser origin');\n }\n return actual;\n }\n markAuthMethod() {\n setStoredAuthMethod(INJECTED_EVM_AUTH_METHOD);\n }\n async restoreSession(beforeCommit) {\n const session = await SessionManager().getSession();\n beforeCommit === null || beforeCommit === void 0 ? void 0 : beforeCommit();\n if (!session)\n return null;\n // An EVM-wallet session stores the EVM address as its address; @user.address\n // (the Solana wallet) is null for this login.\n const address = normalizeEvmAddress(session.address);\n if (!address) {\n await SessionManager().clearSession();\n return null;\n }\n this.authenticatedAddress = address;\n const user = this.evmUser(address);\n setCurrentUser(user);\n return user;\n }\n async logout() {\n // EIP-1193 has no standard disconnect; clearing the Bounded session is the\n // logout. (wallet_revokePermissions is non-standard/opt-in — skip it.)\n await SessionManager().clearSession();\n this.authenticatedAddress = null;\n setCurrentUser(null);\n }\n // --- Signing surface -------------------------------------------------------\n /** App-facing message signing: EIP-191 personal_sign, returns 0x r‖s‖v hex. */\n async signMessage(message) {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n if (!this.authenticatedAddress || address !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before signing.');\n }\n return provider.request({ method: 'personal_sign', params: [message, address] });\n }\n // Solana-typed methods are structurally unsupported on an EVM wallet, and\n // this provider is login-only, so there is no transaction surface at all.\n async signTransaction(_transaction) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async signAndSubmitTransaction(_transaction, _feePayer) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async getNativeMethods() {\n return this.resolveProvider();\n }\n}\nInjectedEvmWalletProvider.instance = null;\n"],"names":["SessionManager"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,kBAAkB,GAAG,EAAE;AAC7B,IAAI,wBAAwB,GAAG,KAAK;AACpC,SAAS,sBAAsB,GAAG;AAClC,IAAI,IAAI,wBAAwB,IAAI,OAAO,MAAM,KAAK,WAAW;AACjE,QAAQ;AACR,IAAI,wBAAwB,GAAG,IAAI;AACnC,IAAI,MAAM,CA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;AACtC,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,IAAI,CAAC,eAAe,EAAE;AACrC,IAAI;AACJ;AACA,yBAAyB,CAAC,QAAQ,GAAG,IAAI;;;;"}
1
+ {"version":3,"file":"injected-evm-wallet-provider-CtPPhtMh.mjs","sources":["../.rollup-tmp/auth/providers/injected-evm-wallet-types.js","../.rollup-tmp/auth/providers/injected-evm-wallet-provider.js"],"sourcesContent":["// injected-evm-wallet-types.ts — tiny, dependency-free surface for the EVM\n// WALLET LOGIN path (BYO wallet via SIWE). The EVM twin of\n// injected-wallet-types.ts: kept separate from injected-evm-wallet-provider.ts\n// so the SDK entry can eagerly export the type surface + the provider-discovery\n// helper WITHOUT dragging the provider class into the default bundle. The\n// provider is lazy-loaded by getAuthProvider() when an app opts into\n// authMethod:'evm-wallet'.\n//\n// It rides the standard EIP-1193 injected provider a browser wallet exposes\n// (MetaMask / Rabby / Coinbase Wallet / any window.ethereum), discovered via\n// EIP-6963 (multi-wallet, collision-free) with a window.ethereum fallback. It\n// needs NO viem/ethers and NO React — EIP-1193 request() + hex strings suffice.\n// EIP-6963 is announcement-based: wallets add an `eip6963:requestProvider`\n// listener and synchronously dispatch `eip6963:announceProvider` in response. We\n// keep a persistent collector so announcements (including late ones) are\n// captured, and re-request on demand.\nconst announcedProviders = [];\nlet announceListenerAttached = false;\nfunction attachAnnounceListener() {\n if (announceListenerAttached || typeof window === 'undefined')\n return;\n announceListenerAttached = true;\n window.addEventListener('eip6963:announceProvider', (event) => {\n const detail = event === null || event === void 0 ? void 0 : event.detail;\n if (detail &&\n detail.provider &&\n typeof detail.provider.request === 'function' &&\n !announcedProviders.some((d) => { var _a, _b; return ((_a = d.info) === null || _a === void 0 ? void 0 : _a.uuid) === ((_b = detail.info) === null || _b === void 0 ? void 0 : _b.uuid); })) {\n announcedProviders.push(detail);\n }\n });\n}\n/**\n * Request + collect EIP-6963 providers. Dispatches `eip6963:requestProvider`\n * (synchronous — already-loaded wallets announce in the same tick) and returns\n * every wallet announced so far. Kept synchronous so it works inside a user\n * gesture and can be eagerly exported from the SDK entry.\n */\nexport function requestEip6963Providers() {\n if (typeof window === 'undefined')\n return [];\n attachAnnounceListener();\n try {\n window.dispatchEvent(new Event('eip6963:requestProvider'));\n }\n catch (_a) {\n /* older browsers without Event constructor — fall through to window.ethereum */\n }\n return announcedProviders.slice();\n}\n/**\n * Default EVM provider discovery: EIP-6963 first (multi-wallet, collision-free),\n * then legacy `window.ethereum`. Returns null when no injected wallet is present.\n */\nexport function defaultInjectedEvmProvider() {\n if (typeof window === 'undefined')\n return null;\n const details = requestEip6963Providers();\n if (details.length > 0)\n return details[0].provider;\n const eth = window.ethereum;\n if (eth && typeof eth.request === 'function')\n return eth;\n return null;\n}\n","import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSiweMessage, getConfig, normalizeEvmAddress, } from '@bounded-sh/core';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { setStoredAuthMethod } from '../stored-auth-method';\nimport { defaultInjectedEvmProvider, } from './injected-evm-wallet-types';\n// Re-export the type surface + discovery helper for callers who import the\n// provider module directly.\nexport { defaultInjectedEvmProvider };\n// Must equal the authMethod the registry (auth/index.ts) sets as currentAuthMethod,\n// so clearIncompatibleSession() keeps (not wipes) this session on the next init().\nconst INJECTED_EVM_AUTH_METHOD = 'evm-wallet';\n// The /session issuer's discriminator for the SIWE (EIP-4361 secp256k1) exchange.\nconst SIWE_SESSION_METHOD = 'siwe';\nconst NO_WALLET_ERR = 'No injected EVM wallet found. Install a wallet like MetaMask (metamask.io) or Rabby and try again, ' +\n 'or pass config.evmWalletConfig.getProvider to point at your wallet.';\nconst NO_SOL_TX_ERR = 'EVM wallet login is a LOGIN-ONLY surface (SIWE + personal_sign) and has no Solana ' +\n 'transaction surface: signTransaction/signAndSubmitTransaction are unavailable.';\nfunction normalizeConfig(config) {\n if (config.chainId !== undefined && (!Number.isSafeInteger(config.chainId) || config.chainId <= 0)) {\n throw new Error('EVM wallet chainId must be a positive safe integer');\n }\n return Object.assign({}, config);\n}\nexport class InjectedEvmWalletProvider {\n constructor(config = {}) {\n this.authenticatedAddress = null;\n if (typeof window === 'undefined') {\n throw new Error('InjectedEvmWalletProvider can only be instantiated in a browser environment');\n }\n const normalized = normalizeConfig(config);\n // Singleton so the SDK reuses one instance (mirrors the other providers).\n if (InjectedEvmWalletProvider.instance) {\n InjectedEvmWalletProvider.instance.config = normalized;\n InjectedEvmWalletProvider.instance.authenticatedAddress = null;\n return InjectedEvmWalletProvider.instance;\n }\n this.config = normalized;\n InjectedEvmWalletProvider.instance = this;\n }\n // @user.address (the Solana wallet) is null for an EVM-wallet login: the user\n // authenticated with an EVM wallet and has no Solana address. User.address is\n // typed `string | null`, so this is a plain null, not a cast.\n evmUser(address) {\n return { id: address, address: null, evmAddress: address, provider: this };\n }\n resolveProvider() {\n var _a;\n const provider = (_a = (this.config.getProvider ? this.config.getProvider() : null)) !== null && _a !== void 0 ? _a : defaultInjectedEvmProvider();\n if (!provider)\n throw new Error(NO_WALLET_ERR);\n return provider;\n }\n /** Connect the injected wallet and return its canonical lowercase EVM address. */\n async connectAddress(provider) {\n const accounts = await provider.request({ method: 'eth_requestAccounts' });\n const raw = Array.isArray(accounts) ? accounts[0] : undefined;\n const address = normalizeEvmAddress(raw);\n if (!address)\n throw new Error('Wallet did not return a valid EVM address on connect');\n return address;\n }\n /** Current chain id the wallet is connected to (EIP-155 number), or null. */\n async currentChainId(provider) {\n try {\n const hex = await provider.request({ method: 'eth_chainId' });\n if (typeof hex !== 'string' || !/^0x[0-9a-fA-F]+$/.test(hex))\n return null;\n const n = Number(BigInt(hex));\n return Number.isSafeInteger(n) && n > 0 ? n : null;\n }\n catch (_a) {\n return null;\n }\n }\n async login() {\n var _a;\n setAuthLoading(true);\n try {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n // Reuse a still-valid session for THIS wallet.\n const existing = await SessionManager().getSession();\n if (existing && existing.address === address) {\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n this.markAuthMethod();\n return user;\n }\n // SIWE: nonce -> canonical EIP-4361 prompt -> the wallet personal_sign's it.\n const nonce = await genAuthNonce();\n const appId = (await getConfig()).appId;\n const chainId = (_a = this.config.chainId) !== null && _a !== void 0 ? _a : await this.currentChainId(provider);\n if (chainId === null)\n throw new Error('Could not verify the EVM wallet chain for SIWE login');\n const message = genSiweMessage(address, nonce, appId, this.resolveDomain(), this.resolveUri(), { chainId });\n // personal_sign(message, address) -> 0x r‖s‖v hex (the shape the\n // bounded-auth verifier's recoverSiweSigner consumes). The raw UTF-8\n // message is signed under the EIP-191 envelope the verifier hashes.\n const signature = await provider.request({\n method: 'personal_sign',\n params: [message, address],\n });\n const result = await createSessionWithSignature(address, message, signature, SIWE_SESSION_METHOD);\n await SessionManager().storeSession(address, result.accessToken, result.idToken, result.refreshToken);\n this.markAuthMethod();\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n return user;\n }\n finally {\n setAuthLoading(false);\n }\n }\n resolveDomain() {\n const actual = window.location.host.toLowerCase();\n if (this.config.domain && this.config.domain.toLowerCase() !== actual) {\n throw new Error('SIWE domain override must match the current browser origin');\n }\n return actual;\n }\n resolveUri() {\n const actual = window.location.origin.toLowerCase();\n if (this.config.uri) {\n let configured;\n try {\n configured = new URL(this.config.uri).origin.toLowerCase();\n }\n catch (_a) {\n throw new Error('SIWE URI override must be an absolute URL');\n }\n if (configured !== actual)\n throw new Error('SIWE URI override must match the current browser origin');\n }\n return actual;\n }\n markAuthMethod() {\n setStoredAuthMethod(INJECTED_EVM_AUTH_METHOD);\n }\n async restoreSession(beforeCommit) {\n const session = await SessionManager().getSession();\n beforeCommit === null || beforeCommit === void 0 ? void 0 : beforeCommit();\n if (!session)\n return null;\n // An EVM-wallet session stores the EVM address as its address; @user.address\n // (the Solana wallet) is null for this login.\n const address = normalizeEvmAddress(session.address);\n if (!address) {\n await SessionManager().clearSession();\n return null;\n }\n this.authenticatedAddress = address;\n const user = this.evmUser(address);\n setCurrentUser(user);\n return user;\n }\n async logout() {\n // EIP-1193 has no standard disconnect; clearing the Bounded session is the\n // logout. (wallet_revokePermissions is non-standard/opt-in — skip it.)\n await SessionManager().clearSession();\n this.authenticatedAddress = null;\n setCurrentUser(null);\n }\n // --- Signing surface -------------------------------------------------------\n /** App-facing message signing: EIP-191 personal_sign, returns 0x r‖s‖v hex. */\n async signMessage(message) {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n if (!this.authenticatedAddress || address !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before signing.');\n }\n return provider.request({ method: 'personal_sign', params: [message, address] });\n }\n // Solana-typed methods are structurally unsupported on an EVM wallet, and\n // this provider is login-only, so there is no transaction surface at all.\n async signTransaction(_transaction) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async signAndSubmitTransaction(_transaction, _feePayer) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async getNativeMethods() {\n return this.resolveProvider();\n }\n}\nInjectedEvmWalletProvider.instance = null;\n"],"names":["SessionManager"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,kBAAkB,GAAG,EAAE;AAC7B,IAAI,wBAAwB,GAAG,KAAK;AACpC,SAAS,sBAAsB,GAAG;AAClC,IAAI,IAAI,wBAAwB,IAAI,OAAO,MAAM,KAAK,WAAW;AACjE,QAAQ;AACR,IAAI,wBAAwB,GAAG,IAAI;AACnC,IAAI,MAAM,CAAC,gBAAgB,CAAC,0BAA0B,EAAE,CAAC,KAAK,KAAK;AACnE,QAAQ,MAAM,MAAM,GAAG,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM;AACjF,QAAQ,IAAI,MAAM;AAClB,YAAY,MAAM,CAAC,QAAQ;AAC3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ionWithSignature } from '@bounded-sh/core';
2
- import { e as bs58, n as normalizeSolanaRpcUrl, S as SELECTED_WALLET_UNAVAILABLE_ERR, f as defaultInjectedProvider, i as firstStandardWalletProvider, j as setAuthLoading, k as supportsWalletSignIn, s as setCurrentUser, l as bufferExports, m as setStoredAuthMethod, g as getPlatform, t as transactionHasSignature, o as confirmAndCheckTransaction, r as resolveSolanaRpcUrl } from './index-xNGb1ROp.mjs';
2
+ import { f as bs58, n as normalizeSolanaRpcUrl, S as SELECTED_WALLET_UNAVAILABLE_ERR, i as defaultInjectedProvider, j as firstStandardWalletProvider, k as setAuthLoading, l as supportsWalletSignIn, s as setCurrentUser, m as bufferExports, o as setStoredAuthMethod, g as getPlatform, t as transactionHasSignature, p as confirmAndCheckTransaction, r as resolveSolanaRpcUrl } from './index-BdzGX8fS.mjs';
3
3
  import 'react';
4
4
 
5
5
  const crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
@@ -2857,4 +2857,4 @@ class InjectedWalletProvider {
2857
2857
  }
2858
2858
 
2859
2859
  export { InjectedWalletProvider, WALLET_SIGN_IN_UNSUPPORTED_ERR, defaultInjectedProvider };
2860
- //# sourceMappingURL=injected-wallet-provider-DuWTw-fM.mjs.map
2860
+ //# sourceMappingURL=injected-wallet-provider-Bnsfazum.mjs.map