@privy-io/expo 0.71.1 → 0.72.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 _chunkWGFYNBVPjs = require('./chunk-WGFYNBVP.js');var _chunkK5SPDXVFjs = require('./chunk-K5SPDXVF.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var f=()=>{let e=_chunkWGFYNBVPjs.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=_chunkWGFYNBVPjs.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=_chunkWGFYNBVPjs.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 _chunkHUHULZRXjs = require('./chunk-HUHULZRX.js');var _chunkK5SPDXVFjs = require('./chunk-K5SPDXVF.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var f=()=>{let e=_chunkHUHULZRXjs.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=_chunkHUHULZRXjs.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=_chunkHUHULZRXjs.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
@@ -1,12 +1,12 @@
1
1
  import * as Privy from '@privy-io/js-sdk-core';
2
- import Privy__default, { EmbeddedWalletConfig, DepositConfig, GenerateDepositAddressInput, DepositAddressQuote, GetDepositInput, DepositAddressOrder, WaitForDepositInput, DepositAddressPollingResult, WaitForCompletionInput, UnsignedTransactionRequest, OnNeedsRecovery, MfaMethod, PrivyEmbeddedWalletProvider, PrivyEmbeddedSolanaWalletProvider, EmbeddedBitcoinWalletProvider, GenerateAuthorizationSignatureInput, GenerateAuthorizationSignatureOutput, Storage, Chain, OAuthProviderID, Logger } from '@privy-io/js-sdk-core';
2
+ import Privy__default, { EmbeddedWalletConfig, DepositConfig, GenerateDepositAddressInput, DepositAddressQuote, GetDepositInput, DepositAddressOrder, WaitForDepositInput, DepositAddressPollingResult, WaitForCompletionInput, UnsignedTransactionRequest, OnNeedsRecovery, MfaMethod, SessionSignerInput, PrivyEmbeddedWalletProvider, PrivyEmbeddedSolanaWalletProvider, EmbeddedBitcoinWalletProvider, GenerateAuthorizationSignatureInput, GenerateAuthorizationSignatureOutput, Storage, Chain, OAuthProviderID, Logger } from '@privy-io/js-sdk-core';
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, 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';
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-045de424.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-045de424.js';
8
8
  import * as _privy_io_api_types from '@privy-io/api-types';
9
- import { User, AuthenticatedUser } from '@privy-io/api-types';
9
+ import { User, LinkedAccountEthereumEmbeddedWallet, LinkedAccountSolanaEmbeddedWallet, 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
12
  import { EncryptedAuthorizationKeyResponse } from '@privy-io/routes';
@@ -1071,6 +1071,34 @@ interface UseUnlinkPasskey {
1071
1071
  */
1072
1072
  declare function useUnlinkPasskey(): UseUnlinkPasskey;
1073
1073
 
1074
+ type ImportedWalletAccount = LinkedAccountEthereumEmbeddedWallet | LinkedAccountSolanaEmbeddedWallet;
1075
+ interface UseImportWallet {
1076
+ /**
1077
+ * Imports a private key to be used as an embedded wallet for the user. This
1078
+ * method will error if the user exits in the middle of the flow.
1079
+ *
1080
+ * @param o input object
1081
+ * @param o.privateKey the private key to import, hex for ethereum or base58 for solana
1082
+ * @param o.chainType the chain type of the wallet to import
1083
+ * @param o.additionalSigners optional additional signers for the wallet, only supported for TEE wallets
1084
+ *
1085
+ * @returns the updated user and the imported wallet account
1086
+ */
1087
+ importWallet: (input: {
1088
+ privateKey: string;
1089
+ chainType: 'ethereum' | 'solana';
1090
+ additionalSigners?: SessionSignerInput;
1091
+ }) => Promise<{
1092
+ user: User;
1093
+ wallet: ImportedWalletAccount;
1094
+ }>;
1095
+ }
1096
+ /**
1097
+ * Use this hook to import an external ethereum or solana wallet into an embedded
1098
+ * wallet via its private key.
1099
+ */
1100
+ declare const useImportWallet: () => UseImportWallet;
1101
+
1074
1102
  type UseEmbeddedWallet = {
1075
1103
  /**
1076
1104
  * Callback function triggered when wallet creation is successful.
@@ -1324,16 +1352,16 @@ declare const useAuthorizationSignature: () => UseAuthorizationSignatureInterfac
1324
1352
 
1325
1353
  interface UseGetEncryptedAuthorizationKeyInterface {
1326
1354
  /**
1327
- * Fetches an encrypted authorization key by ID using the SDK's internal
1328
- * Privy access token. Use this instead of calling the endpoint directly
1329
- * from mobile, where HttpOnly cookies are not available.
1355
+ * Fetches an encrypted authorization key by ID using the current Privy
1356
+ * session. Use this instead of calling the endpoint directly from mobile,
1357
+ * where HttpOnly cookies are not available.
1330
1358
  */
1331
1359
  getEncryptedAuthorizationKey: ({ id }: {
1332
1360
  id: string;
1333
1361
  }) => Promise<EncryptedAuthorizationKeyResponse>;
1334
1362
  }
1335
1363
  /**
1336
- * Hook to fetch an encrypted authorization key using the SDK's internal Privy access token.
1364
+ * Hook to fetch an encrypted authorization key using the current Privy session.
1337
1365
  * @returns The `getEncryptedAuthorizationKey` method which fetches a key by ID.
1338
1366
  */
1339
1367
  declare const useGetEncryptedAuthorizationKey: () => UseGetEncryptedAuthorizationKeyInterface;
@@ -1792,4 +1820,4 @@ declare const useMigrateWallets: () => {
1792
1820
  }>;
1793
1821
  };
1794
1822
 
1795
- export { AddSessionSignersInput, AddSessionSignersOutput, AddSignersInput, AddSignersOutput, AuthBoundary, ConnectedEthereumWallet, CustomAuthProviderConfig, EmbeddedSolanaWalletState, EmbeddedWalletState, FarcasterV2State, LinkWithCrossAppInput, LinkWithCrossAppOutput, LinkWithEmailHookResult, LinkWithEmailOptions, LinkWithOAuthInput, LinkWithSMSHookResult, LinkWithSMSOptions, LoginWithCrossAppInput, LoginWithCrossAppOutput, LoginWithEmailHookResult, LoginWithEmailOptions, LoginWithFarcasterV2Input, LoginWithOAuthInput, LoginWithSMSHookResult, LoginWithSMSOptions, OAuthFlowHookResult, OAuthFlowState, OAuthTokens, OtpFlowState, PrivyAuthGuardProps, PrivyConfig, PrivyContext, PrivyOptions, PrivyProvider, PrivyProviderProps, RecoveryFlowState, RemoveSessionSignersInput, RemoveSessionSignersOutput, RemoveSignersInput, RemoveSignersOutput, SecureStorageAdapter, SendEmailCodeInput, SendPhoneCodeInput, SendTransactionWithCrossAppInput, SendTransactionWithCrossAppOutput, SignMessageWithCrossAppInput, SignMessageWithCrossAppOutput, SignTypedDataWithCrossAppInput, SignTypedDataWithCrossAppOutput, UnlinkOAuthInput, UpdateEmailInput, UpdatePhoneInput, UseCreateGuestAccount, UseCreateGuestAccountOptions, UseDepositAddressInterface, UseGetEncryptedAuthorizationKeyInterface, UseHeadlessDelegatedActionsInterface, UseLinkWithCrossAppInterface, UseLinkWithFarcaster, UseLinkWithFarcasterOptions, UseLinkWithOAuth, UseLinkWithSiwe, UseLinkWithSiweOptions, UseLinkWithSiwsInterface, UseLoginWithCrossAppInterface, UseLoginWithFarcaster, UseLoginWithFarcasterOptions, UseLoginWithFarcasterV2, UseLoginWithOAuth, UseLoginWithSiwe, UseLoginWithSiweOptions, UseLoginWithSiwsInterface, UseMfa, UseMfaEnrollment, UseOAuthTokens, UseOAuthTokensOptions, UseOnEmbeddedWalletStateChange, UseRecoverEmbeddedWallet, UseSendTransactionWithCrossAppInterface, UseSessionSignersInterface, UseSetEmbeddedWalletRecovery, UseSignMessageWithCrossAppInterface, UseSignTypedDataWithCrossAppInterface, UseSignersInterface, UseStoredUsers, UseSwitchUser, UseUnlinkEmailOptions, UseUnlinkFarcaster, UseUnlinkFarcasterOptions, UseUnlinkOAuth, UseUnlinkPasskey, UseUnlinkWallet, UseUnlinkWalletOptions, UseUpdateEmailInterface, UseUpdatePhoneInterface, createPrivyClient, getAccessToken, useAcceptTerms, useAuthorizationSignature, useCreateGuestAccount, useDepositAddress, useEmbeddedBitcoinWallet, useEmbeddedEthereumWallet, useEmbeddedSolanaWallet, useEmbeddedWallet, useEmbeddedWalletStateChange, useGetEncryptedAuthorizationKey, useHeadlessDelegatedActions, useIdentityToken, useLinkEmail, useLinkSMS, useLinkWithCrossApp, useLinkWithFarcaster, useLinkWithOAuth, useLinkWithSiwe, useLinkWithSiws, useLoginWithCrossApp, useLoginWithEmail, useLoginWithFarcaster, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithSMS, useLoginWithSiwe, useLoginWithSiws, useMfa, useMfaEnrollment, useMigrateWallets, useOAuthFlow, useOAuthTokens, useOnNeedsRecovery, usePrivy, usePrivyClient, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransactionWithCrossApp, useSessionSigners, useSetEmbeddedWalletRecovery, useSign7702Authorization, useSignMessageWithCrossApp, useSignTypedDataWithCrossApp, useSigners, useStoredUsers, useSwitchUser, useUnlinkEmail, useUnlinkFarcaster, useUnlinkOAuth, useUnlinkPasskey, useUnlinkWallet, useUpdateEmail, useUpdatePhone };
1823
+ export { AddSessionSignersInput, AddSessionSignersOutput, AddSignersInput, AddSignersOutput, AuthBoundary, ConnectedEthereumWallet, CustomAuthProviderConfig, EmbeddedSolanaWalletState, EmbeddedWalletState, FarcasterV2State, LinkWithCrossAppInput, LinkWithCrossAppOutput, LinkWithEmailHookResult, LinkWithEmailOptions, LinkWithOAuthInput, LinkWithSMSHookResult, LinkWithSMSOptions, LoginWithCrossAppInput, LoginWithCrossAppOutput, LoginWithEmailHookResult, LoginWithEmailOptions, LoginWithFarcasterV2Input, LoginWithOAuthInput, LoginWithSMSHookResult, LoginWithSMSOptions, OAuthFlowHookResult, OAuthFlowState, OAuthTokens, OtpFlowState, PrivyAuthGuardProps, PrivyConfig, PrivyContext, PrivyOptions, PrivyProvider, PrivyProviderProps, RecoveryFlowState, RemoveSessionSignersInput, RemoveSessionSignersOutput, RemoveSignersInput, RemoveSignersOutput, SecureStorageAdapter, SendEmailCodeInput, SendPhoneCodeInput, SendTransactionWithCrossAppInput, SendTransactionWithCrossAppOutput, SignMessageWithCrossAppInput, SignMessageWithCrossAppOutput, SignTypedDataWithCrossAppInput, SignTypedDataWithCrossAppOutput, UnlinkOAuthInput, UpdateEmailInput, UpdatePhoneInput, UseCreateGuestAccount, UseCreateGuestAccountOptions, UseDepositAddressInterface, UseGetEncryptedAuthorizationKeyInterface, UseHeadlessDelegatedActionsInterface, UseImportWallet, UseLinkWithCrossAppInterface, UseLinkWithFarcaster, UseLinkWithFarcasterOptions, UseLinkWithOAuth, UseLinkWithSiwe, UseLinkWithSiweOptions, UseLinkWithSiwsInterface, UseLoginWithCrossAppInterface, UseLoginWithFarcaster, UseLoginWithFarcasterOptions, UseLoginWithFarcasterV2, UseLoginWithOAuth, UseLoginWithSiwe, UseLoginWithSiweOptions, UseLoginWithSiwsInterface, UseMfa, UseMfaEnrollment, UseOAuthTokens, UseOAuthTokensOptions, UseOnEmbeddedWalletStateChange, UseRecoverEmbeddedWallet, UseSendTransactionWithCrossAppInterface, UseSessionSignersInterface, UseSetEmbeddedWalletRecovery, UseSignMessageWithCrossAppInterface, UseSignTypedDataWithCrossAppInterface, UseSignersInterface, UseStoredUsers, UseSwitchUser, UseUnlinkEmailOptions, UseUnlinkFarcaster, UseUnlinkFarcasterOptions, UseUnlinkOAuth, UseUnlinkPasskey, UseUnlinkWallet, UseUnlinkWalletOptions, UseUpdateEmailInterface, UseUpdatePhoneInterface, createPrivyClient, getAccessToken, useAcceptTerms, useAuthorizationSignature, useCreateGuestAccount, useDepositAddress, useEmbeddedBitcoinWallet, useEmbeddedEthereumWallet, useEmbeddedSolanaWallet, useEmbeddedWallet, useEmbeddedWalletStateChange, useGetEncryptedAuthorizationKey, useHeadlessDelegatedActions, useIdentityToken, useImportWallet, useLinkEmail, useLinkSMS, useLinkWithCrossApp, useLinkWithFarcaster, useLinkWithOAuth, useLinkWithSiwe, useLinkWithSiws, useLoginWithCrossApp, useLoginWithEmail, useLoginWithFarcaster, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithSMS, useLoginWithSiwe, useLoginWithSiws, useMfa, useMfaEnrollment, useMigrateWallets, useOAuthFlow, useOAuthTokens, useOnNeedsRecovery, usePrivy, usePrivyClient, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransactionWithCrossApp, useSessionSigners, useSetEmbeddedWalletRecovery, useSign7702Authorization, useSignMessageWithCrossApp, useSignTypedDataWithCrossApp, useSigners, useStoredUsers, useSwitchUser, useUnlinkEmail, useUnlinkFarcaster, useUnlinkOAuth, useUnlinkPasskey, useUnlinkWallet, useUpdateEmail, useUpdatePhone };
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 _chunkNKJIZ63Mjs = require('./chunk-NKJIZ63M.js');var _chunkWGFYNBVPjs = require('./chunk-WGFYNBVP.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}=_chunkWGFYNBVPjs.Z.call(void 0, ),d=_chunkWGFYNBVPjs.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 _chunkNKJIZ63Mjs.a.call(void 0, t)}function F(t){let{state:e,start:o}=_chunkNKJIZ63Mjs.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, _chunkWGFYNBVPjs.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=_chunkWGFYNBVPjs.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, _chunkWGFYNBVPjs.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 = _chunkWGFYNBVPjs.fa; exports.PrivyProvider = _chunkWGFYNBVPjs.ha; exports.SecureStorageAdapter = _chunkK5SPDXVFjs.h; exports.createPrivyClient = _chunkWGFYNBVPjs.i; exports.getAccessToken = _chunkWGFYNBVPjs.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 = _chunkWGFYNBVPjs._; exports.useAuthorizationSignature = _chunkWGFYNBVPjs.$; exports.useCreateGuestAccount = _chunkWGFYNBVPjs.O; exports.useDepositAddress = _chunkWGFYNBVPjs.z; exports.useEmbeddedBitcoinWallet = _chunkWGFYNBVPjs.Y; exports.useEmbeddedEthereumWallet = _chunkWGFYNBVPjs.W; exports.useEmbeddedSolanaWallet = _chunkWGFYNBVPjs.X; exports.useEmbeddedWallet = _chunkWGFYNBVPjs.L; exports.useEmbeddedWalletStateChange = _chunkWGFYNBVPjs.M; exports.useGetEncryptedAuthorizationKey = _chunkWGFYNBVPjs.aa; exports.useHeadlessDelegatedActions = _chunkWGFYNBVPjs.y; exports.useIdentityToken = _chunkWGFYNBVPjs.N; exports.useLinkEmail = _chunkWGFYNBVPjs.p; exports.useLinkSMS = _chunkWGFYNBVPjs.s; exports.useLinkWithCrossApp = _chunkWGFYNBVPjs.F; exports.useLinkWithFarcaster = _chunkWGFYNBVPjs.u; exports.useLinkWithOAuth = F; exports.useLinkWithSiwe = _chunkWGFYNBVPjs.j; exports.useLinkWithSiws = _chunkWGFYNBVPjs.m; exports.useLoginWithCrossApp = _chunkWGFYNBVPjs.E; exports.useLoginWithEmail = _chunkWGFYNBVPjs.r; exports.useLoginWithFarcaster = _chunkWGFYNBVPjs.w; exports.useLoginWithFarcasterV2 = _chunkWGFYNBVPjs.x; exports.useLoginWithOAuth = _chunkNKJIZ63Mjs.b; exports.useLoginWithSMS = _chunkWGFYNBVPjs.t; exports.useLoginWithSiwe = _chunkWGFYNBVPjs.k; exports.useLoginWithSiws = _chunkWGFYNBVPjs.n; exports.useMfa = _chunkWGFYNBVPjs.T; exports.useMfaEnrollment = _chunkWGFYNBVPjs.U; exports.useMigrateWallets = _chunkWGFYNBVPjs.ea; exports.useOAuthFlow = T; exports.useOAuthTokens = b; exports.useOnNeedsRecovery = _chunkWGFYNBVPjs.f; exports.usePrivy = _chunkWGFYNBVPjs.Z; exports.usePrivyClient = _chunkWGFYNBVPjs.l; exports.useRecoverEmbeddedWallet = _chunkWGFYNBVPjs.K; exports.useRegisterMfaListener = _chunkWGFYNBVPjs.P; exports.useSendTransactionWithCrossApp = _chunkWGFYNBVPjs.I; exports.useSessionSigners = _chunkWGFYNBVPjs.A; exports.useSetEmbeddedWalletRecovery = _chunkWGFYNBVPjs.J; exports.useSign7702Authorization = _chunkWGFYNBVPjs.ba; exports.useSignMessageWithCrossApp = _chunkWGFYNBVPjs.G; exports.useSignTypedDataWithCrossApp = _chunkWGFYNBVPjs.H; exports.useSigners = _chunkWGFYNBVPjs.B; exports.useStoredUsers = _chunkWGFYNBVPjs.ca; exports.useSwitchUser = _chunkWGFYNBVPjs.da; exports.useUnlinkEmail = _chunkWGFYNBVPjs.q; exports.useUnlinkFarcaster = _chunkWGFYNBVPjs.v; exports.useUnlinkOAuth = H; exports.useUnlinkPasskey = _chunkWGFYNBVPjs.V; exports.useUnlinkWallet = _chunkWGFYNBVPjs.o; exports.useUpdateEmail = _chunkWGFYNBVPjs.C; exports.useUpdatePhone = _chunkWGFYNBVPjs.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 _chunkF5FQ4MOJjs = require('./chunk-F5FQ4MOJ.js');var _chunkHUHULZRXjs = require('./chunk-HUHULZRX.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 Mt=({loading:t,error:e,unauthenticated:o,children:i})=>{let{isReady:u,error:p}=_chunkHUHULZRXjs._.call(void 0, ),d=_chunkHUHULZRXjs.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 _chunkF5FQ4MOJjs.a.call(void 0, t)}function F(t){let{state:e,start:o}=_chunkF5FQ4MOJjs.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, _chunkHUHULZRXjs.ga),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=_chunkHUHULZRXjs.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, _chunkHUHULZRXjs.ga),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 = Mt; exports.PrivyContext = _chunkHUHULZRXjs.ga; exports.PrivyProvider = _chunkHUHULZRXjs.ia; exports.SecureStorageAdapter = _chunkK5SPDXVFjs.h; exports.createPrivyClient = _chunkHUHULZRXjs.i; exports.getAccessToken = _chunkHUHULZRXjs.ha; 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 = _chunkHUHULZRXjs.$; exports.useAuthorizationSignature = _chunkHUHULZRXjs.aa; exports.useCreateGuestAccount = _chunkHUHULZRXjs.O; exports.useDepositAddress = _chunkHUHULZRXjs.z; exports.useEmbeddedBitcoinWallet = _chunkHUHULZRXjs.Z; exports.useEmbeddedEthereumWallet = _chunkHUHULZRXjs.X; exports.useEmbeddedSolanaWallet = _chunkHUHULZRXjs.Y; exports.useEmbeddedWallet = _chunkHUHULZRXjs.L; exports.useEmbeddedWalletStateChange = _chunkHUHULZRXjs.M; exports.useGetEncryptedAuthorizationKey = _chunkHUHULZRXjs.ba; exports.useHeadlessDelegatedActions = _chunkHUHULZRXjs.y; exports.useIdentityToken = _chunkHUHULZRXjs.N; exports.useImportWallet = _chunkHUHULZRXjs.W; exports.useLinkEmail = _chunkHUHULZRXjs.p; exports.useLinkSMS = _chunkHUHULZRXjs.s; exports.useLinkWithCrossApp = _chunkHUHULZRXjs.F; exports.useLinkWithFarcaster = _chunkHUHULZRXjs.u; exports.useLinkWithOAuth = F; exports.useLinkWithSiwe = _chunkHUHULZRXjs.j; exports.useLinkWithSiws = _chunkHUHULZRXjs.m; exports.useLoginWithCrossApp = _chunkHUHULZRXjs.E; exports.useLoginWithEmail = _chunkHUHULZRXjs.r; exports.useLoginWithFarcaster = _chunkHUHULZRXjs.w; exports.useLoginWithFarcasterV2 = _chunkHUHULZRXjs.x; exports.useLoginWithOAuth = _chunkF5FQ4MOJjs.b; exports.useLoginWithSMS = _chunkHUHULZRXjs.t; exports.useLoginWithSiwe = _chunkHUHULZRXjs.k; exports.useLoginWithSiws = _chunkHUHULZRXjs.n; exports.useMfa = _chunkHUHULZRXjs.T; exports.useMfaEnrollment = _chunkHUHULZRXjs.U; exports.useMigrateWallets = _chunkHUHULZRXjs.fa; exports.useOAuthFlow = T; exports.useOAuthTokens = b; exports.useOnNeedsRecovery = _chunkHUHULZRXjs.f; exports.usePrivy = _chunkHUHULZRXjs._; exports.usePrivyClient = _chunkHUHULZRXjs.l; exports.useRecoverEmbeddedWallet = _chunkHUHULZRXjs.K; exports.useRegisterMfaListener = _chunkHUHULZRXjs.P; exports.useSendTransactionWithCrossApp = _chunkHUHULZRXjs.I; exports.useSessionSigners = _chunkHUHULZRXjs.A; exports.useSetEmbeddedWalletRecovery = _chunkHUHULZRXjs.J; exports.useSign7702Authorization = _chunkHUHULZRXjs.ca; exports.useSignMessageWithCrossApp = _chunkHUHULZRXjs.G; exports.useSignTypedDataWithCrossApp = _chunkHUHULZRXjs.H; exports.useSigners = _chunkHUHULZRXjs.B; exports.useStoredUsers = _chunkHUHULZRXjs.da; exports.useSwitchUser = _chunkHUHULZRXjs.ea; exports.useUnlinkEmail = _chunkHUHULZRXjs.q; exports.useUnlinkFarcaster = _chunkHUHULZRXjs.v; exports.useUnlinkOAuth = H; exports.useUnlinkPasskey = _chunkHUHULZRXjs.V; exports.useUnlinkWallet = _chunkHUHULZRXjs.o; exports.useUpdateEmail = _chunkHUHULZRXjs.C; exports.useUpdatePhone = _chunkHUHULZRXjs.D;
package/dist/passkey.d.ts CHANGED
@@ -1,5 +1,5 @@
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';
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-045de424.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-045de424.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 _chunkWGFYNBVPjs = require('./chunk-WGFYNBVP.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, _chunkWGFYNBVPjs.fa),c=_react.useCallback.call(void 0, o=>{var r;let a=_chunkWGFYNBVPjs.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(!_chunkWGFYNBVPjs.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 _chunkWGFYNBVPjs.Q.call(void 0, _chunkWGFYNBVPjs.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, _chunkWGFYNBVPjs.fa),c=_react.useCallback.call(void 0, o=>{var r;let a=_chunkWGFYNBVPjs.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(_chunkWGFYNBVPjs.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 _chunkWGFYNBVPjs.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=_chunkWGFYNBVPjs.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, _chunkWGFYNBVPjs.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=_chunkWGFYNBVPjs.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(_chunkWGFYNBVPjs.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 _chunkWGFYNBVPjs.Q.call(void 0, _chunkWGFYNBVPjs.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 _chunkHUHULZRXjs = require('./chunk-HUHULZRX.js');var _chunkK5SPDXVFjs = require('./chunk-K5SPDXVF.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var Y=e=>{let{client:a,passkeyState:P,setPasskeyState:s}=_react.useContext.call(void 0, _chunkHUHULZRXjs.ga),c=_react.useCallback.call(void 0, o=>{var n;let r=_chunkHUHULZRXjs.g.call(void 0, o);return s({status:"error",error:r}),(n=e==null?void 0:e.onError)==null||n.call(e,r),r},[e==null?void 0:e.onError]);return{linkWithPasskey:_react.useCallback.call(void 0, n=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[n],function*({relyingParty:o,extra_options:r}){var u;try{if(!_chunkHUHULZRXjs.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:k}=yield a.auth.passkey.generateRegistrationOptions(o);s({status:"awaiting-passkey"});let y=yield _chunkHUHULZRXjs.Q.call(void 0, _chunkHUHULZRXjs.S.call(void 0, k),r);s({status:"submitting-response"});let{user:l}=yield a.auth.passkey.linkWithPasskey(y,o);return s({status:"done"}),(u=e==null?void 0:e.onSuccess)==null||u.call(e,l),l}catch(t){throw c(t)}}),[a,c,e==null?void 0:e.onSuccess]),state:P}};var ie=e=>{let{client:a,passkeyState:P,setPasskeyState:s}=_react.useContext.call(void 0, _chunkHUHULZRXjs.ga),c=_react.useCallback.call(void 0, o=>{var n;let r=_chunkHUHULZRXjs.g.call(void 0, o);return s({status:"error",error:r}),(n=e==null?void 0:e.onError)==null||n.call(e,r),r},[e==null?void 0:e.onError]);return{loginWithPasskey:_react.useCallback.call(void 0, n=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[n],function*({relyingParty:o,extra_options:r}){var u,t,k,y;try{if(_chunkHUHULZRXjs.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 a.auth.passkey.generateAuthenticationOptions(o);s({status:"awaiting-passkey"});let f=yield _chunkHUHULZRXjs.R.call(void 0, {challenge:i.challenge,rpId:i.rp_id,extensions:{appid:(u=i.extensions)==null?void 0:u.app_id,credProps:(t=i.extensions)==null?void 0:t.cred_props,hmacCreateSecret:(k=i.extensions)==null?void 0:k.hmac_create_secret},timeout:i.timeout,allowCredentials:i.allow_credentials,userVerification:i.user_verification},r);s({status:"submitting-response"});let _=_chunkHUHULZRXjs.a.call(void 0, ),b=yield a.auth.passkey.loginWithPasskey(f,i.challenge,o,{embedded:_==null?void 0:_.embedded});return s({status:"done"}),(y=e==null?void 0:e.onSuccess)==null||y.call(e,b.user,b.is_new_user),b.user}catch(l){throw c(l)}}),[a,c,e==null?void 0:e.onSuccess]),state:P}};var pe=e=>{let{client:a,passkeyState:P,setPasskeyState:s}=_react.useContext.call(void 0, _chunkHUHULZRXjs.ga),c=_react.useRef.call(void 0, e);_react.useEffect.call(void 0, ()=>{c.current=e},[e]);let d=_react.useCallback.call(void 0, r=>{var u,t;let n=_chunkHUHULZRXjs.g.call(void 0, r);return s({status:"error",error:n}),(t=(u=c.current)==null?void 0:u.onError)==null||t.call(u,n),n},[s]);return{signupWithPasskey:_react.useCallback.call(void 0, u=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[u],function*({relyingParty:r,extra_options:n}){var t,k;try{if(_chunkHUHULZRXjs.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:l}=yield a.auth.passkey.generateSignupOptions(r);s({status:"awaiting-passkey"});let i=yield _chunkHUHULZRXjs.Q.call(void 0, _chunkHUHULZRXjs.S.call(void 0, l),n);s({status:"submitting-response"});let f=yield a.auth.passkey.signupWithPasskey(i,r);return s({status:"done"}),(k=(t=c.current)==null?void 0:t.onSuccess)==null||k.call(t,f.user,f.is_new_user),{user:f.user}}catch(y){throw d(y)}}),[a.auth.passkey,d,s]),state:P}};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 = Y; exports.useLoginWithPasskey = ie; exports.useSignupWithPasskey = pe;
@@ -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 _chunkWGFYNBVPjs = require('./chunk-WGFYNBVP.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=_chunkWGFYNBVPjs.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, _chunkWGFYNBVPjs.fa),n=_chunkWGFYNBVPjs.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, _chunkWGFYNBVPjs.fa),r=_chunkWGFYNBVPjs.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=_chunkWGFYNBVPjs.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 _chunkWGFYNBVPjs.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 _chunkWGFYNBVPjs.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, _chunkWGFYNBVPjs.fa),{config:l}=E();return _react.useCallback.call(void 0, n=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[n],function*({chainId:r}){let a=_chunkWGFYNBVPjs.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 _chunkHUHULZRXjs = require('./chunk-HUHULZRX.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=_chunkHUHULZRXjs.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, _chunkHUHULZRXjs.ga),n=_chunkHUHULZRXjs.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, _chunkHUHULZRXjs.ga),r=_chunkHUHULZRXjs.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=_chunkHUHULZRXjs.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 _chunkHUHULZRXjs.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 _chunkHUHULZRXjs.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, _chunkHUHULZRXjs.ga),{config:l}=E();return _react.useCallback.call(void 0, n=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[n],function*({chainId:r}){let a=_chunkHUHULZRXjs.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;
@@ -142,6 +142,12 @@ type SubmitPasskeyInput = {
142
142
  * - On Android via [assetlinks](https://developers.google.com/digital-asset-links/v1/getting-started)
143
143
  */
144
144
  relyingParty: string;
145
+ /**
146
+ * @experimental
147
+ * Extra options passed through to the underlying `react-native-passkeys` native call.
148
+ * Privy-controlled options take precedence over conflicting properties.
149
+ */
150
+ extra_options?: Record<string, unknown>;
145
151
  };
146
152
  type SubmitPasskeySignature = (input: SubmitPasskeyInput) => Promise<User | undefined>;
147
153
  type PasskeyLoginHookOptions = {