@privy-io/expo 0.70.11 → 0.71.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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM5LUTEL3js = require('./chunk-M5LUTEL3.js');var _chunkK5SPDXVFjs = require('./chunk-K5SPDXVF.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var f=()=>{let e=_chunkM5LUTEL3js.l.call(void 0, );return _react.useMemo.call(void 0, ()=>({createWallet(n){return _chunkK5SPDXVFjs.e.call(void 0, this,null,function*(){let s=yield _jssdkcore.create.call(void 0, e,{request:{chain_type:n.chainType}}),{user:o}=yield e.user.get();return{user:o,wallet:s}})}}),[e])};var C=()=>{let e=_chunkM5LUTEL3js.l.call(void 0, );return _react.useMemo.call(void 0, ()=>({signRawHash(k){return _chunkK5SPDXVFjs.e.call(void 0, this,arguments,function*({address:n,chainType:s,hash:o}){let l=_chunkM5LUTEL3js.b.call(void 0, );if(!l)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_before_logged_in",error:"User must be authenticated before signing a raw hash"});let p=l.linked_accounts.filter(_jssdkcore.isEmbeddedWalletAccount).filter(_jssdkcore.isUnifiedWallet).filter(t=>t.chain_type===s).find(t=>t.address===n);if(!p)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"No embedded wallet found for the given address and chain type"});let r=yield _jssdkcore.rawSign.call(void 0, e,(...t)=>e.embeddedWallet.signWithUserSigner(...t),{wallet_id:p.id,params:{hash:o}});if(r.data&&"signature"in r.data&&r.data.encoding==="hex")return{signature:r.data.signature};throw new Error("Failed to sign")})}}),[e])};exports.useCreateWallet = f; exports.useSignRawHash = C;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk77II74GHjs = require('./chunk-77II74GH.js');var _chunkK5SPDXVFjs = require('./chunk-K5SPDXVF.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var f=()=>{let e=_chunk77II74GHjs.l.call(void 0, );return _react.useMemo.call(void 0, ()=>({createWallet(n){return _chunkK5SPDXVFjs.e.call(void 0, this,null,function*(){let s=yield _jssdkcore.create.call(void 0, e,{request:{chain_type:n.chainType}}),{user:o}=yield e.user.get();return{user:o,wallet:s}})}}),[e])};var C=()=>{let e=_chunk77II74GHjs.l.call(void 0, );return _react.useMemo.call(void 0, ()=>({signRawHash(k){return _chunkK5SPDXVFjs.e.call(void 0, this,arguments,function*({address:n,chainType:s,hash:o}){let l=_chunk77II74GHjs.b.call(void 0, );if(!l)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_before_logged_in",error:"User must be authenticated before signing a raw hash"});let p=l.linked_accounts.filter(_jssdkcore.isEmbeddedWalletAccount).filter(_jssdkcore.isUnifiedWallet).filter(t=>t.chain_type===s).find(t=>t.address===n);if(!p)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"No embedded wallet found for the given address and chain type"});let r=yield _jssdkcore.rawSign.call(void 0, e,(...t)=>e.embeddedWallet.signWithUserSigner(...t),{wallet_id:p.id,params:{hash:o}});if(r.data&&"signature"in r.data&&r.data.encoding==="hex")return{signature:r.data.signature};throw new Error("Failed to sign")})}}),[e])};exports.useCreateWallet = f; exports.useSignRawHash = C;
package/dist/index.d.ts CHANGED
@@ -3,13 +3,12 @@ import Privy__default, { EmbeddedWalletConfig, DepositConfig, GenerateDepositAdd
3
3
  export * from '@privy-io/js-sdk-core';
4
4
  export { DepositAddressOrder, DepositAddressPollingResult, DepositAddressQuote, DepositConfig, GenerateDepositAddressInput, GetDepositInput, WaitForCompletionInput, WaitForDepositInput } from '@privy-io/js-sdk-core';
5
5
  import React from 'react';
6
- import { E as ErrorCallback, A as AuthLinkSuccessCallback, G as GenerateSiweMessage, S as SiweFlowState, a as AuthSuccessCallback, O as OtpLinkHookOptions, b as OtpLinkHookResult, c as OtpLoginHookOptions, d as OtpLoginHookResult, F as FarcasterFlowState, L as LinkFarcasterInput, e as SubmitFarcasterOptions, f as LoginWithFarcasterInput, g as EmbeddedWalletState, h as EmbeddedSolanaWalletState, i as OtpFlowState, j as OAuthFlowState, W as WalletRecoveryCallbacks, k as SolanaWalletRecoveryCallbacks, R as RecoveryFlowState, P as PasskeyFlowState } from './predicates-f4e23818.js';
7
- export { Y as CreateEthereumEmbeddedWalletOpts, X as CreateOrRecoverEmbeddedWalletProps, _ as CreateSolanaEmbeddedWalletOpts, a1 as CustomAuthFlowState, a5 as EmbeddedSolanaWalletActions, a6 as EmbeddedSolanaWalletStatus, p as EmbeddedWallet, a3 as EmbeddedWalletActions, a4 as EmbeddedWalletStatus, n as LinkedAccountWithMetadata, a2 as MfaConfig, M as PrivyAppleOauthAccount, s as PrivyBitcoinSegwitEmbeddedWalletAccount, t as PrivyBitcoinTaprootEmbeddedWalletAccount, V as PrivyCrossAppWalletAccount, N as PrivyCustomJwtAccount, C as PrivyDiscordOauthAccount, v as PrivyEmailAccount, o as PrivyEmbeddedWalletAccount, x as PrivyEthereumAccount, q as PrivyEthereumEmbeddedWalletAccount, Q as PrivyFarcasterAccount, D as PrivyGithubOauthAccount, z as PrivyGoogleOauthAccount, I as PrivyInstagramOauthAccount, m as PrivyLinkedAccount, K as PrivyLinkedInOauthAccount, T as PrivyPasskeyAccount, w as PrivyPhoneAccount, u as PrivySmartWalletAccount, y as PrivySolanaAccount, r as PrivySolanaEmbeddedWalletAccount, H as PrivySpotifyOauthAccount, U as PrivyTelegramAccount, J as PrivyTiktokOauthAccount, B as PrivyTwitterOauthAccount, l as PrivyUser, Z as RecoverEthereumEmbeddedWalletOpts, $ as RecoverSolanaEmbeddedWalletOpts, a0 as SetRecoveryProps, ad as hasError, a7 as isConnected, a9 as isConnecting, ac as isCreating, aa as isDisconnected, ab as isNotCreated, a8 as isReconnecting, ae as needsRecovery } from './predicates-f4e23818.js';
6
+ import { E as ErrorCallback, A as AuthLinkSuccessCallback, G as GenerateSiweMessage, S as SiweFlowState, a as AuthSuccessCallback, O as OtpLinkHookOptions, b as OtpLinkHookResult, c as OtpLoginHookOptions, d as OtpLoginHookResult, F as FarcasterFlowState, L as LinkFarcasterInput, e as SubmitFarcasterOptions, f as LoginWithFarcasterInput, g as EmbeddedWalletState, P as PublicKeyCredentialRequestOptionsJSON, h as EmbeddedSolanaWalletState, i as OtpFlowState, j as OAuthFlowState, W as WalletRecoveryCallbacks, k as SolanaWalletRecoveryCallbacks, R as RecoveryFlowState, l as PasskeyFlowState } from './types-c7f9a1e4.js';
7
+ export { Z as CreateEthereumEmbeddedWalletOpts, Y as CreateOrRecoverEmbeddedWalletProps, $ as CreateSolanaEmbeddedWalletOpts, a2 as CustomAuthFlowState, a6 as EmbeddedSolanaWalletActions, a7 as EmbeddedSolanaWalletStatus, q as EmbeddedWallet, a4 as EmbeddedWalletActions, a5 as EmbeddedWalletStatus, o as LinkedAccountWithMetadata, a3 as MfaConfig, N as PrivyAppleOauthAccount, t as PrivyBitcoinSegwitEmbeddedWalletAccount, u as PrivyBitcoinTaprootEmbeddedWalletAccount, X as PrivyCrossAppWalletAccount, Q as PrivyCustomJwtAccount, D as PrivyDiscordOauthAccount, w as PrivyEmailAccount, p as PrivyEmbeddedWalletAccount, y as PrivyEthereumAccount, r as PrivyEthereumEmbeddedWalletAccount, T as PrivyFarcasterAccount, H as PrivyGithubOauthAccount, B as PrivyGoogleOauthAccount, J as PrivyInstagramOauthAccount, n as PrivyLinkedAccount, M as PrivyLinkedInOauthAccount, U as PrivyPasskeyAccount, x as PrivyPhoneAccount, v as PrivySmartWalletAccount, z as PrivySolanaAccount, s as PrivySolanaEmbeddedWalletAccount, I as PrivySpotifyOauthAccount, V as PrivyTelegramAccount, K as PrivyTiktokOauthAccount, C as PrivyTwitterOauthAccount, m as PrivyUser, _ as RecoverEthereumEmbeddedWalletOpts, a0 as RecoverSolanaEmbeddedWalletOpts, a1 as SetRecoveryProps, ae as hasError, a8 as isConnected, aa as isConnecting, ad as isCreating, ab as isDisconnected, ac as isNotCreated, a9 as isReconnecting, af as needsRecovery } from './types-c7f9a1e4.js';
8
8
  import * as _privy_io_api_types from '@privy-io/api-types';
9
9
  import { User, AuthenticatedUser } from '@privy-io/api-types';
10
10
  export { LinkedAccount, LinkedAccountBitcoinSegwitEmbeddedWallet, LinkedAccountBitcoinTaprootEmbeddedWallet, LinkedAccountEmbeddedWallet, LinkedAccountEthereumEmbeddedWallet, LinkedAccountSmartWallet, LinkedAccountSolanaEmbeddedWallet, User } from '@privy-io/api-types';
11
11
  import { TypedDataDefinition, SignedAuthorization } from 'viem';
12
- import { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/types';
13
12
  import { EncryptedAuthorizationKeyResponse } from '@privy-io/routes';
14
13
  import { AppleAuthenticationCredential } from 'expo-apple-authentication';
15
14
 
@@ -869,39 +868,32 @@ interface UseMfa {
869
868
  * @example
870
869
  * // MFA flow
871
870
  *
872
- * const MFAModal = ({ mfaMethods, isOpen, setIsOpen }: Props) => {
871
+ * const MFAScreen = ({ mfaMethods }: Props) => {
873
872
  * const {init, submit, cancel} = useMfa();
874
- * const [selectedMethod, setSelectedMethod] = useState(null)
873
+ * const [selectedMethod, setSelectedMethod] = useState<MfaMethod | null>(null)
875
874
  * const [mfaCode, setMfaCode] = useState('')
876
875
  *
877
- * const handleClose = () => {
878
- * cancel();
879
- * setIsOpen(false);
880
- * };
881
- *
882
876
  * return (
883
- * <Modal isOpen={isOpen} onClose={handleClose}>
884
- * // Capture the user's MFA code
877
+ * <View>
885
878
  * {selectedMethod && (
886
- * <button
887
- * onClick={async () => {
888
- * await submit({mfaMethod: selectedMethod, mfaCode})
879
+ * <Pressable
880
+ * onPress={async () => {
881
+ * await submit({method: selectedMethod, mfaCode})
889
882
  * setSelectedMethod(null)
890
- * setIsOpen(false)
891
883
  * }}
892
884
  * />
893
885
  * )}
894
- * {mfaMethods.map((mfaMethod) => (
895
- * <button
896
- * onClick={async () => {
897
- * await init({mfaMethod});
898
- * setSelectedMethod(mfaMethod)
886
+ * {mfaMethods.map((method) => (
887
+ * <Pressable
888
+ * onPress={async () => {
889
+ * await init({method});
890
+ * setSelectedMethod(method)
899
891
  * }}
900
892
  * >
901
- * Choose {mfaMethod} for MFA
902
- * </button>
893
+ * <Text>Choose {method} for MFA</Text>
894
+ * </Pressable>
903
895
  * ))}
904
- * </Modal>
896
+ * </View>
905
897
  * )
906
898
  * };
907
899
  *
@@ -911,30 +903,31 @@ interface UseMfa {
911
903
  * import {
912
904
  * errorIndicatesMfaVerificationFailed,
913
905
  * errorIndicatesMfaTimeout,
914
- * errorIndicatesMfaMaxAttempts
906
+ * errorIndicatesMaxMfaRetries
915
907
  * } from '@privy-io/expo';
916
908
  * const {submit} = useMfa();
917
909
  * const [errorState, setErrorState] = useState<string | null>(null);
918
910
  *
919
- * <button
920
- * onClick={async () => {
911
+ * <Pressable
912
+ * onPress={async () => {
921
913
  * try {
922
- * submit('sms', '<user-mfa-code>');
914
+ * await submit({method: 'sms', mfaCode: '<user-mfa-code>'});
923
915
  * }
924
916
  * catch (e) {
925
917
  * if (errorIndicatesMfaVerificationFailed(e)) {
926
918
  * setErrorState('Verification failed, resubmit.')
927
919
  * }
928
- * else if (errorIndicatesMfaMaxAttempts(e)) {
920
+ * else if (errorIndicatesMaxMfaRetries(e)) {
929
921
  * setErrorState('Max attempts reached, re-initialize MFA.')
930
922
  * }
931
923
  * else if (errorIndicatesMfaTimeout(e)) {
932
924
  * setErrorState('Timeout reached, re-initialize MFA.')
933
925
  * }
926
+ * }
934
927
  * }}
935
928
  * >
936
- * {errorState ?? 'Verify SMS MFA Code'}
937
- * </button>
929
+ * <Text>{errorState ?? 'Verify SMS MFA Code'}</Text>
930
+ * </Pressable>
938
931
  *
939
932
  */
940
933
  declare function useMfa(): UseMfa;
@@ -1276,6 +1269,13 @@ interface UsePrivy {
1276
1269
  * @returns the access token, or `null`
1277
1270
  */
1278
1271
  getAccessToken: () => Promise<string | null>;
1272
+ /**
1273
+ * Refreshes the logged in user's data and identity token without rotating the
1274
+ * session or refresh token, unlike a full session refresh.
1275
+ */
1276
+ refreshUser: () => Promise<{
1277
+ user: User;
1278
+ }>;
1279
1279
  }
1280
1280
  /**
1281
1281
  * Hook that exposes the core state of the Privy SDK, including the current
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var _chunkAIWROSB2js = require('./chunk-AIWROSB2.js');var _chunkM5LUTEL3js = require('./chunk-M5LUTEL3.js');var _chunkK5SPDXVFjs = require('./chunk-K5SPDXVF.js');var _jssdkcore = require('@privy-io/js-sdk-core'); _createStarExport(_jssdkcore);var _react = require('react'); var _react2 = _interopRequireDefault(_react);var Bt=({loading:t,error:e,unauthenticated:o,children:i})=>{let{isReady:u,error:p}=_chunkM5LUTEL3js.Z.call(void 0, ),d=_chunkM5LUTEL3js.e.call(void 0, );if(!u)return _react2.default.createElement(_react2.default.Fragment,null,t);if(p&&e){let n=typeof e=="function"?e(p):e;return _react2.default.createElement(_react2.default.Fragment,null,n)}return d?_react2.default.createElement(_react2.default.Fragment,null,i):_react2.default.createElement(_react2.default.Fragment,null,o)};function T(t){return _chunkAIWROSB2js.a.call(void 0, t)}function F(t){let{state:e,start:o}=_chunkAIWROSB2js.a.call(void 0, _chunkK5SPDXVFjs.c.call(void 0, _chunkK5SPDXVFjs.b.call(void 0, {},t),{action:"link"}));return{state:e,link:o}}var H=t=>{let{client:e}=_react.useContext.call(void 0, _chunkM5LUTEL3js.fa),o=_react.useRef.call(void 0, t);return _react.useEffect.call(void 0, ()=>{o.current=t},[t]),{unlinkOAuth:_react.useCallback.call(void 0, d=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[d],function*({provider:u,subject:p}){var n,a,s,c;try{let{user:h}=yield e.auth.oauth.unlink(u,p);return(a=(n=o.current)==null?void 0:n.onSuccess)==null||a.call(n,h),h}catch(h){let m=_chunkM5LUTEL3js.g.call(void 0, h);throw(c=(s=o.current)==null?void 0:s.onError)==null||c.call(s,m),m}}),[e.auth.oauth])}};var b=t=>{let{client:e}=_react.useContext.call(void 0, _chunkM5LUTEL3js.fa),o=_react.useRef.call(void 0, t.onOAuthTokenGrant);o.current=t.onOAuthTokenGrant,_react.useEffect.call(void 0, ()=>{let{unsubscribe:i}=e.addOAuthTokensListener(u=>{o.current(u)});return i},[e])};exports.AuthBoundary = Bt; exports.PrivyContext = _chunkM5LUTEL3js.fa; exports.PrivyProvider = _chunkM5LUTEL3js.ha; exports.SecureStorageAdapter = _chunkK5SPDXVFjs.h; exports.createPrivyClient = _chunkM5LUTEL3js.i; exports.getAccessToken = _chunkM5LUTEL3js.ga; exports.hasError = _chunkQSWCX5XIjs.g; exports.isConnected = _chunkQSWCX5XIjs.a; exports.isConnecting = _chunkQSWCX5XIjs.c; exports.isCreating = _chunkQSWCX5XIjs.f; exports.isDisconnected = _chunkQSWCX5XIjs.d; exports.isNotCreated = _chunkQSWCX5XIjs.e; exports.isReconnecting = _chunkQSWCX5XIjs.b; exports.needsRecovery = _chunkQSWCX5XIjs.h; exports.useAcceptTerms = _chunkM5LUTEL3js._; exports.useAuthorizationSignature = _chunkM5LUTEL3js.$; exports.useCreateGuestAccount = _chunkM5LUTEL3js.O; exports.useDepositAddress = _chunkM5LUTEL3js.z; exports.useEmbeddedBitcoinWallet = _chunkM5LUTEL3js.Y; exports.useEmbeddedEthereumWallet = _chunkM5LUTEL3js.W; exports.useEmbeddedSolanaWallet = _chunkM5LUTEL3js.X; exports.useEmbeddedWallet = _chunkM5LUTEL3js.L; exports.useEmbeddedWalletStateChange = _chunkM5LUTEL3js.M; exports.useGetEncryptedAuthorizationKey = _chunkM5LUTEL3js.aa; exports.useHeadlessDelegatedActions = _chunkM5LUTEL3js.y; exports.useIdentityToken = _chunkM5LUTEL3js.N; exports.useLinkEmail = _chunkM5LUTEL3js.p; exports.useLinkSMS = _chunkM5LUTEL3js.s; exports.useLinkWithCrossApp = _chunkM5LUTEL3js.F; exports.useLinkWithFarcaster = _chunkM5LUTEL3js.u; exports.useLinkWithOAuth = F; exports.useLinkWithSiwe = _chunkM5LUTEL3js.j; exports.useLinkWithSiws = _chunkM5LUTEL3js.m; exports.useLoginWithCrossApp = _chunkM5LUTEL3js.E; exports.useLoginWithEmail = _chunkM5LUTEL3js.r; exports.useLoginWithFarcaster = _chunkM5LUTEL3js.w; exports.useLoginWithFarcasterV2 = _chunkM5LUTEL3js.x; exports.useLoginWithOAuth = _chunkAIWROSB2js.b; exports.useLoginWithSMS = _chunkM5LUTEL3js.t; exports.useLoginWithSiwe = _chunkM5LUTEL3js.k; exports.useLoginWithSiws = _chunkM5LUTEL3js.n; exports.useMfa = _chunkM5LUTEL3js.T; exports.useMfaEnrollment = _chunkM5LUTEL3js.U; exports.useMigrateWallets = _chunkM5LUTEL3js.ea; exports.useOAuthFlow = T; exports.useOAuthTokens = b; exports.useOnNeedsRecovery = _chunkM5LUTEL3js.f; exports.usePrivy = _chunkM5LUTEL3js.Z; exports.usePrivyClient = _chunkM5LUTEL3js.l; exports.useRecoverEmbeddedWallet = _chunkM5LUTEL3js.K; exports.useRegisterMfaListener = _chunkM5LUTEL3js.P; exports.useSendTransactionWithCrossApp = _chunkM5LUTEL3js.I; exports.useSessionSigners = _chunkM5LUTEL3js.A; exports.useSetEmbeddedWalletRecovery = _chunkM5LUTEL3js.J; exports.useSign7702Authorization = _chunkM5LUTEL3js.ba; exports.useSignMessageWithCrossApp = _chunkM5LUTEL3js.G; exports.useSignTypedDataWithCrossApp = _chunkM5LUTEL3js.H; exports.useSigners = _chunkM5LUTEL3js.B; exports.useStoredUsers = _chunkM5LUTEL3js.ca; exports.useSwitchUser = _chunkM5LUTEL3js.da; exports.useUnlinkEmail = _chunkM5LUTEL3js.q; exports.useUnlinkFarcaster = _chunkM5LUTEL3js.v; exports.useUnlinkOAuth = H; exports.useUnlinkPasskey = _chunkM5LUTEL3js.V; exports.useUnlinkWallet = _chunkM5LUTEL3js.o; exports.useUpdateEmail = _chunkM5LUTEL3js.C; exports.useUpdatePhone = _chunkM5LUTEL3js.D;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var _chunk6RKEORJLjs = require('./chunk-6RKEORJL.js');var _chunk77II74GHjs = require('./chunk-77II74GH.js');var _chunkK5SPDXVFjs = require('./chunk-K5SPDXVF.js');var _jssdkcore = require('@privy-io/js-sdk-core'); _createStarExport(_jssdkcore);var _react = require('react'); var _react2 = _interopRequireDefault(_react);var Bt=({loading:t,error:e,unauthenticated:o,children:i})=>{let{isReady:u,error:p}=_chunk77II74GHjs.Z.call(void 0, ),d=_chunk77II74GHjs.e.call(void 0, );if(!u)return _react2.default.createElement(_react2.default.Fragment,null,t);if(p&&e){let n=typeof e=="function"?e(p):e;return _react2.default.createElement(_react2.default.Fragment,null,n)}return d?_react2.default.createElement(_react2.default.Fragment,null,i):_react2.default.createElement(_react2.default.Fragment,null,o)};function T(t){return _chunk6RKEORJLjs.a.call(void 0, t)}function F(t){let{state:e,start:o}=_chunk6RKEORJLjs.a.call(void 0, _chunkK5SPDXVFjs.c.call(void 0, _chunkK5SPDXVFjs.b.call(void 0, {},t),{action:"link"}));return{state:e,link:o}}var H=t=>{let{client:e}=_react.useContext.call(void 0, _chunk77II74GHjs.fa),o=_react.useRef.call(void 0, t);return _react.useEffect.call(void 0, ()=>{o.current=t},[t]),{unlinkOAuth:_react.useCallback.call(void 0, d=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[d],function*({provider:u,subject:p}){var n,a,s,c;try{let{user:h}=yield e.auth.oauth.unlink(u,p);return(a=(n=o.current)==null?void 0:n.onSuccess)==null||a.call(n,h),h}catch(h){let m=_chunk77II74GHjs.g.call(void 0, h);throw(c=(s=o.current)==null?void 0:s.onError)==null||c.call(s,m),m}}),[e.auth.oauth])}};var b=t=>{let{client:e}=_react.useContext.call(void 0, _chunk77II74GHjs.fa),o=_react.useRef.call(void 0, t.onOAuthTokenGrant);o.current=t.onOAuthTokenGrant,_react.useEffect.call(void 0, ()=>{let{unsubscribe:i}=e.addOAuthTokensListener(u=>{o.current(u)});return i},[e])};exports.AuthBoundary = Bt; exports.PrivyContext = _chunk77II74GHjs.fa; exports.PrivyProvider = _chunk77II74GHjs.ha; exports.SecureStorageAdapter = _chunkK5SPDXVFjs.h; exports.createPrivyClient = _chunk77II74GHjs.i; exports.getAccessToken = _chunk77II74GHjs.ga; exports.hasError = _chunkQSWCX5XIjs.g; exports.isConnected = _chunkQSWCX5XIjs.a; exports.isConnecting = _chunkQSWCX5XIjs.c; exports.isCreating = _chunkQSWCX5XIjs.f; exports.isDisconnected = _chunkQSWCX5XIjs.d; exports.isNotCreated = _chunkQSWCX5XIjs.e; exports.isReconnecting = _chunkQSWCX5XIjs.b; exports.needsRecovery = _chunkQSWCX5XIjs.h; exports.useAcceptTerms = _chunk77II74GHjs._; exports.useAuthorizationSignature = _chunk77II74GHjs.$; exports.useCreateGuestAccount = _chunk77II74GHjs.O; exports.useDepositAddress = _chunk77II74GHjs.z; exports.useEmbeddedBitcoinWallet = _chunk77II74GHjs.Y; exports.useEmbeddedEthereumWallet = _chunk77II74GHjs.W; exports.useEmbeddedSolanaWallet = _chunk77II74GHjs.X; exports.useEmbeddedWallet = _chunk77II74GHjs.L; exports.useEmbeddedWalletStateChange = _chunk77II74GHjs.M; exports.useGetEncryptedAuthorizationKey = _chunk77II74GHjs.aa; exports.useHeadlessDelegatedActions = _chunk77II74GHjs.y; exports.useIdentityToken = _chunk77II74GHjs.N; exports.useLinkEmail = _chunk77II74GHjs.p; exports.useLinkSMS = _chunk77II74GHjs.s; exports.useLinkWithCrossApp = _chunk77II74GHjs.F; exports.useLinkWithFarcaster = _chunk77II74GHjs.u; exports.useLinkWithOAuth = F; exports.useLinkWithSiwe = _chunk77II74GHjs.j; exports.useLinkWithSiws = _chunk77II74GHjs.m; exports.useLoginWithCrossApp = _chunk77II74GHjs.E; exports.useLoginWithEmail = _chunk77II74GHjs.r; exports.useLoginWithFarcaster = _chunk77II74GHjs.w; exports.useLoginWithFarcasterV2 = _chunk77II74GHjs.x; exports.useLoginWithOAuth = _chunk6RKEORJLjs.b; exports.useLoginWithSMS = _chunk77II74GHjs.t; exports.useLoginWithSiwe = _chunk77II74GHjs.k; exports.useLoginWithSiws = _chunk77II74GHjs.n; exports.useMfa = _chunk77II74GHjs.T; exports.useMfaEnrollment = _chunk77II74GHjs.U; exports.useMigrateWallets = _chunk77II74GHjs.ea; exports.useOAuthFlow = T; exports.useOAuthTokens = b; exports.useOnNeedsRecovery = _chunk77II74GHjs.f; exports.usePrivy = _chunk77II74GHjs.Z; exports.usePrivyClient = _chunk77II74GHjs.l; exports.useRecoverEmbeddedWallet = _chunk77II74GHjs.K; exports.useRegisterMfaListener = _chunk77II74GHjs.P; exports.useSendTransactionWithCrossApp = _chunk77II74GHjs.I; exports.useSessionSigners = _chunk77II74GHjs.A; exports.useSetEmbeddedWalletRecovery = _chunk77II74GHjs.J; exports.useSign7702Authorization = _chunk77II74GHjs.ba; exports.useSignMessageWithCrossApp = _chunk77II74GHjs.G; exports.useSignTypedDataWithCrossApp = _chunk77II74GHjs.H; exports.useSigners = _chunk77II74GHjs.B; exports.useStoredUsers = _chunk77II74GHjs.ca; exports.useSwitchUser = _chunk77II74GHjs.da; exports.useUnlinkEmail = _chunk77II74GHjs.q; exports.useUnlinkFarcaster = _chunk77II74GHjs.v; exports.useUnlinkOAuth = H; exports.useUnlinkPasskey = _chunk77II74GHjs.V; exports.useUnlinkWallet = _chunk77II74GHjs.o; exports.useUpdateEmail = _chunk77II74GHjs.C; exports.useUpdatePhone = _chunk77II74GHjs.D;
package/dist/passkey.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { af as PasskeyLinkHookOptions, ag as PasskeyHookResult, ah as PasskeyLoginHookOptions, ai as SubmitPasskeyInput, P as PasskeyFlowState, E as ErrorCallback, a as AuthSuccessCallback } from './predicates-f4e23818.js';
2
- export { Y as CreateEthereumEmbeddedWalletOpts, X as CreateOrRecoverEmbeddedWalletProps, _ as CreateSolanaEmbeddedWalletOpts, a1 as CustomAuthFlowState, a5 as EmbeddedSolanaWalletActions, h as EmbeddedSolanaWalletState, a6 as EmbeddedSolanaWalletStatus, p as EmbeddedWallet, a3 as EmbeddedWalletActions, g as EmbeddedWalletState, a4 as EmbeddedWalletStatus, n as LinkedAccountWithMetadata, a2 as MfaConfig, j as OAuthFlowState, M as PrivyAppleOauthAccount, s as PrivyBitcoinSegwitEmbeddedWalletAccount, t as PrivyBitcoinTaprootEmbeddedWalletAccount, V as PrivyCrossAppWalletAccount, N as PrivyCustomJwtAccount, C as PrivyDiscordOauthAccount, v as PrivyEmailAccount, o as PrivyEmbeddedWalletAccount, x as PrivyEthereumAccount, q as PrivyEthereumEmbeddedWalletAccount, Q as PrivyFarcasterAccount, D as PrivyGithubOauthAccount, z as PrivyGoogleOauthAccount, I as PrivyInstagramOauthAccount, m as PrivyLinkedAccount, K as PrivyLinkedInOauthAccount, T as PrivyPasskeyAccount, w as PrivyPhoneAccount, u as PrivySmartWalletAccount, y as PrivySolanaAccount, r as PrivySolanaEmbeddedWalletAccount, H as PrivySpotifyOauthAccount, U as PrivyTelegramAccount, J as PrivyTiktokOauthAccount, B as PrivyTwitterOauthAccount, l as PrivyUser, Z as RecoverEthereumEmbeddedWalletOpts, $ as RecoverSolanaEmbeddedWalletOpts, R as RecoveryFlowState, a0 as SetRecoveryProps, ad as hasError, a7 as isConnected, a9 as isConnecting, ac as isCreating, aa as isDisconnected, ab as isNotCreated, a8 as isReconnecting, ae as needsRecovery } from './predicates-f4e23818.js';
1
+ import { ag as PasskeyLinkHookOptions, ah as PasskeyHookResult, ai as PasskeyLoginHookOptions, aj as SubmitPasskeyInput, l as PasskeyFlowState, E as ErrorCallback, a as AuthSuccessCallback } from './types-c7f9a1e4.js';
2
+ export { Z as CreateEthereumEmbeddedWalletOpts, Y as CreateOrRecoverEmbeddedWalletProps, $ as CreateSolanaEmbeddedWalletOpts, a2 as CustomAuthFlowState, a6 as EmbeddedSolanaWalletActions, h as EmbeddedSolanaWalletState, a7 as EmbeddedSolanaWalletStatus, q as EmbeddedWallet, a4 as EmbeddedWalletActions, g as EmbeddedWalletState, a5 as EmbeddedWalletStatus, o as LinkedAccountWithMetadata, a3 as MfaConfig, j as OAuthFlowState, N as PrivyAppleOauthAccount, t as PrivyBitcoinSegwitEmbeddedWalletAccount, u as PrivyBitcoinTaprootEmbeddedWalletAccount, X as PrivyCrossAppWalletAccount, Q as PrivyCustomJwtAccount, D as PrivyDiscordOauthAccount, w as PrivyEmailAccount, p as PrivyEmbeddedWalletAccount, y as PrivyEthereumAccount, r as PrivyEthereumEmbeddedWalletAccount, T as PrivyFarcasterAccount, H as PrivyGithubOauthAccount, B as PrivyGoogleOauthAccount, J as PrivyInstagramOauthAccount, n as PrivyLinkedAccount, M as PrivyLinkedInOauthAccount, U as PrivyPasskeyAccount, x as PrivyPhoneAccount, v as PrivySmartWalletAccount, z as PrivySolanaAccount, s as PrivySolanaEmbeddedWalletAccount, I as PrivySpotifyOauthAccount, V as PrivyTelegramAccount, K as PrivyTiktokOauthAccount, C as PrivyTwitterOauthAccount, m as PrivyUser, P as PublicKeyCredentialRequestOptionsJSON, _ as RecoverEthereumEmbeddedWalletOpts, a0 as RecoverSolanaEmbeddedWalletOpts, R as RecoveryFlowState, a1 as SetRecoveryProps, ae as hasError, a8 as isConnected, aa as isConnecting, ad as isCreating, ab as isDisconnected, ac as isNotCreated, a9 as isReconnecting, af as needsRecovery } from './types-c7f9a1e4.js';
3
3
  import { User } from '@privy-io/api-types';
4
4
  export { LinkedAccount, LinkedAccountBitcoinSegwitEmbeddedWallet, LinkedAccountBitcoinTaprootEmbeddedWallet, LinkedAccountEmbeddedWallet, LinkedAccountEthereumEmbeddedWallet, LinkedAccountSmartWallet, LinkedAccountSolanaEmbeddedWallet, User } from '@privy-io/api-types';
5
5
  import '@privy-io/js-sdk-core';
package/dist/passkey.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var _chunkM5LUTEL3js = require('./chunk-M5LUTEL3.js');var _chunkK5SPDXVFjs = require('./chunk-K5SPDXVF.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var X=e=>{let{client:n,passkeyState:h,setPasskeyState:s}=_react.useContext.call(void 0, _chunkM5LUTEL3js.fa),c=_react.useCallback.call(void 0, o=>{var r;let a=_chunkM5LUTEL3js.g.call(void 0, o);return s({status:"error",error:a}),(r=e==null?void 0:e.onError)==null||r.call(e,a),a},[e==null?void 0:e.onError]);return{linkWithPasskey:_react.useCallback.call(void 0, a=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[a],function*({relyingParty:o}){var r;try{if(!_chunkM5LUTEL3js.b.call(void 0, ))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_passkey_before_logged_in",error:"Must be logged in to link a passkey."});s({status:"generating-challenege"});let{options:u}=yield n.auth.passkey.generateRegistrationOptions(o);s({status:"awaiting-passkey"});let k=yield _chunkM5LUTEL3js.Q.call(void 0, _chunkM5LUTEL3js.S.call(void 0, u));s({status:"submitting-response"});let{user:y}=yield n.auth.passkey.linkWithPasskey(k,o);return s({status:"done"}),(r=e==null?void 0:e.onSuccess)==null||r.call(e,y),y}catch(t){throw c(t)}}),[n,c,e==null?void 0:e.onSuccess]),state:h}};var ne=e=>{let{client:n,passkeyState:h,setPasskeyState:s}=_react.useContext.call(void 0, _chunkM5LUTEL3js.fa),c=_react.useCallback.call(void 0, o=>{var r;let a=_chunkM5LUTEL3js.g.call(void 0, o);return s({status:"error",error:a}),(r=e==null?void 0:e.onError)==null||r.call(e,a),a},[e==null?void 0:e.onError]);return{loginWithPasskey:_react.useCallback.call(void 0, a=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[a],function*({relyingParty:o}){var r,t,u,k;try{if(_chunkM5LUTEL3js.b.call(void 0, ))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});s({status:"generating-challenege"});let{options:i}=yield n.auth.passkey.generateAuthenticationOptions(o);s({status:"awaiting-passkey"});let P=yield _chunkM5LUTEL3js.R.call(void 0, {challenge:i.challenge,rpId:i.rp_id,extensions:{appid:(r=i.extensions)==null?void 0:r.app_id,credProps:(t=i.extensions)==null?void 0:t.cred_props,hmacCreateSecret:(u=i.extensions)==null?void 0:u.hmac_create_secret},timeout:i.timeout,allowCredentials:i.allow_credentials,userVerification:i.user_verification});s({status:"submitting-response"});let w=_chunkM5LUTEL3js.a.call(void 0, ),_=yield n.auth.passkey.loginWithPasskey(P,i.challenge,o,{embedded:w==null?void 0:w.embedded});return s({status:"done"}),(k=e==null?void 0:e.onSuccess)==null||k.call(e,_.user,_.is_new_user),_.user}catch(y){throw c(y)}}),[n,c,e==null?void 0:e.onSuccess]),state:h}};var me=e=>{let{client:n,passkeyState:h,setPasskeyState:s}=_react.useContext.call(void 0, _chunkM5LUTEL3js.fa),c=_react.useRef.call(void 0, e);_react.useEffect.call(void 0, ()=>{c.current=e},[e]);let f=_react.useCallback.call(void 0, a=>{var t,u;let r=_chunkM5LUTEL3js.g.call(void 0, a);return s({status:"error",error:r}),(u=(t=c.current)==null?void 0:t.onError)==null||u.call(t,r),r},[s]);return{signupWithPasskey:_react.useCallback.call(void 0, r=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[r],function*({relyingParty:a}){var t,u;try{if(_chunkM5LUTEL3js.b.call(void 0, ))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});s({status:"generating-challenege"});let{options:y}=yield n.auth.passkey.generateSignupOptions(a);s({status:"awaiting-passkey"});let i=yield _chunkM5LUTEL3js.Q.call(void 0, _chunkM5LUTEL3js.S.call(void 0, y));s({status:"submitting-response"});let P=yield n.auth.passkey.signupWithPasskey(i,a);return s({status:"done"}),(u=(t=c.current)==null?void 0:t.onSuccess)==null||u.call(t,P.user,P.is_new_user),{user:P.user}}catch(k){throw f(k)}}),[n.auth.passkey,f,s]),state:h}};exports.hasError = _chunkQSWCX5XIjs.g; exports.isConnected = _chunkQSWCX5XIjs.a; exports.isConnecting = _chunkQSWCX5XIjs.c; exports.isCreating = _chunkQSWCX5XIjs.f; exports.isDisconnected = _chunkQSWCX5XIjs.d; exports.isNotCreated = _chunkQSWCX5XIjs.e; exports.isReconnecting = _chunkQSWCX5XIjs.b; exports.needsRecovery = _chunkQSWCX5XIjs.h; exports.useLinkWithPasskey = X; exports.useLoginWithPasskey = ne; exports.useSignupWithPasskey = me;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var _chunk77II74GHjs = require('./chunk-77II74GH.js');var _chunkK5SPDXVFjs = require('./chunk-K5SPDXVF.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var X=e=>{let{client:n,passkeyState:h,setPasskeyState:s}=_react.useContext.call(void 0, _chunk77II74GHjs.fa),c=_react.useCallback.call(void 0, o=>{var r;let a=_chunk77II74GHjs.g.call(void 0, o);return s({status:"error",error:a}),(r=e==null?void 0:e.onError)==null||r.call(e,a),a},[e==null?void 0:e.onError]);return{linkWithPasskey:_react.useCallback.call(void 0, a=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[a],function*({relyingParty:o}){var r;try{if(!_chunk77II74GHjs.b.call(void 0, ))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_passkey_before_logged_in",error:"Must be logged in to link a passkey."});s({status:"generating-challenege"});let{options:u}=yield n.auth.passkey.generateRegistrationOptions(o);s({status:"awaiting-passkey"});let k=yield _chunk77II74GHjs.Q.call(void 0, _chunk77II74GHjs.S.call(void 0, u));s({status:"submitting-response"});let{user:y}=yield n.auth.passkey.linkWithPasskey(k,o);return s({status:"done"}),(r=e==null?void 0:e.onSuccess)==null||r.call(e,y),y}catch(t){throw c(t)}}),[n,c,e==null?void 0:e.onSuccess]),state:h}};var ne=e=>{let{client:n,passkeyState:h,setPasskeyState:s}=_react.useContext.call(void 0, _chunk77II74GHjs.fa),c=_react.useCallback.call(void 0, o=>{var r;let a=_chunk77II74GHjs.g.call(void 0, o);return s({status:"error",error:a}),(r=e==null?void 0:e.onError)==null||r.call(e,a),a},[e==null?void 0:e.onError]);return{loginWithPasskey:_react.useCallback.call(void 0, a=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[a],function*({relyingParty:o}){var r,t,u,k;try{if(_chunk77II74GHjs.b.call(void 0, ))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});s({status:"generating-challenege"});let{options:i}=yield n.auth.passkey.generateAuthenticationOptions(o);s({status:"awaiting-passkey"});let P=yield _chunk77II74GHjs.R.call(void 0, {challenge:i.challenge,rpId:i.rp_id,extensions:{appid:(r=i.extensions)==null?void 0:r.app_id,credProps:(t=i.extensions)==null?void 0:t.cred_props,hmacCreateSecret:(u=i.extensions)==null?void 0:u.hmac_create_secret},timeout:i.timeout,allowCredentials:i.allow_credentials,userVerification:i.user_verification});s({status:"submitting-response"});let w=_chunk77II74GHjs.a.call(void 0, ),_=yield n.auth.passkey.loginWithPasskey(P,i.challenge,o,{embedded:w==null?void 0:w.embedded});return s({status:"done"}),(k=e==null?void 0:e.onSuccess)==null||k.call(e,_.user,_.is_new_user),_.user}catch(y){throw c(y)}}),[n,c,e==null?void 0:e.onSuccess]),state:h}};var me=e=>{let{client:n,passkeyState:h,setPasskeyState:s}=_react.useContext.call(void 0, _chunk77II74GHjs.fa),c=_react.useRef.call(void 0, e);_react.useEffect.call(void 0, ()=>{c.current=e},[e]);let f=_react.useCallback.call(void 0, a=>{var t,u;let r=_chunk77II74GHjs.g.call(void 0, a);return s({status:"error",error:r}),(u=(t=c.current)==null?void 0:t.onError)==null||u.call(t,r),r},[s]);return{signupWithPasskey:_react.useCallback.call(void 0, r=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[r],function*({relyingParty:a}){var t,u;try{if(_chunk77II74GHjs.b.call(void 0, ))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});s({status:"generating-challenege"});let{options:y}=yield n.auth.passkey.generateSignupOptions(a);s({status:"awaiting-passkey"});let i=yield _chunk77II74GHjs.Q.call(void 0, _chunk77II74GHjs.S.call(void 0, y));s({status:"submitting-response"});let P=yield n.auth.passkey.signupWithPasskey(i,a);return s({status:"done"}),(u=(t=c.current)==null?void 0:t.onSuccess)==null||u.call(t,P.user,P.is_new_user),{user:P.user}}catch(k){throw f(k)}}),[n.auth.passkey,f,s]),state:h}};exports.hasError = _chunkQSWCX5XIjs.g; exports.isConnected = _chunkQSWCX5XIjs.a; exports.isConnecting = _chunkQSWCX5XIjs.c; exports.isCreating = _chunkQSWCX5XIjs.f; exports.isDisconnected = _chunkQSWCX5XIjs.d; exports.isNotCreated = _chunkQSWCX5XIjs.e; exports.isReconnecting = _chunkQSWCX5XIjs.b; exports.needsRecovery = _chunkQSWCX5XIjs.h; exports.useLinkWithPasskey = X; exports.useLoginWithPasskey = ne; exports.useSignupWithPasskey = me;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var _chunkM5LUTEL3js = require('./chunk-M5LUTEL3.js');var _chunkK5SPDXVFjs = require('./chunk-K5SPDXVF.js');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jssdkcore = require('@privy-io/js-sdk-core');var _viem = require('viem');var _smartwallets = require('@privy-io/js-sdk-core/smart-wallets');var v=d=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[d],function*({chain:t,privyAppId:e,user:l,embeddedWallet:r,smartWalletsConfig:n,client:a}){if(!(n!=null&&n.enabled)||!r||!_chunkQSWCX5XIjs.a.call(void 0, r))return;let c=yield a.embeddedWallet.getProvider(r.account),i=n==null?void 0:n.configured_networks.find($=>$.chain_id===`eip155:${t.id}`);if(!i)throw new (0, _jssdkcore.PrivyClientError)({code:"chain_not_supported",error:`The chain ${t.name} (eip155:${t.id}) must be configured in the smart wallet configuration in your dashboard`});let s=_jssdkcore.getUserSmartWallet.call(void 0, l),o=s?s.smart_wallet_type:n.smart_wallet_type,y=s?s.smart_wallet_version:n.smart_wallet_version,O=_jssdkcore.getJsonRpcEndpointFromChain.call(void 0, t,{rpcUrls:[]},e),R=_viem.createPublicClient.call(void 0, {chain:t,transport:_viem.http.call(void 0, O)}),T=yield _smartwallets.signerToSmartAccountClient.call(void 0, {owner:c,smartWalletType:o,smartWalletVersion:y,chain:t,publicClient:R,paymasterContext:K(i.paymaster_url,i.paymaster_context),bundlerUrl:i.bundler_url,paymasterUrl:i.paymaster_url});if(!T)throw new (0, _jssdkcore.PrivyClientError)({code:"smart_wallet_client_error",error:`Failed to create smart wallet client for chain ${t.name} (eip155:${t.id})`});return T}),X=/paymaster\.biconomy\.io\/api/i;function j(t){return X.test(t)}var J={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}},K=(t,e)=>{if(t&&j(t))return J;if(e&&e.policy_id)return{policyId:e.policy_id}};var k=3,q=500,z= exports.SmartWalletsProvider =({children:t})=>_react2.default.createElement(Z,null,_react2.default.createElement(tt,null,_react2.default.createElement(et,null,t))),N=_react.createContext.call(void 0, {config:void 0}),E=()=>{let{config:t}=_react.useContext.call(void 0, N);return{config:t}},U=_react.createContext.call(void 0, {smartWalletClient:void 0}),H=()=>{let{smartWalletClient:t}=_react.useContext.call(void 0, U);return{smartWalletClient:t}},L=_react.createContext.call(void 0, {client:void 0}),Q= exports.useSmartWallets =()=>{let{client:t}=_react.useContext.call(void 0, L),e=rt();return{client:t,getClientForChain:e}},Z=({children:t})=>{let[e,l]=_react.useState.call(void 0, void 0),r=_chunkM5LUTEL3js.l.call(void 0, );return _react.useEffect.call(void 0, ()=>{!e&&r&&(()=>_chunkK5SPDXVFjs.e.call(void 0, void 0,null,function*(){try{if(!r){console.warn("No client found");return}let a=yield r.app.getSmartWalletConfig();l(a)}catch(a){console.warn("Error generating smart wallet config: ",a)}}))()},[r,e]),_react2.default.createElement(N.Provider,{value:{config:e}},t)},tt=({children:t})=>{let{config:e}=E(),{client:l,wallet:r}=_react.useContext.call(void 0, _chunkM5LUTEL3js.fa),n=_chunkM5LUTEL3js.d.call(void 0, ),[a,d]=_react.useState.call(void 0, );return _react.useEffect.call(void 0, ()=>{(()=>_chunkK5SPDXVFjs.e.call(void 0, void 0,null,function*(){if(!n&&a&&d(void 0),!(e!=null&&e.enabled)||!n||r.status!=="connected"||n&&a&&r.status==="connected")return;let i=l.embeddedWallet.chains.find(o=>e.configured_networks.map(y=>y.chain_id).includes(`eip155:${o.id}`));if(!i)throw new (0, _jssdkcore.PrivyClientError)({error:"Could not find smart wallets chain configurations for any Privy client configured chains. Please configure smart wallets for your chains in the Privy dashboard.",code:"chain_not_supported"});let s=yield v({chain:i,privyAppId:l.app.appId,user:n,embeddedWallet:r,smartWalletsConfig:e,client:l});if(!s)throw new (0, _jssdkcore.PrivyClientError)({error:"Could not create smart wallet client",code:"smart_wallet_client_error"});d(s)}))()},[!!(e!=null&&e.enabled),!!l,!!n,r.status]),_react2.default.createElement(U.Provider,{value:{smartWalletClient:a}},t)},et=({children:t})=>{let{client:e,wallet:l}=_react.useContext.call(void 0, _chunkM5LUTEL3js.fa),r=_chunkM5LUTEL3js.d.call(void 0, ),{smartWalletClient:n}=H(),{config:a}=E();return _react.useEffect.call(void 0, ()=>{let d=!1;return(()=>_chunkK5SPDXVFjs.e.call(void 0, void 0,null,function*(){var c;if(!(!n||!r||_jssdkcore.getUserSmartWallet.call(void 0, r)||!(a!=null&&a.enabled)||l.status!=="connected"))for(let i=0;i<k;i++){if(d||_jssdkcore.getUserSmartWallet.call(void 0, (c=_chunkM5LUTEL3js.b.call(void 0, ))!=null?c:r))return;let s=!1;for(let o=0;o<5;o++){if(d)return;if(yield e.embeddedWallet.ping(q)){s=!0;break}yield _chunkM5LUTEL3js.h.call(void 0, 200*_chunkK5SPDXVFjs.a.call(void 0, 2,o))}if(s)try{let{message:o}=yield e.auth.smartWallet.init({address:n.account.address,chainId:`eip155:${n.chain.id}`}),y=yield n.signMessage({message:o});yield e.auth.smartWallet.link(o,y,a.smart_wallet_type,a.smart_wallet_version);return}catch(o){i===k-1?console.error("Error creating smart wallet:",o):yield _chunkM5LUTEL3js.h.call(void 0, 500*_chunkK5SPDXVFjs.a.call(void 0, 2,i))}}}))(),()=>{d=!0}},[!!n,!!r,!!_jssdkcore.getUserSmartWallet.call(void 0, r),a,l.status]),_react2.default.createElement(L.Provider,{value:{client:_jssdkcore.getUserSmartWallet.call(void 0, r)?n:void 0}},t)},rt=()=>{let{client:t,wallet:e}=_react.useContext.call(void 0, _chunkM5LUTEL3js.fa),{config:l}=E();return _react.useCallback.call(void 0, n=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[n],function*({chainId:r}){let a=_chunkM5LUTEL3js.b.call(void 0, );if(!a)throw new (0, _jssdkcore.PrivyClientError)({error:"Must be logged in to get a smart wallet client",code:"smart_wallet_client_error"});if(!l||!l.enabled)throw new (0, _jssdkcore.PrivyClientError)({error:"Must have smart wallets enabled to get a smart wallet client",code:"smart_wallet_client_error"});let C=t.embeddedWallet.chains.find(i=>i.id===r);if(!C)throw new (0, _jssdkcore.PrivyClientError)({error:`Could not find chain with id: ${r}`,code:"chain_not_supported"});let c=yield v({chain:C,privyAppId:t.app.appId,user:a,embeddedWallet:e,smartWalletsConfig:l,client:t});if(!c)throw new (0, _jssdkcore.PrivyClientError)({error:`Could not create smart wallet client for chain ${r}`,code:"smart_wallet_client_error"});return c}),[l,e,t])};exports.SmartWalletsProvider = z; exports.useSmartWallets = Q;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var _chunk77II74GHjs = require('./chunk-77II74GH.js');var _chunkK5SPDXVFjs = require('./chunk-K5SPDXVF.js');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jssdkcore = require('@privy-io/js-sdk-core');var _viem = require('viem');var _smartwallets = require('@privy-io/js-sdk-core/smart-wallets');var v=d=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[d],function*({chain:t,privyAppId:e,user:l,embeddedWallet:r,smartWalletsConfig:n,client:a}){if(!(n!=null&&n.enabled)||!r||!_chunkQSWCX5XIjs.a.call(void 0, r))return;let c=yield a.embeddedWallet.getProvider(r.account),i=n==null?void 0:n.configured_networks.find($=>$.chain_id===`eip155:${t.id}`);if(!i)throw new (0, _jssdkcore.PrivyClientError)({code:"chain_not_supported",error:`The chain ${t.name} (eip155:${t.id}) must be configured in the smart wallet configuration in your dashboard`});let s=_jssdkcore.getUserSmartWallet.call(void 0, l),o=s?s.smart_wallet_type:n.smart_wallet_type,y=s?s.smart_wallet_version:n.smart_wallet_version,O=_jssdkcore.getJsonRpcEndpointFromChain.call(void 0, t,{rpcUrls:[]},e),R=_viem.createPublicClient.call(void 0, {chain:t,transport:_viem.http.call(void 0, O)}),T=yield _smartwallets.signerToSmartAccountClient.call(void 0, {owner:c,smartWalletType:o,smartWalletVersion:y,chain:t,publicClient:R,paymasterContext:K(i.paymaster_url,i.paymaster_context),bundlerUrl:i.bundler_url,paymasterUrl:i.paymaster_url});if(!T)throw new (0, _jssdkcore.PrivyClientError)({code:"smart_wallet_client_error",error:`Failed to create smart wallet client for chain ${t.name} (eip155:${t.id})`});return T}),X=/paymaster\.biconomy\.io\/api/i;function j(t){return X.test(t)}var J={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}},K=(t,e)=>{if(t&&j(t))return J;if(e&&e.policy_id)return{policyId:e.policy_id}};var k=3,q=500,z= exports.SmartWalletsProvider =({children:t})=>_react2.default.createElement(Z,null,_react2.default.createElement(tt,null,_react2.default.createElement(et,null,t))),N=_react.createContext.call(void 0, {config:void 0}),E=()=>{let{config:t}=_react.useContext.call(void 0, N);return{config:t}},U=_react.createContext.call(void 0, {smartWalletClient:void 0}),H=()=>{let{smartWalletClient:t}=_react.useContext.call(void 0, U);return{smartWalletClient:t}},L=_react.createContext.call(void 0, {client:void 0}),Q= exports.useSmartWallets =()=>{let{client:t}=_react.useContext.call(void 0, L),e=rt();return{client:t,getClientForChain:e}},Z=({children:t})=>{let[e,l]=_react.useState.call(void 0, void 0),r=_chunk77II74GHjs.l.call(void 0, );return _react.useEffect.call(void 0, ()=>{!e&&r&&(()=>_chunkK5SPDXVFjs.e.call(void 0, void 0,null,function*(){try{if(!r){console.warn("No client found");return}let a=yield r.app.getSmartWalletConfig();l(a)}catch(a){console.warn("Error generating smart wallet config: ",a)}}))()},[r,e]),_react2.default.createElement(N.Provider,{value:{config:e}},t)},tt=({children:t})=>{let{config:e}=E(),{client:l,wallet:r}=_react.useContext.call(void 0, _chunk77II74GHjs.fa),n=_chunk77II74GHjs.d.call(void 0, ),[a,d]=_react.useState.call(void 0, );return _react.useEffect.call(void 0, ()=>{(()=>_chunkK5SPDXVFjs.e.call(void 0, void 0,null,function*(){if(!n&&a&&d(void 0),!(e!=null&&e.enabled)||!n||r.status!=="connected"||n&&a&&r.status==="connected")return;let i=l.embeddedWallet.chains.find(o=>e.configured_networks.map(y=>y.chain_id).includes(`eip155:${o.id}`));if(!i)throw new (0, _jssdkcore.PrivyClientError)({error:"Could not find smart wallets chain configurations for any Privy client configured chains. Please configure smart wallets for your chains in the Privy dashboard.",code:"chain_not_supported"});let s=yield v({chain:i,privyAppId:l.app.appId,user:n,embeddedWallet:r,smartWalletsConfig:e,client:l});if(!s)throw new (0, _jssdkcore.PrivyClientError)({error:"Could not create smart wallet client",code:"smart_wallet_client_error"});d(s)}))()},[!!(e!=null&&e.enabled),!!l,!!n,r.status]),_react2.default.createElement(U.Provider,{value:{smartWalletClient:a}},t)},et=({children:t})=>{let{client:e,wallet:l}=_react.useContext.call(void 0, _chunk77II74GHjs.fa),r=_chunk77II74GHjs.d.call(void 0, ),{smartWalletClient:n}=H(),{config:a}=E();return _react.useEffect.call(void 0, ()=>{let d=!1;return(()=>_chunkK5SPDXVFjs.e.call(void 0, void 0,null,function*(){var c;if(!(!n||!r||_jssdkcore.getUserSmartWallet.call(void 0, r)||!(a!=null&&a.enabled)||l.status!=="connected"))for(let i=0;i<k;i++){if(d||_jssdkcore.getUserSmartWallet.call(void 0, (c=_chunk77II74GHjs.b.call(void 0, ))!=null?c:r))return;let s=!1;for(let o=0;o<5;o++){if(d)return;if(yield e.embeddedWallet.ping(q)){s=!0;break}yield _chunk77II74GHjs.h.call(void 0, 200*_chunkK5SPDXVFjs.a.call(void 0, 2,o))}if(s)try{let{message:o}=yield e.auth.smartWallet.init({address:n.account.address,chainId:`eip155:${n.chain.id}`}),y=yield n.signMessage({message:o});yield e.auth.smartWallet.link(o,y,a.smart_wallet_type,a.smart_wallet_version);return}catch(o){i===k-1?console.error("Error creating smart wallet:",o):yield _chunk77II74GHjs.h.call(void 0, 500*_chunkK5SPDXVFjs.a.call(void 0, 2,i))}}}))(),()=>{d=!0}},[!!n,!!r,!!_jssdkcore.getUserSmartWallet.call(void 0, r),a,l.status]),_react2.default.createElement(L.Provider,{value:{client:_jssdkcore.getUserSmartWallet.call(void 0, r)?n:void 0}},t)},rt=()=>{let{client:t,wallet:e}=_react.useContext.call(void 0, _chunk77II74GHjs.fa),{config:l}=E();return _react.useCallback.call(void 0, n=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[n],function*({chainId:r}){let a=_chunk77II74GHjs.b.call(void 0, );if(!a)throw new (0, _jssdkcore.PrivyClientError)({error:"Must be logged in to get a smart wallet client",code:"smart_wallet_client_error"});if(!l||!l.enabled)throw new (0, _jssdkcore.PrivyClientError)({error:"Must have smart wallets enabled to get a smart wallet client",code:"smart_wallet_client_error"});let C=t.embeddedWallet.chains.find(i=>i.id===r);if(!C)throw new (0, _jssdkcore.PrivyClientError)({error:`Could not find chain with id: ${r}`,code:"chain_not_supported"});let c=yield v({chain:C,privyAppId:t.app.appId,user:a,embeddedWallet:e,smartWalletsConfig:l,client:t});if(!c)throw new (0, _jssdkcore.PrivyClientError)({error:`Could not create smart wallet client for chain ${r}`,code:"smart_wallet_client_error"});return c}),[l,e,t])};exports.SmartWalletsProvider = z; exports.useSmartWallets = Q;
@@ -501,4 +501,30 @@ declare function hasError(s: EmbeddedSolanaWalletState): s is EmbeddedSolanaWall
501
501
  declare function needsRecovery(s: EmbeddedWalletState): s is EmbeddedWalletNeedsRecoveryState;
502
502
  declare function needsRecovery(s: EmbeddedSolanaWalletState): s is EmbeddedSolanaWalletNeedsRecoveryState;
503
503
 
504
- export { RecoverSolanaEmbeddedWalletOpts as $, AuthLinkSuccessCallback as A, PrivyTwitterOauthAccount as B, PrivyDiscordOauthAccount as C, PrivyGithubOauthAccount as D, ErrorCallback as E, FarcasterFlowState as F, GenerateSiweMessage as G, PrivySpotifyOauthAccount as H, PrivyInstagramOauthAccount as I, PrivyTiktokOauthAccount as J, PrivyLinkedInOauthAccount as K, LinkFarcasterInput as L, PrivyAppleOauthAccount as M, PrivyCustomJwtAccount as N, OtpLinkHookOptions as O, PasskeyFlowState as P, PrivyFarcasterAccount as Q, RecoveryFlowState as R, SiweFlowState as S, PrivyPasskeyAccount as T, PrivyTelegramAccount as U, PrivyCrossAppWalletAccount as V, WalletRecoveryCallbacks as W, CreateOrRecoverEmbeddedWalletProps as X, CreateEthereumEmbeddedWalletOpts as Y, RecoverEthereumEmbeddedWalletOpts as Z, CreateSolanaEmbeddedWalletOpts as _, AuthSuccessCallback as a, SetRecoveryProps as a0, CustomAuthFlowState as a1, MfaConfig as a2, EmbeddedWalletActions as a3, EmbeddedWalletStatus as a4, EmbeddedSolanaWalletActions as a5, EmbeddedSolanaWalletStatus as a6, isConnected as a7, isReconnecting as a8, isConnecting as a9, isDisconnected as aa, isNotCreated as ab, isCreating as ac, hasError as ad, needsRecovery as ae, PasskeyLinkHookOptions as af, PasskeyHookResult as ag, PasskeyLoginHookOptions as ah, SubmitPasskeyInput as ai, OtpLinkHookResult as b, OtpLoginHookOptions as c, OtpLoginHookResult as d, SubmitFarcasterOptions as e, LoginWithFarcasterInput as f, EmbeddedWalletState as g, EmbeddedSolanaWalletState as h, OtpFlowState as i, OAuthFlowState as j, SolanaWalletRecoveryCallbacks as k, PrivyUser as l, PrivyLinkedAccount as m, LinkedAccountWithMetadata as n, PrivyEmbeddedWalletAccount as o, EmbeddedWallet as p, PrivyEthereumEmbeddedWalletAccount as q, PrivySolanaEmbeddedWalletAccount as r, PrivyBitcoinSegwitEmbeddedWalletAccount as s, PrivyBitcoinTaprootEmbeddedWalletAccount as t, PrivySmartWalletAccount as u, PrivyEmailAccount as v, PrivyPhoneAccount as w, PrivyEthereumAccount as x, PrivySolanaAccount as y, PrivyGoogleOauthAccount as z };
504
+ /**
505
+ * Privy-owned WebAuthn type definitions for passkey MFA flows.
506
+ * Modeled after the W3C WebAuthn spec (Level 2) JSON serialization format.
507
+ * Defined locally so our public API surface is not coupled to 3p package versions.
508
+ */
509
+ type AuthenticatorTransport = 'ble' | 'cable' | 'hybrid' | 'internal' | 'nfc' | 'smart-card' | 'usb';
510
+ type UserVerificationRequirement = 'discouraged' | 'preferred' | 'required';
511
+ type PublicKeyCredentialDescriptorJSON = {
512
+ id: string;
513
+ type: 'public-key';
514
+ transports?: AuthenticatorTransport[];
515
+ };
516
+ type PublicKeyCredentialRequestOptionsJSON = {
517
+ challenge: string;
518
+ timeout?: number;
519
+ rpId?: string;
520
+ allowCredentials?: PublicKeyCredentialDescriptorJSON[];
521
+ userVerification?: UserVerificationRequirement;
522
+ extensions?: AuthenticationExtensionsClientInputsJSON;
523
+ };
524
+ type AuthenticationExtensionsClientInputsJSON = {
525
+ appid?: string;
526
+ credProps?: boolean;
527
+ hmacCreateSecret?: boolean;
528
+ };
529
+
530
+ export { CreateSolanaEmbeddedWalletOpts as $, AuthLinkSuccessCallback as A, PrivyGoogleOauthAccount as B, PrivyTwitterOauthAccount as C, PrivyDiscordOauthAccount as D, ErrorCallback as E, FarcasterFlowState as F, GenerateSiweMessage as G, PrivyGithubOauthAccount as H, PrivySpotifyOauthAccount as I, PrivyInstagramOauthAccount as J, PrivyTiktokOauthAccount as K, LinkFarcasterInput as L, PrivyLinkedInOauthAccount as M, PrivyAppleOauthAccount as N, OtpLinkHookOptions as O, PublicKeyCredentialRequestOptionsJSON as P, PrivyCustomJwtAccount as Q, RecoveryFlowState as R, SiweFlowState as S, PrivyFarcasterAccount as T, PrivyPasskeyAccount as U, PrivyTelegramAccount as V, WalletRecoveryCallbacks as W, PrivyCrossAppWalletAccount as X, CreateOrRecoverEmbeddedWalletProps as Y, CreateEthereumEmbeddedWalletOpts as Z, RecoverEthereumEmbeddedWalletOpts as _, AuthSuccessCallback as a, RecoverSolanaEmbeddedWalletOpts as a0, SetRecoveryProps as a1, CustomAuthFlowState as a2, MfaConfig as a3, EmbeddedWalletActions as a4, EmbeddedWalletStatus as a5, EmbeddedSolanaWalletActions as a6, EmbeddedSolanaWalletStatus as a7, isConnected as a8, isReconnecting as a9, isConnecting as aa, isDisconnected as ab, isNotCreated as ac, isCreating as ad, hasError as ae, needsRecovery as af, PasskeyLinkHookOptions as ag, PasskeyHookResult as ah, PasskeyLoginHookOptions as ai, SubmitPasskeyInput as aj, OtpLinkHookResult as b, OtpLoginHookOptions as c, OtpLoginHookResult as d, SubmitFarcasterOptions as e, LoginWithFarcasterInput as f, EmbeddedWalletState as g, EmbeddedSolanaWalletState as h, OtpFlowState as i, OAuthFlowState as j, SolanaWalletRecoveryCallbacks as k, PasskeyFlowState as l, PrivyUser as m, PrivyLinkedAccount as n, LinkedAccountWithMetadata as o, PrivyEmbeddedWalletAccount as p, EmbeddedWallet as q, PrivyEthereumEmbeddedWalletAccount as r, PrivySolanaEmbeddedWalletAccount as s, PrivyBitcoinSegwitEmbeddedWalletAccount as t, PrivyBitcoinTaprootEmbeddedWalletAccount as u, PrivySmartWalletAccount as v, PrivyEmailAccount as w, PrivyPhoneAccount as x, PrivyEthereumAccount as y, PrivySolanaAccount as z };
package/dist/ui.d.ts CHANGED
@@ -192,21 +192,28 @@ interface UseDelegatedActionsInterface {
192
192
  */
193
193
  declare const useDelegatedActions: () => UseDelegatedActionsInterface;
194
194
 
195
+ type MfaEnrollmentWelcomeAppearance = {
196
+ /** Heading text. Defaults to "Add more security". */
197
+ title?: string;
198
+ /** Subheading text. Defaults to "Set up multi-factor verification." */
199
+ subtitle?: string;
200
+ /** First bullet description. Defaults to "Enable multi-factor verification for your wallet." */
201
+ description?: string;
202
+ };
203
+
195
204
  interface UseMfaEnrollmentUIInterface {
196
- /**
197
- * Starts the MFA enrollment flow
198
- * @param mfaMethods
199
- * @param relyingParty
200
- */
205
+ /** Starts the MFA enrollment flow. */
201
206
  init: (params: {
202
207
  mfaMethods: MfaMethod[];
203
208
  relyingParty?: string;
209
+ appearance?: MfaEnrollmentWelcomeAppearance;
204
210
  }) => Promise<void>;
205
211
  }
206
212
  declare function useMfaEnrollmentUI(): {
207
213
  init: (params: {
208
214
  mfaMethods: MfaMethod[];
209
215
  relyingParty?: string;
216
+ appearance?: MfaEnrollmentWelcomeAppearance;
210
217
  }) => Promise<void>;
211
218
  };
212
219