@privy-io/js-sdk-core 0.52.6 → 0.52.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/cjs/action/delegatedActions/delegateWallet.js +1 -1
  2. package/dist/cjs/action/delegatedActions/index.js +1 -1
  3. package/dist/cjs/action/delegatedActions/revokeWallets.js +1 -1
  4. package/dist/cjs/action/delegatedActions/utils.js +1 -1
  5. package/dist/cjs/action/index.js +1 -1
  6. package/dist/cjs/client/Privy.js +1 -1
  7. package/dist/cjs/client/PrivyInternal.js +1 -1
  8. package/dist/cjs/client/auth/AuthApi.js +1 -1
  9. package/dist/cjs/client/auth/CustomProviderApi.js +1 -1
  10. package/dist/cjs/client/auth/EmailApi.js +1 -1
  11. package/dist/cjs/client/auth/FarcasterApi.js +1 -1
  12. package/dist/cjs/client/auth/FarcasterV2Api.js +1 -1
  13. package/dist/cjs/client/auth/GuestApi.js +1 -1
  14. package/dist/cjs/client/auth/OAuthApi.js +1 -1
  15. package/dist/cjs/client/auth/PasskeyApi.js +1 -1
  16. package/dist/cjs/client/auth/PhoneApi.js +1 -1
  17. package/dist/cjs/client/auth/SiweApi.js +1 -1
  18. package/dist/cjs/client/auth/SiwsApi.js +1 -1
  19. package/dist/cjs/client/auth/maybeCreateWalletOnLogin.js +1 -1
  20. package/dist/cjs/embedded/EmbeddedBitcoinWalletProvider.js +1 -1
  21. package/dist/cjs/embedded/stack/session-signers.js +1 -1
  22. package/dist/cjs/smart-wallets.js +1 -1
  23. package/dist/cjs/utils/entropy.js +1 -1
  24. package/dist/cjs/utils/getAllUserEmbeddedBitcoinWallets.js +1 -1
  25. package/dist/cjs/utils/getAllUserEmbeddedEthereumWallets.js +1 -1
  26. package/dist/cjs/utils/getAllUserEmbeddedSolanaWallets.js +1 -1
  27. package/dist/cjs/utils/getUserEmbeddedEthereumWallet.js +1 -1
  28. package/dist/cjs/utils/getUserEmbeddedSolanaWallet.js +1 -1
  29. package/dist/cjs/utils/shouldCreateEmbeddedEthWallet.js +1 -1
  30. package/dist/cjs/utils/shouldCreateEmbeddedSolWallet.js +1 -1
  31. package/dist/esm/action/delegatedActions/delegateWallet.mjs +1 -1
  32. package/dist/esm/action/delegatedActions/index.mjs +1 -1
  33. package/dist/esm/action/delegatedActions/revokeWallets.mjs +1 -1
  34. package/dist/esm/action/delegatedActions/utils.mjs +1 -1
  35. package/dist/esm/action/index.mjs +1 -1
  36. package/dist/esm/client/Privy.mjs +1 -1
  37. package/dist/esm/client/PrivyInternal.mjs +1 -1
  38. package/dist/esm/client/auth/AuthApi.mjs +1 -1
  39. package/dist/esm/client/auth/CustomProviderApi.mjs +1 -1
  40. package/dist/esm/client/auth/EmailApi.mjs +1 -1
  41. package/dist/esm/client/auth/FarcasterApi.mjs +1 -1
  42. package/dist/esm/client/auth/FarcasterV2Api.mjs +1 -1
  43. package/dist/esm/client/auth/GuestApi.mjs +1 -1
  44. package/dist/esm/client/auth/OAuthApi.mjs +1 -1
  45. package/dist/esm/client/auth/PasskeyApi.mjs +1 -1
  46. package/dist/esm/client/auth/PhoneApi.mjs +1 -1
  47. package/dist/esm/client/auth/SiweApi.mjs +1 -1
  48. package/dist/esm/client/auth/SiwsApi.mjs +1 -1
  49. package/dist/esm/client/auth/maybeCreateWalletOnLogin.mjs +1 -1
  50. package/dist/esm/embedded/EmbeddedBitcoinWalletProvider.mjs +1 -1
  51. package/dist/esm/embedded/stack/session-signers.mjs +1 -1
  52. package/dist/esm/smart-wallets.mjs +1 -1
  53. package/dist/esm/utils/entropy.mjs +1 -1
  54. package/dist/esm/utils/getAllUserEmbeddedBitcoinWallets.mjs +1 -1
  55. package/dist/esm/utils/getAllUserEmbeddedEthereumWallets.mjs +1 -1
  56. package/dist/esm/utils/getAllUserEmbeddedSolanaWallets.mjs +1 -1
  57. package/dist/esm/utils/getUserEmbeddedEthereumWallet.mjs +1 -1
  58. package/dist/esm/utils/getUserEmbeddedSolanaWallet.mjs +1 -1
  59. package/dist/esm/utils/shouldCreateEmbeddedEthWallet.mjs +1 -1
  60. package/dist/esm/utils/shouldCreateEmbeddedSolWallet.mjs +1 -1
  61. package/package.json +2 -2
@@ -1 +1 @@
1
- "use strict";var e=require("../../Error.js"),r=require("../../wallet-api/unified-wallet.js"),t=require("./utils.js");require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getUserEmbeddedSolanaWallet.js");exports.delegateWallet=s=>async({address:l,chainType:a})=>{let{user:d}=await s.user.get();if(!d)throw new e.PrivyClientError({code:"delegated_actions_before_logged_in",error:"Must be logged in to delegate wallets"});if("solana"!==a&&"ethereum"!==a)throw new e.PrivyClientError({code:"unsupported_chain_type",error:"Only Solana and Ethereum embedded wallets are supported for delegation and revocation."});let i=t.getUserValidDelegateWallets(d).find((e=>e.chain_type===a&&e.address===l));if(!i)throw new e.PrivyClientError({code:"delegated_actions_wallet_not_found",error:"Address to delegate is not associated with current user."});if(r.isUnifiedWallet(i))throw new e.PrivyClientError({code:"unsupported_wallet_type",error:"useDelegatedActions is only supported for on-device execution and this app uses TEE execution. Use the useSessionSigners hook to provision server side access on behalf of your users. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide"});if(i.delegated)return{user:d};let o=t.getRootWalletForDelegation(i,d);if(!o)throw new e.PrivyClientError({code:"delegated_actions_wallet_not_found",error:"Address to delegate is not associated with current user."});await s.embeddedWallet.delegateWallets({rootWallet:{address:o.address,chainType:o.chain_type,imported:o.imported},delegatedWallets:[{address:i.address,chainType:i.chain_type,walletIndex:i.wallet_index}]});let{user:n}=await s.user.get();return{user:n}};
1
+ "use strict";var e=require("../../Error.js"),r=require("../../wallet-api/unified-wallet.js"),t=require("./utils.js");require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getUserEmbeddedSolanaWallet.js");exports.delegateWallet=s=>async({address:l,chainType:a})=>{let{user:d}=await s.user.get();if(!d)throw new e.PrivyClientError({code:"delegated_actions_before_logged_in",error:"Must be logged in to delegate wallets"});if("solana"!==a&&"ethereum"!==a)throw new e.PrivyClientError({code:"unsupported_chain_type",error:"Only Solana and Ethereum embedded wallets are supported for delegation and revocation."});let i=t.getUserValidDelegateWallets(d).find((e=>e.chain_type===a&&e.address===l));if(!i)throw new e.PrivyClientError({code:"delegated_actions_wallet_not_found",error:"Address to delegate is not associated with current user."});if(r.isUnifiedWallet(i))throw new e.PrivyClientError({code:"unsupported_wallet_type",error:"useDelegatedActions is only supported for on-device execution and this app uses TEE execution. Use the useSessionSigners hook to provision server side access on behalf of your users. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide"});if(i.delegated)return{user:d};let o=t.getRootWalletForDelegation(i,d);if(!o)throw new e.PrivyClientError({code:"delegated_actions_wallet_not_found",error:"Address to delegate is not associated with current user."});await s.embeddedWallet.delegateWallets({rootWallet:{address:o.address,chainType:o.chain_type,imported:o.imported},delegatedWallets:[{address:i.address,chainType:i.chain_type,walletIndex:i.wallet_index}]});let{user:n}=await s.user.get();return{user:n}};
@@ -1 +1 @@
1
- "use strict";var e=require("./delegateWallet.js"),l=require("./revokeWallets.js");require("../../Error.js"),require("../../wallet-api/unified-wallet.js"),require("./utils.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),exports.delegateWallet=e.delegateWallet,exports.revokeWallets=l.revokeWallets;
1
+ "use strict";var e=require("./delegateWallet.js"),l=require("./revokeWallets.js");require("../../Error.js"),require("../../wallet-api/unified-wallet.js"),require("./utils.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),exports.delegateWallet=e.delegateWallet,exports.revokeWallets=l.revokeWallets;
@@ -1 +1 @@
1
- "use strict";var e=require("../../Error.js"),r=require("../../wallet-api/unified-wallet.js"),t=require("./utils.js");require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getUserEmbeddedSolanaWallet.js");exports.revokeWallets=s=>async()=>{let{user:l}=await s.user.get();if(!l)throw new e.PrivyClientError({code:"delegated_actions_before_logged_in",error:"Must be logged in to revoke delegated wallets"});let o=t.getUserValidDelegateWallets(l);if(o.some(r.isUnifiedWallet))throw new e.PrivyClientError({code:"unsupported_wallet_type",error:"revokeWallets is only supported for on-device execution and this app uses TEE execution. Use the useSessionSigners hook to manage server side access on behalf of your users. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide"});if(o.every((e=>!e.delegated)))throw new e.PrivyClientError({code:"delegated_actions_no_wallet_to_revoke",error:"User has no delegated wallets to revoke."});await s.delegated.revoke();let{user:i}=await s.user.get();return{user:i}};
1
+ "use strict";var e=require("../../Error.js"),r=require("../../wallet-api/unified-wallet.js"),t=require("./utils.js");require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getUserEmbeddedSolanaWallet.js");exports.revokeWallets=s=>async()=>{let{user:l}=await s.user.get();if(!l)throw new e.PrivyClientError({code:"delegated_actions_before_logged_in",error:"Must be logged in to revoke delegated wallets"});let i=t.getUserValidDelegateWallets(l);if(i.some(r.isUnifiedWallet))throw new e.PrivyClientError({code:"unsupported_wallet_type",error:"revokeWallets is only supported for on-device execution and this app uses TEE execution. Use the useSessionSigners hook to manage server side access on behalf of your users. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide"});if(i.every((e=>!e.delegated)))throw new e.PrivyClientError({code:"delegated_actions_no_wallet_to_revoke",error:"User has no delegated wallets to revoke."});await s.delegated.revoke();let{user:o}=await s.user.get();return{user:o}};
@@ -1 +1 @@
1
- "use strict";var e=require("../../utils/getAllUserEmbeddedEthereumWallets.js"),l=require("../../utils/getAllUserEmbeddedSolanaWallets.js"),t=require("../../utils/getUserEmbeddedEthereumWallet.js"),r=require("../../utils/getUserEmbeddedSolanaWallet.js");exports.getRootWalletForDelegation=(e,l)=>e.imported?e:t.getUserEmbeddedEthereumWallet(l)??r.getUserEmbeddedSolanaWallet(l),exports.getUserValidDelegateWallets=t=>[...e.getAllUserEmbeddedEthereumWallets(t),...l.getAllUserEmbeddedSolanaWallets(t)];
1
+ "use strict";var e=require("../../utils/getAllUserEmbeddedEthereumWallets.js"),l=require("../../utils/getAllUserEmbeddedSolanaWallets.js"),t=require("../../utils/getUserEmbeddedEthereumWallet.js"),d=require("../../utils/getUserEmbeddedSolanaWallet.js");require("../../utils/embedded-wallets.js");exports.getRootWalletForDelegation=(e,l)=>e.imported?e:t.getUserEmbeddedEthereumWallet(l)??d.getUserEmbeddedSolanaWallet(l),exports.getUserValidDelegateWallets=t=>[...e.getAllUserEmbeddedEthereumWallets(t),...l.getAllUserEmbeddedSolanaWallets(t)];
@@ -1 +1 @@
1
- "use strict";var e=require("../index-BDWdfIuK.js"),s=require("../index-DzfqDJJ9.js");require("./delegatedActions/delegateWallet.js"),require("../Error.js"),require("../wallet-api/unified-wallet.js"),require("./delegatedActions/utils.js"),require("../utils/getAllUserEmbeddedEthereumWallets.js"),require("../utils/getAllUserEmbeddedSolanaWallets.js"),require("../utils/getUserEmbeddedEthereumWallet.js"),require("../utils/getUserEmbeddedSolanaWallet.js"),require("./delegatedActions/revokeWallets.js"),require("./crossApp/loginWithCrossAppAuth.js"),require("./crossApp/linkWithCrossAppAuth.js"),require("../index-CARkJvRM.js"),require("./crossApp/wallet/signMessage.js"),require("./crossApp/wallet/utils/isCrossAppWalletSmart.js"),require("./crossApp/wallet/utils/sendCrossAppRequest.js"),require("./crossApp/wallet/utils/getCrossAppAccountByWalletAddress.js"),require("./crossApp/wallet/utils/getProviderAccessTokenOrRelink.js"),require("./crossApp/wallet/utils/throwIfNotLoggedIn.js"),require("./crossApp/wallet/signTypedData.js"),require("../utils/typedData/generateDomainType.js"),require("./crossApp/wallet/sendTransaction.js"),exports.delegatedActions=e.index,exports.crossApp=s.index;
1
+ "use strict";var e=require("../index-BDWdfIuK.js"),s=require("../index-DzfqDJJ9.js");require("./delegatedActions/delegateWallet.js"),require("../Error.js"),require("../wallet-api/unified-wallet.js"),require("./delegatedActions/utils.js"),require("../utils/getAllUserEmbeddedEthereumWallets.js"),require("../utils/embedded-wallets.js"),require("../utils/getAllUserEmbeddedSolanaWallets.js"),require("../utils/getUserEmbeddedEthereumWallet.js"),require("../utils/getUserEmbeddedSolanaWallet.js"),require("./delegatedActions/revokeWallets.js"),require("./crossApp/loginWithCrossAppAuth.js"),require("./crossApp/linkWithCrossAppAuth.js"),require("../index-CARkJvRM.js"),require("./crossApp/wallet/signMessage.js"),require("./crossApp/wallet/utils/isCrossAppWalletSmart.js"),require("./crossApp/wallet/utils/sendCrossAppRequest.js"),require("./crossApp/wallet/utils/getCrossAppAccountByWalletAddress.js"),require("./crossApp/wallet/utils/getProviderAccessTokenOrRelink.js"),require("./crossApp/wallet/utils/throwIfNotLoggedIn.js"),require("./crossApp/wallet/signTypedData.js"),require("../utils/typedData/generateDomainType.js"),require("./crossApp/wallet/sendTransaction.js"),exports.delegatedActions=e.index,exports.crossApp=s.index;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./AppApi.js"),r=require("./CrossAppApi.js"),i=require("./DelegatedWalletsApi.js"),t=require("./EmbeddedWalletApi.js"),s=require("./MfaPromises.js"),a=require("./PrivyInternal.js"),u=require("./UserApi.js"),d=require("./auth/AuthApi.js"),l=require("./funding/FundingApi.js"),n=require("./mfa/MfaApi.js"),o=require("./recovery/RecoveryApi.js");require("@privy-io/public-api"),require("../Token.js"),require("jose"),require("@privy-io/chains"),require("../Error.js"),require("../embedded/EmbeddedBitcoinWalletProvider.js"),require("../embedded/errors.js"),require("../embedded/types.js"),require("../embedded/stack/walletCreate.js"),require("../wallet-api/create.js"),require("../embedded/utils/index.js"),require("@ethersproject/abstract-signer"),require("@ethersproject/providers"),require("../embedded/gas/arbitrum.js"),require("@ethersproject/bignumber"),require("../embedded/utils/ethers.js"),require("../embedded/gas/bsc.js"),require("../embedded/gas/op-stack.js"),require("@ethersproject/contracts"),require("@ethersproject/transactions"),require("../embedded/gas/polygon.js"),require("@ethersproject/units"),require("fetch-retry"),require("../embedded/utils/gas.js"),require("../wallet-api/unified-wallet.js"),require("../embedded/EmbeddedWalletProxy.js"),require("../utils/sleep.js"),require("../embedded/EventCallbackQueue.js"),require("../embedded/withMfa.js"),require("../embedded/EmbeddedWalletProvider.js"),require("eventemitter3"),require("../embedded/methods.js"),require("../embedded/stack/walletRpc.js"),require("../utils/encodings.js"),require("../wallet-api/rpc.js"),require("../wallet-api/generate-authorization-signature.js"),require("canonicalize"),require("../embedded/stack/wallet-api-eth-transaction.js"),require("../embedded/stack/wallet-api-eth-typed-data.js"),require("../embedded/EmbeddedSolanaWalletProvider.js"),require("../solana/getWalletPublicKeyFromTransaction.js"),require("../solana/isVersionedTransaction.js"),require("uuid"),require("@privy-io/api-base"),require("../Session.js"),require("js-cookie"),require("../utils/allSettled.js"),require("../toAbortSignalTimeout.js"),require("../utils/toSearchParams.js"),require("./logger.js"),require("../utils/noop.js"),require("./auth/CustomProviderApi.js"),require("./auth/maybeCreateWalletOnLogin.js"),require("../utils/getUserEmbeddedEthereumWallet.js"),require("../utils/getAllUserEmbeddedEthereumWallets.js"),require("../utils/getUserEmbeddedSolanaWallet.js"),require("../utils/getAllUserEmbeddedSolanaWallets.js"),require("../utils/shouldCreateEmbeddedEthWallet.js"),require("../utils/shouldCreateEmbeddedSolWallet.js"),require("./auth/EmailApi.js"),require("./auth/FarcasterApi.js"),require("./auth/FarcasterV2Api.js"),require("./auth/GuestApi.js"),require("./auth/OAuthApi.js"),require("../pkce.js"),require("./auth/PasskeyApi.js"),require("./auth/PhoneApi.js"),require("./auth/SiweApi.js"),require("./auth/SiwsApi.js"),require("./auth/SmartWalletApi.js"),require("./funding/CoinbaseOnRampApi.js"),require("./funding/MoonpayOnRampApi.js"),require("../funding/moonpay.js"),require("./mfa/MfaPasskeyApi.js"),require("./mfa/MfaSmsApi.js"),require("./recovery/RecoveryICloudApi.js"),require("./recovery/RecoveryOAuthApi.js");exports.default=class{async initialize(){await this._privyInternal._initialize()}setMessagePoster(e){this.embeddedWallet.setMessagePoster(e)}addOAuthTokensListener(e){return this._privyInternal.session.on("oauth_tokens_granted",e),{unsubscribe:()=>{this._privyInternal.session.removeListener("oauth_tokens_granted",e)}}}setCallbacks(e){this._privyInternal.setCallbacks(e)}getAccessToken(){return this._privyInternal.getAccessToken()}getIdentityToken(){return this._privyInternal.getIdentityToken()}getCompiledPath(e,r){return this._privyInternal.getPath(e,r)}async fetchPrivyRoute(e,r){return this._privyInternal.fetch(e,r)}get logger(){return this._privyInternal.logger}constructor({clientId:p,...q}){this._privyInternal=new a.PrivyInternal({...q,appClientId:p}),this.mfa=new n.default(this._privyInternal),this.mfaPromises=new s.default,this.app=new e.default(this._privyInternal),this.embeddedWallet=new t.default(this._privyInternal,q.embeddedWalletMessagePoster,q.supportedChains,this.mfa,this.mfaPromises,this.app),this.user=new u.default(this._privyInternal),this.auth=new d.default(this._privyInternal,this.embeddedWallet,q.storage,q.crypto),this.recovery=new o.default(this._privyInternal,q.storage,q.crypto),this.funding=new l.default(this._privyInternal),this.delegated=new i.default(this._privyInternal),this.crossApp=new r.default(this._privyInternal,q.storage)}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./AppApi.js"),r=require("./CrossAppApi.js"),i=require("./DelegatedWalletsApi.js"),t=require("./EmbeddedWalletApi.js"),s=require("./MfaPromises.js"),a=require("./PrivyInternal.js"),u=require("./UserApi.js"),d=require("./auth/AuthApi.js"),l=require("./funding/FundingApi.js"),n=require("./mfa/MfaApi.js"),o=require("./recovery/RecoveryApi.js");require("@privy-io/public-api"),require("../Token.js"),require("jose"),require("@privy-io/chains"),require("../Error.js"),require("../embedded/EmbeddedBitcoinWalletProvider.js"),require("../wallet-api/unified-wallet.js"),require("../embedded/errors.js"),require("../embedded/types.js"),require("../embedded/stack/walletCreate.js"),require("../wallet-api/create.js"),require("../embedded/utils/index.js"),require("@ethersproject/abstract-signer"),require("@ethersproject/providers"),require("../embedded/gas/arbitrum.js"),require("@ethersproject/bignumber"),require("../embedded/utils/ethers.js"),require("../embedded/gas/bsc.js"),require("../embedded/gas/op-stack.js"),require("@ethersproject/contracts"),require("@ethersproject/transactions"),require("../embedded/gas/polygon.js"),require("@ethersproject/units"),require("fetch-retry"),require("../embedded/utils/gas.js"),require("../embedded/EmbeddedWalletProxy.js"),require("../utils/sleep.js"),require("../embedded/EventCallbackQueue.js"),require("../embedded/withMfa.js"),require("../embedded/EmbeddedWalletProvider.js"),require("eventemitter3"),require("../embedded/methods.js"),require("../embedded/stack/walletRpc.js"),require("../utils/encodings.js"),require("../wallet-api/rpc.js"),require("../wallet-api/generate-authorization-signature.js"),require("canonicalize"),require("../embedded/stack/wallet-api-eth-transaction.js"),require("../embedded/stack/wallet-api-eth-typed-data.js"),require("../embedded/EmbeddedSolanaWalletProvider.js"),require("../solana/getWalletPublicKeyFromTransaction.js"),require("../solana/isVersionedTransaction.js"),require("uuid"),require("@privy-io/api-base"),require("../Session.js"),require("js-cookie"),require("../utils/allSettled.js"),require("../toAbortSignalTimeout.js"),require("../utils/toSearchParams.js"),require("./logger.js"),require("../utils/noop.js"),require("./auth/CustomProviderApi.js"),require("./auth/maybeCreateWalletOnLogin.js"),require("../utils/getUserEmbeddedEthereumWallet.js"),require("../utils/getAllUserEmbeddedEthereumWallets.js"),require("../utils/embedded-wallets.js"),require("../utils/getUserEmbeddedSolanaWallet.js"),require("../utils/getAllUserEmbeddedSolanaWallets.js"),require("../utils/shouldCreateEmbeddedEthWallet.js"),require("../utils/shouldCreateEmbeddedSolWallet.js"),require("./auth/EmailApi.js"),require("./auth/FarcasterApi.js"),require("./auth/FarcasterV2Api.js"),require("./auth/GuestApi.js"),require("./auth/OAuthApi.js"),require("../pkce.js"),require("./auth/PasskeyApi.js"),require("./auth/PhoneApi.js"),require("./auth/SiweApi.js"),require("./auth/SiwsApi.js"),require("./auth/SmartWalletApi.js"),require("./funding/CoinbaseOnRampApi.js"),require("./funding/MoonpayOnRampApi.js"),require("../funding/moonpay.js"),require("./mfa/MfaPasskeyApi.js"),require("./mfa/MfaSmsApi.js"),require("./recovery/RecoveryICloudApi.js"),require("./recovery/RecoveryOAuthApi.js");exports.default=class{async initialize(){await this._privyInternal._initialize()}setMessagePoster(e){this.embeddedWallet.setMessagePoster(e)}addOAuthTokensListener(e){return this._privyInternal.session.on("oauth_tokens_granted",e),{unsubscribe:()=>{this._privyInternal.session.removeListener("oauth_tokens_granted",e)}}}setCallbacks(e){this._privyInternal.setCallbacks(e)}getAccessToken(){return this._privyInternal.getAccessToken()}getIdentityToken(){return this._privyInternal.getIdentityToken()}getCompiledPath(e,r){return this._privyInternal.getPath(e,r)}async fetchPrivyRoute(e,r){return this._privyInternal.fetch(e,r)}get logger(){return this._privyInternal.logger}constructor({clientId:p,...q}){this._privyInternal=new a.PrivyInternal({...q,appClientId:p}),this.mfa=new n.default(this._privyInternal),this.mfaPromises=new s.default,this.app=new e.default(this._privyInternal),this.embeddedWallet=new t.default(this._privyInternal,q.embeddedWalletMessagePoster,q.supportedChains,this.mfa,this.mfaPromises,this.app),this.user=new u.default(this._privyInternal),this.auth=new d.default(this._privyInternal,this.embeddedWallet,q.storage,q.crypto),this.recovery=new o.default(this._privyInternal,q.storage,q.crypto),this.funding=new l.default(this._privyInternal),this.delegated=new i.default(this._privyInternal),this.crossApp=new r.default(this._privyInternal,q.storage)}};
@@ -1 +1 @@
1
- "use strict";var e=require("fetch-retry"),t=require("uuid"),s=require("@privy-io/api-base"),i=require("@privy-io/public-api"),r=require("../Error.js"),a=require("../Session.js"),n=require("../toAbortSignalTimeout.js"),o=require("../utils/toSearchParams.js"),h=require("./logger.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("eventemitter3"),require("jose"),require("js-cookie"),require("../Token.js"),require("../utils/allSettled.js"),require("../utils/noop.js");var c=/*#__PURE__*/l(e);let g="privy:caid";exports.PrivyInternal=class{setCallbacks(e){this.callbacks={...this.callbacks,...e}}get isReady(){return!!this._config}get config(){return this._config}get caid(){return this._analyticsId}async _initialize(){if(this.isReady)this.callbacks?.setIsReady?.(!0);else{if(!await this.isStorageAccessible())throw new r.PrivyClientError({code:"storage_error",error:"Unable to access storage"});this._config=await this.getAppConfig(),this._config?.custom_api_url&&(this.baseUrl=this._config.custom_api_url,this.session.isUsingServerCookies=!0),this.callbacks?.setIsReady?.(!0),this._sdkVersion.startsWith("react-auth:")||this.createAnalyticsEvent("sdk_initialize",{})}}getPath(e,{params:t,query:s}){return`${this.baseUrl}${i.getPathWithParams(e.path,t)}${o.toSearchParams(s)}`}async fetch(e,{body:t,params:s,query:i,headers:a,onRequest:n=this._beforeRequest.bind(this)}){let o=new Request(this.getPath(e,{params:s,query:i}),{method:e.method,body:JSON.stringify(t),headers:a}),h=await n(o),l=await this._fetch(o,h),c=await l.json();if(l.status>299)throw new r.PrivyApiError(c);return c}async _beforeRequestWithoutInitialize(e){let t=await this.session.getToken(),s=new Headers(e.headers);s.set("privy-app-id",this.appId),this.appClientId&&s.set("privy-client-id",this.appClientId),s.set("privy-client",this._sdkVersion),t&&s.set("Authorization",`Bearer ${t}`),s.set("Content-Type","application/json"),s.set("Accept","application/json");let i=await this._getOrGenerateClientAnalyticsId();return i&&s.set("privy-ca-id",i),this.nativeAppIdentifier&&s.set("x-native-app-identifier",this.nativeAppIdentifier),{signal:n.default(2e4),headers:s,credentials:"include"}}async beforeRequestWithoutRefresh(e){return await this._initialize(),this._beforeRequestWithoutInitialize(e)}async _beforeRequest(e){return await this._initialize(),await this.getAccessToken(),this.beforeRequestWithoutRefresh(e)}async getAppConfig(){return await this.fetch(i.AppConfig,{params:{app_id:this.appId},onRequest:this._beforeRequestWithoutInitialize.bind(this)})}async _getOrGenerateClientAnalyticsId(){if(this._analyticsId)return this._analyticsId;try{let e=await this._storage.get(g);if("string"==typeof e&&e.length>0)return this._analyticsId=e,e}catch(e){this.logger.error("Unable to load clientId",e)}try{this._analyticsId=t.v4()}catch(e){this.logger.error("Unable to generate uuidv4",e)}if(!this._analyticsId)return null;try{await this._storage.put(g,this._analyticsId)}catch(e){this.logger.error(`Unable to store clientId: ${this._analyticsId}`,e)}return this._analyticsId}async destroyClientAnalyticsId(){try{return await this._storage.del(g)}catch(e){this.logger.error("Unable to delete clientId",e)}}async createAnalyticsEvent(e,t){try{await this.fetch(i.AnalyticsEvent,{body:{event_name:e,client_id:await this._getOrGenerateClientAnalyticsId(),payload:t},onRequest:this.beforeRequestWithoutRefresh.bind(this)})}catch(e){}}async refreshSession(e=!1){if(!await this.isStorageAccessible())throw new r.PrivyClientError({code:"storage_error",error:"Unable to access storage"});let t=await this.session.getRefreshToken()??void 0,s=t??"key",i=this._cache.get(s);if(i)return this.logger.debug("[privy:refresh] found in-flight session refresh request, deduping"),await i;let a=this._refreshSession(t,e);this._cache.set(s,a);try{return await a}finally{this._cache.delete(s)}}async _refreshSession(e,t){let a=await this.session.getToken();if(!this.session.hasRefreshCredentials(a,e??null))throw this.logger.debug("[privy:refresh] missing tokens, skipping request"),await this._initialize(),new r.PrivyApiError({code:s.PrivyErrorCode.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage"});try{this.logger.debug(`[privy:refresh] fetching: ${i.RefreshSession.path}`);let s=await this.fetch(i.RefreshSession,{body:{refresh_token:e},onRequest:this.beforeRequestWithoutRefresh.bind(this)}),r=s.session_update_action;return this.logger.debug(`[privy:refresh] response: ${r}`),t||this.callbacks?.setUser?.(s.user),"set"===r&&(await this.session.updateWithTokensResponse(s),this.logger.debug("[privy:refresh] tokens stored")),"clear"===r&&(await this.session.destroyLocalState(),this.logger.debug("[privy:refresh] tokens cleared"),t||this.callbacks?.setUser?.(null)),"ignore"===r&&s.token&&(await this.session.storeToken(s.token),this.logger.debug("[privy:refresh] access token stored"),s.identity_token&&(this.logger.debug("[privy:refresh] identity token stored"),await this.session.storeIdentityToken(s.identity_token))),this.logger.debug("[privy:refresh] returning response"),s}catch(e){throw this.logger.debug(`[privy:refresh] error: ${e.message??"unknown error"}`),e instanceof r.PrivyApiError&&e.code===s.PrivyErrorCode.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),t||this.callbacks?.setUser?.(null)),e}}async getAccessToken(){let[e,t]=await Promise.all([this.session.getToken(),this.session.getRefreshToken()]);if(!this.session.tokenIsActive(e)&&this.session.hasRefreshCredentials(e,t)){let t=await this.refreshSession(),s=await this.session.getToken();return t.token||this.logger.debug("[privy:getAccessToken] expected token received null"),t.token===e&&this.logger.debug("[privy:getAccessToken] expected new token in response received existing"),s===e&&this.logger.debug("[privy:getAccessToken] expected new token in storage received existing"),t.token??s}return e}async getIdentityToken(){return await this.session.getIdentityToken()}async isStorageAccessible(){try{let e=`privy:__storage__test-${t.v4()}`,s="blobby";await this._storage.put(e,s);let i=await this._storage.get(e);return await this._storage.del(e),i===s}catch(e){return this.logger.error(e),!1}}constructor(e){this._sdkVersion="js-sdk-core:0.52.6",this._cache=new Map,this.logger=h.toConsoleLogger({level:e.logLevel??"ERROR"}),this._storage=e.storage,this._analyticsId=null,this._getOrGenerateClientAnalyticsId(),this.baseUrl=e.baseUrl??"https://auth.privy.io",this.appId=e.appId,this.appClientId=e.appClientId,this._sdkVersion=e.sdkVersion??this._sdkVersion,this.callbacks=e.callbacks,this.nativeAppIdentifier=e.nativeAppIdentifier,this.session=new a.Session({storage:this._storage,isUsingServerCookies:!1,appId:e.appId}),this._fetch=c.default(globalThis.fetch,{retries:3,retryDelay:e=>3**e*500,retryOn:[408,409,425,500,502,503,504]}),this.session.on("error_storing_tokens",(e=>{this.createAnalyticsEvent("error_updating_tokens_in_storage",{reason:e})}))}};
1
+ "use strict";var e=require("fetch-retry"),t=require("uuid"),s=require("@privy-io/api-base"),i=require("@privy-io/public-api"),r=require("../Error.js"),a=require("../Session.js"),n=require("../toAbortSignalTimeout.js"),o=require("../utils/toSearchParams.js"),h=require("./logger.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("eventemitter3"),require("jose"),require("js-cookie"),require("../Token.js"),require("../utils/allSettled.js"),require("../utils/noop.js");var c=/*#__PURE__*/l(e);let g="privy:caid";exports.PrivyInternal=class{setCallbacks(e){this.callbacks={...this.callbacks,...e}}get isReady(){return!!this._config}get config(){return this._config}get caid(){return this._analyticsId}async _initialize(){if(this.isReady)this.callbacks?.setIsReady?.(!0);else{if(!await this.isStorageAccessible())throw new r.PrivyClientError({code:"storage_error",error:"Unable to access storage"});this._config=await this.getAppConfig(),this._config?.custom_api_url&&(this.baseUrl=this._config.custom_api_url,this.session.isUsingServerCookies=!0),this.callbacks?.setIsReady?.(!0),this._sdkVersion.startsWith("react-auth:")||this.createAnalyticsEvent("sdk_initialize",{})}}getPath(e,{params:t,query:s}){return`${this.baseUrl}${i.getPathWithParams(e.path,t)}${o.toSearchParams(s)}`}async fetch(e,{body:t,params:s,query:i,headers:a,onRequest:n=this._beforeRequest.bind(this)}){let o=new Request(this.getPath(e,{params:s,query:i}),{method:e.method,body:JSON.stringify(t),headers:a}),h=await n(o),l=await this._fetch(o,h),c=await l.json();if(l.status>299)throw new r.PrivyApiError(c);return c}async _beforeRequestWithoutInitialize(e){let t=await this.session.getToken(),s=new Headers(e.headers);s.set("privy-app-id",this.appId),this.appClientId&&s.set("privy-client-id",this.appClientId),s.set("privy-client",this._sdkVersion),t&&s.set("Authorization",`Bearer ${t}`),s.set("Content-Type","application/json"),s.set("Accept","application/json");let i=await this._getOrGenerateClientAnalyticsId();return i&&s.set("privy-ca-id",i),this.nativeAppIdentifier&&s.set("x-native-app-identifier",this.nativeAppIdentifier),{signal:n.default(2e4),headers:s,credentials:"include"}}async beforeRequestWithoutRefresh(e){return await this._initialize(),this._beforeRequestWithoutInitialize(e)}async _beforeRequest(e){return await this._initialize(),await this.getAccessToken(),this.beforeRequestWithoutRefresh(e)}async getAppConfig(){return await this.fetch(i.AppConfig,{params:{app_id:this.appId},onRequest:this._beforeRequestWithoutInitialize.bind(this)})}async _getOrGenerateClientAnalyticsId(){if(this._analyticsId)return this._analyticsId;try{let e=await this._storage.get(g);if("string"==typeof e&&e.length>0)return this._analyticsId=e,e}catch(e){this.logger.error("Unable to load clientId",e)}try{this._analyticsId=t.v4()}catch(e){this.logger.error("Unable to generate uuidv4",e)}if(!this._analyticsId)return null;try{await this._storage.put(g,this._analyticsId)}catch(e){this.logger.error(`Unable to store clientId: ${this._analyticsId}`,e)}return this._analyticsId}async destroyClientAnalyticsId(){try{return await this._storage.del(g)}catch(e){this.logger.error("Unable to delete clientId",e)}}async createAnalyticsEvent(e,t){try{await this.fetch(i.AnalyticsEvent,{body:{event_name:e,client_id:await this._getOrGenerateClientAnalyticsId(),payload:t},onRequest:this.beforeRequestWithoutRefresh.bind(this)})}catch(e){}}async refreshSession(e=!1){if(!await this.isStorageAccessible())throw new r.PrivyClientError({code:"storage_error",error:"Unable to access storage"});let t=await this.session.getRefreshToken()??void 0,s=t??"key",i=this._cache.get(s);if(i)return this.logger.debug("[privy:refresh] found in-flight session refresh request, deduping"),await i;let a=this._refreshSession(t,e);this._cache.set(s,a);try{return await a}finally{this._cache.delete(s)}}async _refreshSession(e,t){let a=await this.session.getToken();if(!this.session.hasRefreshCredentials(a,e??null))throw this.logger.debug("[privy:refresh] missing tokens, skipping request"),await this._initialize(),new r.PrivyApiError({code:s.PrivyErrorCode.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage"});try{this.logger.debug(`[privy:refresh] fetching: ${i.RefreshSession.path}`);let s=await this.fetch(i.RefreshSession,{body:{refresh_token:e},onRequest:this.beforeRequestWithoutRefresh.bind(this)}),r=s.session_update_action;return this.logger.debug(`[privy:refresh] response: ${r}`),t||this.callbacks?.setUser?.(s.user),"set"===r&&(await this.session.updateWithTokensResponse(s),this.logger.debug("[privy:refresh] tokens stored")),"clear"===r&&(await this.session.destroyLocalState(),this.logger.debug("[privy:refresh] tokens cleared"),t||this.callbacks?.setUser?.(null)),"ignore"===r&&s.token&&(await this.session.storeToken(s.token),this.logger.debug("[privy:refresh] access token stored"),s.identity_token&&(this.logger.debug("[privy:refresh] identity token stored"),await this.session.storeIdentityToken(s.identity_token))),this.logger.debug("[privy:refresh] returning response"),s}catch(e){throw this.logger.debug(`[privy:refresh] error: ${e.message??"unknown error"}`),e instanceof r.PrivyApiError&&e.code===s.PrivyErrorCode.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),t||this.callbacks?.setUser?.(null)),e}}async getAccessToken(){let[e,t]=await Promise.all([this.session.getToken(),this.session.getRefreshToken()]);if(!this.session.tokenIsActive(e)&&this.session.hasRefreshCredentials(e,t)){let t=await this.refreshSession(),s=await this.session.getToken();return t.token||this.logger.debug("[privy:getAccessToken] expected token received null"),t.token===e&&this.logger.debug("[privy:getAccessToken] expected new token in response received existing"),s===e&&this.logger.debug("[privy:getAccessToken] expected new token in storage received existing"),t.token??s}return e}async getIdentityToken(){return await this.session.getIdentityToken()}async isStorageAccessible(){try{let e=`privy:__storage__test-${t.v4()}`,s="blobby";await this._storage.put(e,s);let i=await this._storage.get(e);return await this._storage.del(e),i===s}catch(e){return this.logger.error(e),!1}}constructor(e){this._sdkVersion="js-sdk-core:0.52.8",this._cache=new Map,this.logger=h.toConsoleLogger({level:e.logLevel??"ERROR"}),this._storage=e.storage,this._analyticsId=null,this._getOrGenerateClientAnalyticsId(),this.baseUrl=e.baseUrl??"https://auth.privy.io",this.appId=e.appId,this.appClientId=e.appClientId,this._sdkVersion=e.sdkVersion??this._sdkVersion,this.callbacks=e.callbacks,this.nativeAppIdentifier=e.nativeAppIdentifier,this.session=new a.Session({storage:this._storage,isUsingServerCookies:!1,appId:e.appId}),this._fetch=c.default(globalThis.fetch,{retries:3,retryDelay:e=>3**e*500,retryOn:[408,409,425,500,502,503,504]}),this.session.on("error_storing_tokens",(e=>{this.createAnalyticsEvent("error_updating_tokens_in_storage",{reason:e})}))}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),r=require("./CustomProviderApi.js"),t=require("./EmailApi.js"),i=require("./FarcasterApi.js"),s=require("./FarcasterV2Api.js"),a=require("./GuestApi.js"),l=require("./OAuthApi.js"),n=require("./PasskeyApi.js"),u=require("./PhoneApi.js"),o=require("./SiweApi.js"),d=require("./SiwsApi.js"),h=require("./SmartWalletApi.js");require("./maybeCreateWalletOnLogin.js"),require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js"),require("../../Error.js"),require("../../pkce.js"),require("jose");exports.default=class{async logout(){try{let r=await this._privyInternal.session.getRefreshToken()??void 0;await this._privyInternal.fetch(e.Logout,{body:{refresh_token:r}})}catch(e){console.warn("Error destroying session")}await Promise.all([this._privyInternal.session.destroyLocalState({reason:"logout"}),this._privyInternal.destroyClientAnalyticsId()]),this._privyInternal.callbacks?.setUser?.(null)}constructor(e,p,y,v){this._privyInternal=e,this.customProvider=new r.default(this._privyInternal,p),this.phone=new u.default(this._privyInternal,p),this.email=new t.default(this._privyInternal,p),this.oauth=new l.default(this._privyInternal,p,y,v),this.guest=new a.default(this._privyInternal,p),this.siwe=new o.default(this._privyInternal,p),this.siws=new d.default(this._privyInternal,p),this.smartWallet=new h.default(this._privyInternal),this.passkey=new n.default(this._privyInternal,p),this.farcaster=new i.default(this._privyInternal,p),this.farcasterV2=new s.default(this._privyInternal,p)}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),r=require("./CustomProviderApi.js"),t=require("./EmailApi.js"),s=require("./FarcasterApi.js"),i=require("./FarcasterV2Api.js"),l=require("./GuestApi.js"),a=require("./OAuthApi.js"),n=require("./PasskeyApi.js"),u=require("./PhoneApi.js"),d=require("./SiweApi.js"),o=require("./SiwsApi.js"),h=require("./SmartWalletApi.js");require("./maybeCreateWalletOnLogin.js"),require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js"),require("../../Error.js"),require("../../pkce.js"),require("jose");exports.default=class{async logout(){try{let r=await this._privyInternal.session.getRefreshToken()??void 0;await this._privyInternal.fetch(e.Logout,{body:{refresh_token:r}})}catch(e){console.warn("Error destroying session")}await Promise.all([this._privyInternal.session.destroyLocalState({reason:"logout"}),this._privyInternal.destroyClientAnalyticsId()]),this._privyInternal.callbacks?.setUser?.(null)}constructor(e,p,y,j){this._privyInternal=e,this.customProvider=new r.default(this._privyInternal,p),this.phone=new u.default(this._privyInternal,p),this.email=new t.default(this._privyInternal,p),this.oauth=new a.default(this._privyInternal,p,y,j),this.guest=new l.default(this._privyInternal,p),this.siwe=new d.default(this._privyInternal,p),this.siws=new o.default(this._privyInternal,p),this.smartWallet=new h.default(this._privyInternal),this.passkey=new n.default(this._privyInternal,p),this.farcaster=new s.default(this._privyInternal,p),this.farcasterV2=new i.default(this._privyInternal,p)}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async syncWithToken(s,r,l){let i=await this._privyInternal.fetch(e.CustomJWTAuthenticate,{body:{token:s,mode:l}});await this._privyInternal.session.updateWithTokensResponse(i);let a=await t.maybeCreateWalletOnLogin(this._embedded,i,r?.embedded);return this._privyInternal.callbacks?.setUser?.(a.user),a}constructor(e,t){this._privyInternal=e,this._embedded=t}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async syncWithToken(s,r,l){let i=await this._privyInternal.fetch(e.CustomJWTAuthenticate,{body:{token:s,mode:l}});await this._privyInternal.session.updateWithTokensResponse(i);let a=await t.maybeCreateWalletOnLogin(this._embedded,i,r?.embedded);return this._privyInternal.callbacks?.setUser?.(a.user),a}constructor(e,t){this._privyInternal=e,this._embedded=t}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async sendCode(t,s){return this._privyInternal.fetch(e.PasswordlessInit,{body:{email:t,token:s}})}async loginWithCode(s,r,i,a){let d=await this._privyInternal.fetch(e.PasswordlessAuthenticate,{body:{email:s,code:r,mode:i}});await this._privyInternal.session.updateWithTokensResponse(d);let l=await t.maybeCreateWalletOnLogin(this._embedded,d,a?.embedded);return this._privyInternal.callbacks?.setUser?.(l.user),l}async linkWithCode(t,s){await this._privyInternal.fetch(e.PasswordlessLink,{body:{email:t,code:s}});let r=await this._privyInternal.refreshSession();return{user:r.user,identity_token:r.identity_token}}async updateEmail({oldEmailAddress:t,newEmailAddress:s,code:r}){await this._privyInternal.fetch(e.PasswordlessUpdate,{body:{oldAddress:t,newAddress:s,code:r}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}async unlink(t){await this._privyInternal.fetch(e.PasswordlessUnlink,{body:{address:t}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async sendCode(t,s){return this._privyInternal.fetch(e.PasswordlessInit,{body:{email:t,token:s}})}async loginWithCode(s,r,i,a){let d=await this._privyInternal.fetch(e.PasswordlessAuthenticate,{body:{email:s,code:r,mode:i}});await this._privyInternal.session.updateWithTokensResponse(d);let l=await t.maybeCreateWalletOnLogin(this._embedded,d,a?.embedded);return this._privyInternal.callbacks?.setUser?.(l.user),l}async linkWithCode(t,s){await this._privyInternal.fetch(e.PasswordlessLink,{body:{email:t,code:s}});let r=await this._privyInternal.refreshSession();return{user:r.user,identity_token:r.identity_token}}async updateEmail({oldEmailAddress:t,newEmailAddress:s,code:r}){await this._privyInternal.fetch(e.PasswordlessUpdate,{body:{oldAddress:t,newAddress:s,code:r}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}async unlink(t){await this._privyInternal.fetch(e.PasswordlessUnlink,{body:{address:t}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async initializeAuth({relyingParty:t,redirectUrl:r,token:a}){return await this._privyInternal.fetch(e.FarcasterInit,{body:{relying_party:t,redirect_url:r,token:a}})}async getFarcasterStatus({channel_token:t}){return await this._privyInternal.fetch(e.FarcasterStatus,{headers:{"farcaster-channel-token":t}})}async authenticate({channel_token:r,message:a,signature:i,fid:s,mode:n},l){let d=await this._privyInternal.fetch(e.FarcasterAuthenticate,{body:{channel_token:r,message:a,signature:i,fid:s,mode:n}});await this._privyInternal.session.updateWithTokensResponse(d);let u=await t.maybeCreateWalletOnLogin(this._embedded,d,l?.embedded);return this._privyInternal.callbacks?.setUser?.(u.user),u}async link({channel_token:t,message:r,signature:a,fid:i}){await this._privyInternal.fetch(e.FarcasterLink,{body:{channel_token:t,message:r,signature:a,fid:i}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}async unlink({fid:t}){await this._privyInternal.fetch(e.FarcasterUnlink,{body:{fid:t}});let r=await this._privyInternal.refreshSession();return{user:r.user,identity_token:r.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async initializeAuth({relyingParty:t,redirectUrl:r,token:a}){return await this._privyInternal.fetch(e.FarcasterInit,{body:{relying_party:t,redirect_url:r,token:a}})}async getFarcasterStatus({channel_token:t}){return await this._privyInternal.fetch(e.FarcasterStatus,{headers:{"farcaster-channel-token":t}})}async authenticate({channel_token:r,message:a,signature:i,fid:s,mode:n},l){let d=await this._privyInternal.fetch(e.FarcasterAuthenticate,{body:{channel_token:r,message:a,signature:i,fid:s,mode:n}});await this._privyInternal.session.updateWithTokensResponse(d);let u=await t.maybeCreateWalletOnLogin(this._embedded,d,l?.embedded);return this._privyInternal.callbacks?.setUser?.(u.user),u}async link({channel_token:t,message:r,signature:a,fid:i}){await this._privyInternal.fetch(e.FarcasterLink,{body:{channel_token:t,message:r,signature:a,fid:i}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}async unlink({fid:t}){await this._privyInternal.fetch(e.FarcasterUnlink,{body:{fid:t}});let r=await this._privyInternal.refreshSession();return{user:r.user,identity_token:r.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async initializeAuth(){return await this._privyInternal.fetch(e.FarcasterV2Init,{body:{}})}async authenticate({message:r,signature:s,fid:a},i){let l=await this._privyInternal.fetch(e.FarcasterV2Authenticate,{body:{message:r,signature:s,fid:a}});await this._privyInternal.session.updateWithTokensResponse(l);let d=await t.maybeCreateWalletOnLogin(this._embedded,l,i?.embedded);return this._privyInternal.callbacks?.setUser?.(d.user),d}constructor(e,t){this._privyInternal=e,this._embedded=t}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async initializeAuth(){return await this._privyInternal.fetch(e.FarcasterV2Init,{body:{}})}async authenticate({message:r,signature:s,fid:a},i){let l=await this._privyInternal.fetch(e.FarcasterV2Authenticate,{body:{message:r,signature:s,fid:a}});await this._privyInternal.session.updateWithTokensResponse(l);let d=await t.maybeCreateWalletOnLogin(this._embedded,l,i?.embedded);return this._privyInternal.callbacks?.setUser?.(d.user),d}constructor(e,t){this._privyInternal=e,this._embedded=t}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async create(r){let s=await this._privyInternal.session.getOrCreateGuestCredential(),l=await this._privyInternal.fetch(e.GuestAuthenticate,{body:{guest_credential:s}});await this._privyInternal.session.updateWithTokensResponse(l);let a=await t.maybeCreateWalletOnLogin(this._embedded,l,r?.embedded);return this._privyInternal.callbacks?.setUser?.(a.user),a}constructor(e,t){this._privyInternal=e,this._embedded=t}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async create(r){let s=await this._privyInternal.session.getOrCreateGuestCredential(),l=await this._privyInternal.fetch(e.GuestAuthenticate,{body:{guest_credential:s}});await this._privyInternal.session.updateWithTokensResponse(l);let a=await t.maybeCreateWalletOnLogin(this._embedded,l,r?.embedded);return this._privyInternal.callbacks?.setUser?.(a.user),a}constructor(e,t){this._privyInternal=e,this._embedded=t}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("../../Error.js"),r=require("../../pkce.js"),i=require("./maybeCreateWalletOnLogin.js");require("jose"),require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async generateURL(t,i){let s=r.createCodeVerifier(),a=r.createStateCode(),o=await r.deriveCodeChallengeFromCodeVerifier({codeVerifier:s,digest:this._crypto?.digest});return await Promise.all([this._storage.put(r.CODE_VERIFIER_KEY,s),this._storage.put(r.STATE_CODE_KEY,a)]),this._privyInternal.fetch(e.OAuthInit,{body:{redirect_to:i,provider:t,code_challenge:o,state_code:a}})}async loginWithCode(s,a,o,l,n,d){let[_,h]=await Promise.all([this._storage.get(r.CODE_VERIFIER_KEY),this._storage.get(r.STATE_CODE_KEY)]);if(h!==a)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:o,storedStateCode:h??"",returnedStateCode:a??""}),new t.PrivyClientError({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let u=await this._privyInternal.fetch(e.OAuthAuthenticate,{body:{authorization_code:s,code_type:l,state_code:h,code_verifier:_,mode:n}});await this._privyInternal.session.updateWithTokensResponse(u);let c=await i.maybeCreateWalletOnLogin(this._embedded,u,d?.embedded);return await Promise.all([this._storage.del(r.CODE_VERIFIER_KEY),this._storage.del(r.STATE_CODE_KEY)]),this._privyInternal.callbacks?.setUser?.(c.user),c}async linkWithCode(i,s,a,o){let[l,n]=await Promise.all([this._storage.get(r.CODE_VERIFIER_KEY),this._storage.get(r.STATE_CODE_KEY)]);if(n!==s)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:a,storedStateCode:n??"",returnedStateCode:s??""}),new t.PrivyClientError({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let d=await this._privyInternal.fetch(e.OAuthLink,{body:{authorization_code:i,code_type:o,state_code:n,code_verifier:l}});await this._privyInternal.session.processOAuthTokens(d.oauth_tokens);let _=await this._privyInternal.refreshSession();return await Promise.all([this._storage.del(r.CODE_VERIFIER_KEY),this._storage.del(r.STATE_CODE_KEY)]),{user:_.user,identity_token:_.identity_token}}async unlink(t,r){await this._privyInternal.fetch(e.OAuthUnlink,{body:{provider:t,subject:r}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}constructor(e,t,r,i){this._privyInternal=e,this._embedded=t,this._storage=r,this._crypto=i}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("../../Error.js"),r=require("../../pkce.js"),i=require("./maybeCreateWalletOnLogin.js");require("jose"),require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async generateURL(t,i){let s=r.createCodeVerifier(),a=r.createStateCode(),o=await r.deriveCodeChallengeFromCodeVerifier({codeVerifier:s,digest:this._crypto?.digest});return await Promise.all([this._storage.put(r.CODE_VERIFIER_KEY,s),this._storage.put(r.STATE_CODE_KEY,a)]),this._privyInternal.fetch(e.OAuthInit,{body:{redirect_to:i,provider:t,code_challenge:o,state_code:a}})}async loginWithCode(s,a,o,l,d,n){let[_,h]=await Promise.all([this._storage.get(r.CODE_VERIFIER_KEY),this._storage.get(r.STATE_CODE_KEY)]);if(h!==a)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:o,storedStateCode:h??"",returnedStateCode:a??""}),new t.PrivyClientError({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let u=await this._privyInternal.fetch(e.OAuthAuthenticate,{body:{authorization_code:s,code_type:l,state_code:h,code_verifier:_,mode:d}});await this._privyInternal.session.updateWithTokensResponse(u);let c=await i.maybeCreateWalletOnLogin(this._embedded,u,n?.embedded);return await Promise.all([this._storage.del(r.CODE_VERIFIER_KEY),this._storage.del(r.STATE_CODE_KEY)]),this._privyInternal.callbacks?.setUser?.(c.user),c}async linkWithCode(i,s,a,o){let[l,d]=await Promise.all([this._storage.get(r.CODE_VERIFIER_KEY),this._storage.get(r.STATE_CODE_KEY)]);if(d!==s)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:a,storedStateCode:d??"",returnedStateCode:s??""}),new t.PrivyClientError({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let n=await this._privyInternal.fetch(e.OAuthLink,{body:{authorization_code:i,code_type:o,state_code:d,code_verifier:l}});await this._privyInternal.session.processOAuthTokens(n.oauth_tokens);let _=await this._privyInternal.refreshSession();return await Promise.all([this._storage.del(r.CODE_VERIFIER_KEY),this._storage.del(r.STATE_CODE_KEY)]),{user:_.user,identity_token:_.identity_token}}async unlink(t,r){await this._privyInternal.fetch(e.OAuthUnlink,{body:{provider:t,subject:r}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}constructor(e,t,r,i){this._privyInternal=e,this._embedded=t,this._storage=r,this._crypto=i}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async generateRegistrationOptions(t){return await this._privyInternal.fetch(e.PasskeyLinkInit,{body:{relying_party:t}})}async generateAuthenticationOptions(t){return await this._privyInternal.fetch(e.PasskeyAuthenticateInit,{body:{relying_party:t}})}async generateSignupOptions(t){return await this._privyInternal.fetch(e.PasskeyRegisterInit,{body:{relying_party:t}})}async loginWithPasskey(s,a,i,n){let r=await this._privyInternal.fetch(e.PasskeyAuthenticate,{body:{relying_party:i,challenge:a,authenticator_response:this._transformAuthenticationResponseToSnakeCase(s)}});await this._privyInternal.session.updateWithTokensResponse(r);let o=await t.maybeCreateWalletOnLogin(this._embedded,r,n?.embedded);return this._privyInternal.callbacks?.setUser?.(o.user),o}async signupWithPasskey(s,a,i){let n=await this._privyInternal.fetch(e.PasskeyRegister,{body:{relying_party:a,authenticator_response:this._transformRegistrationResponseToSnakeCase(s)}});await this._privyInternal.session.updateWithTokensResponse(n);let r=await t.maybeCreateWalletOnLogin(this._embedded,n,i?.embedded);return this._privyInternal.callbacks?.setUser?.(r.user),r}async linkWithPasskey(t,s){await this._privyInternal.fetch(e.PasskeyLink,{body:{relying_party:s,authenticator_response:this._transformRegistrationResponseToSnakeCase(t)}});let a=await this._privyInternal.refreshSession();return{user:a.user,identity_token:a.identity_token}}_transformRegistrationResponseToSnakeCase(e){return{type:e.type,id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,attestation_object:e.response.attestationObject,authenticator_data:e.response.authenticatorData||void 0,transports:e.response.transports||void 0,public_key:e.response.publicKey||void 0,public_key_algorithm:e.response.publicKeyAlgorithm||void 0},authenticator_attachment:e.authenticatorAttachment||void 0,client_extension_results:{app_id:e.clientExtensionResults.appid||void 0,cred_props:e.clientExtensionResults.credProps||void 0,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret||void 0}}}_transformAuthenticationResponseToSnakeCase(e){return{type:e.type,id:e.id,raw_id:e.rawId,response:{signature:e.response.signature,client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,user_handle:e.response.userHandle||void 0},authenticator_attachment:e.authenticatorAttachment||void 0,client_extension_results:{app_id:e.clientExtensionResults.appid||void 0,cred_props:e.clientExtensionResults.credProps||void 0,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret||void 0}}}constructor(e,t){this._privyInternal=e,this._embedded=t}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async generateRegistrationOptions(t){return await this._privyInternal.fetch(e.PasskeyLinkInit,{body:{relying_party:t}})}async generateAuthenticationOptions(t){return await this._privyInternal.fetch(e.PasskeyAuthenticateInit,{body:{relying_party:t}})}async generateSignupOptions(t){return await this._privyInternal.fetch(e.PasskeyRegisterInit,{body:{relying_party:t}})}async loginWithPasskey(s,a,i,n){let r=await this._privyInternal.fetch(e.PasskeyAuthenticate,{body:{relying_party:i,challenge:a,authenticator_response:this._transformAuthenticationResponseToSnakeCase(s)}});await this._privyInternal.session.updateWithTokensResponse(r);let o=await t.maybeCreateWalletOnLogin(this._embedded,r,n?.embedded);return this._privyInternal.callbacks?.setUser?.(o.user),o}async signupWithPasskey(s,a,i){let n=await this._privyInternal.fetch(e.PasskeyRegister,{body:{relying_party:a,authenticator_response:this._transformRegistrationResponseToSnakeCase(s)}});await this._privyInternal.session.updateWithTokensResponse(n);let r=await t.maybeCreateWalletOnLogin(this._embedded,n,i?.embedded);return this._privyInternal.callbacks?.setUser?.(r.user),r}async linkWithPasskey(t,s){await this._privyInternal.fetch(e.PasskeyLink,{body:{relying_party:s,authenticator_response:this._transformRegistrationResponseToSnakeCase(t)}});let a=await this._privyInternal.refreshSession();return{user:a.user,identity_token:a.identity_token}}_transformRegistrationResponseToSnakeCase(e){return{type:e.type,id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,attestation_object:e.response.attestationObject,authenticator_data:e.response.authenticatorData||void 0,transports:e.response.transports||void 0,public_key:e.response.publicKey||void 0,public_key_algorithm:e.response.publicKeyAlgorithm||void 0},authenticator_attachment:e.authenticatorAttachment||void 0,client_extension_results:{app_id:e.clientExtensionResults.appid||void 0,cred_props:e.clientExtensionResults.credProps||void 0,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret||void 0}}}_transformAuthenticationResponseToSnakeCase(e){return{type:e.type,id:e.id,raw_id:e.rawId,response:{signature:e.response.signature,client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,user_handle:e.response.userHandle||void 0},authenticator_attachment:e.authenticatorAttachment||void 0,client_extension_results:{app_id:e.clientExtensionResults.appid||void 0,cred_props:e.clientExtensionResults.credProps||void 0,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret||void 0}}}constructor(e,t){this._privyInternal=e,this._embedded=t}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async sendCode(t,s){return this._privyInternal.fetch(e.PasswordlessSmsInit,{body:{phoneNumber:t,token:s}})}async loginWithCode(s,r,n,i){let a=await this._privyInternal.fetch(e.PasswordlessSmsAuthenticate,{body:{phoneNumber:s,code:r,mode:n}});await this._privyInternal.session.updateWithTokensResponse(a);let l=await t.maybeCreateWalletOnLogin(this._embedded,a,i?.embedded);return this._privyInternal.callbacks?.setUser?.(l.user),l}async linkWithCode(t,s){await this._privyInternal.fetch(e.PasswordlessSmsLink,{body:{phoneNumber:t,code:s}});let r=await this._privyInternal.refreshSession();return{user:r.user,identity_token:r.identity_token}}async updatePhone({oldPhoneNumber:t,newPhoneNumber:s,code:r}){await this._privyInternal.fetch(e.PasswordlessSmsUpdate,{body:{old_phone_number:t,new_phone_number:s,code:r}});let n=await this._privyInternal.refreshSession();return{user:n.user,identity_token:n.identity_token}}async unlink(t){await this._privyInternal.fetch(e.PasswordlessSmsUnlink,{body:{phoneNumber:t}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async sendCode(t,s){return this._privyInternal.fetch(e.PasswordlessSmsInit,{body:{phoneNumber:t,token:s}})}async loginWithCode(s,r,i,n){let a=await this._privyInternal.fetch(e.PasswordlessSmsAuthenticate,{body:{phoneNumber:s,code:r,mode:i}});await this._privyInternal.session.updateWithTokensResponse(a);let l=await t.maybeCreateWalletOnLogin(this._embedded,a,n?.embedded);return this._privyInternal.callbacks?.setUser?.(l.user),l}async linkWithCode(t,s){await this._privyInternal.fetch(e.PasswordlessSmsLink,{body:{phoneNumber:t,code:s}});let r=await this._privyInternal.refreshSession();return{user:r.user,identity_token:r.identity_token}}async updatePhone({oldPhoneNumber:t,newPhoneNumber:s,code:r}){await this._privyInternal.fetch(e.PasswordlessSmsUpdate,{body:{old_phone_number:t,new_phone_number:s,code:r}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}async unlink(t){await this._privyInternal.fetch(e.PasswordlessSmsUnlink,{body:{phoneNumber:t}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async unlinkWallet(t){await this._privyInternal.fetch(e.SiweUnlink,{body:{address:t}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}async linkWithSiwe(t,i,n){let s=i||this._wallet,r=n||this._preparedMessage;if(!s)throw Error("A wallet must be provided in the init step or as an argument to linkWithSiwe");if(!r)throw Error("A message must be generated and signed before being used to link a wallet to privy");await this._privyInternal.fetch(e.SiweLink,{body:{message:r,signature:t,chainId:s.chainId,walletClientType:s.walletClientType,connectorType:s.connectorType}});let a=await this._privyInternal.refreshSession();return{user:a.user,identity_token:a.identity_token}}async loginWithSiwe(i,n,s,r,a){let l=n||this._wallet,o=s||this._preparedMessage;if(!l)throw Error("A wallet must be provided in the init step or as an argument to loginWithSiwe");if(!o)throw Error("A message must be generated and signed before being used to login to privy with a wallet");let d=await this._privyInternal.fetch(e.SiweAuthenticate,{body:{signature:i,message:o,chainId:l.chainId,walletClientType:l.walletClientType,connectorType:l.connectorType,mode:r}});await this._privyInternal.session.updateWithTokensResponse(d);let u=await t.maybeCreateWalletOnLogin(this._embedded,d,a?.embedded);return this._privyInternal.callbacks?.setUser?.(u.user),u}async init(t,i,n){var s;this._wallet=t;let{nonce:r}=await this._privyInternal.fetch(e.SiweInit,{body:{address:t.address}}),a=`${(s={chainId:t.chainId.toString().replace("eip155:",""),address:t.address,issuedAt:(new Date).toISOString(),statement:"By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",domain:i,nonce:r,uri:n}).domain} wants you to sign in with your Ethereum account:\n${s.address}\n\n${s.statement}\n\nURI: ${s.uri}\nVersion: 1\nChain ID: ${s.chainId}\nNonce: ${s.nonce}\nIssued At: ${s.issuedAt}\nResources:\n- https://privy.io`;return this._preparedMessage=a,{nonce:r,message:a}}constructor(e,t){this._wallet=void 0,this._privyInternal=e,this._embedded=t}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async unlinkWallet(t){await this._privyInternal.fetch(e.SiweUnlink,{body:{address:t}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}async linkWithSiwe(t,i,n){let s=i||this._wallet,r=n||this._preparedMessage;if(!s)throw Error("A wallet must be provided in the init step or as an argument to linkWithSiwe");if(!r)throw Error("A message must be generated and signed before being used to link a wallet to privy");await this._privyInternal.fetch(e.SiweLink,{body:{message:r,signature:t,chainId:s.chainId,walletClientType:s.walletClientType,connectorType:s.connectorType}});let a=await this._privyInternal.refreshSession();return{user:a.user,identity_token:a.identity_token}}async loginWithSiwe(i,n,s,r,a){let l=n||this._wallet,d=s||this._preparedMessage;if(!l)throw Error("A wallet must be provided in the init step or as an argument to loginWithSiwe");if(!d)throw Error("A message must be generated and signed before being used to login to privy with a wallet");let o=await this._privyInternal.fetch(e.SiweAuthenticate,{body:{signature:i,message:d,chainId:l.chainId,walletClientType:l.walletClientType,connectorType:l.connectorType,mode:r}});await this._privyInternal.session.updateWithTokensResponse(o);let u=await t.maybeCreateWalletOnLogin(this._embedded,o,a?.embedded);return this._privyInternal.callbacks?.setUser?.(u.user),u}async init(t,i,n){var s;this._wallet=t;let{nonce:r}=await this._privyInternal.fetch(e.SiweInit,{body:{address:t.address}}),a=`${(s={chainId:t.chainId.toString().replace("eip155:",""),address:t.address,issuedAt:(new Date).toISOString(),statement:"By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",domain:i,nonce:r,uri:n}).domain} wants you to sign in with your Ethereum account:\n${s.address}\n\n${s.statement}\n\nURI: ${s.uri}\nVersion: 1\nChain ID: ${s.chainId}\nNonce: ${s.nonce}\nIssued At: ${s.issuedAt}\nResources:\n- https://privy.io`;return this._preparedMessage=a,{nonce:r,message:a}}constructor(e,t){this._wallet=void 0,this._privyInternal=e,this._embedded=t}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async unlink({address:t}){await this._privyInternal.fetch(e.SiwsUnlink,{body:{address:t}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}async link({message:t,signature:s,walletClientType:r,connectorType:i}){await this._privyInternal.fetch(e.SiwsLink,{body:{message:t,signature:s,walletClientType:r,connectorType:i}});let n=await this._privyInternal.refreshSession();return{user:n.user,identity_token:n.identity_token}}async login({mode:s,message:r,signature:i,walletClientType:n,connectorType:a,opts:l}){let d=await this._privyInternal.fetch(e.SiwsAuthenticate,{body:{signature:i,message:r,walletClientType:n,connectorType:a,mode:s}});await this._privyInternal.session.updateWithTokensResponse(d);let o=await t.maybeCreateWalletOnLogin(this._embedded,d,l?.embedded);return this._privyInternal.callbacks?.setUser?.(o.user),o}async fetchNonce({address:t}){let{nonce:s}=await this._privyInternal.fetch(e.SiwsInit,{body:{address:t}});return{nonce:s}}constructor(e,t){this._privyInternal=e,this._embedded=t}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),t=require("./maybeCreateWalletOnLogin.js");require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async unlink({address:t}){await this._privyInternal.fetch(e.SiwsUnlink,{body:{address:t}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}async link({message:t,signature:s,walletClientType:r,connectorType:i}){await this._privyInternal.fetch(e.SiwsLink,{body:{message:t,signature:s,walletClientType:r,connectorType:i}});let n=await this._privyInternal.refreshSession();return{user:n.user,identity_token:n.identity_token}}async login({mode:s,message:r,signature:i,walletClientType:n,connectorType:a,opts:l}){let d=await this._privyInternal.fetch(e.SiwsAuthenticate,{body:{signature:i,message:r,walletClientType:n,connectorType:a,mode:s}});await this._privyInternal.session.updateWithTokensResponse(d);let o=await t.maybeCreateWalletOnLogin(this._embedded,d,l?.embedded);return this._privyInternal.callbacks?.setUser?.(o.user),o}async fetchNonce({address:t}){let{nonce:s}=await this._privyInternal.fetch(e.SiwsInit,{body:{address:t}});return{nonce:s}}constructor(e,t){this._privyInternal=e,this._embedded=t}};
@@ -1 +1 @@
1
- "use strict";var e=require("../../utils/getUserEmbeddedEthereumWallet.js"),t=require("../../utils/getUserEmbeddedSolanaWallet.js"),r=require("../../utils/shouldCreateEmbeddedEthWallet.js"),a=require("../../utils/shouldCreateEmbeddedSolWallet.js");require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js");exports.maybeCreateWalletOnLogin=async(s,l,u)=>{let d=r.shouldCreateEmbeddedEthWallet(l.user,u?.ethereum?.createOnLogin??"off"),o=a.shouldCreateEmbeddedSolWallet(l.user,u?.solana?.createOnLogin??"off");if(d&&o){let t=await s.create({recoveryMethod:"privy",skipCallbacks:!0});return{...await s.createSolana({ethereumAccount:e.getUserEmbeddedEthereumWallet(t.user)??void 0}),is_new_user:l.is_new_user,oauth_tokens:l.oauth_tokens}}return d?{...await s.create({recoveryMethod:"privy",solanaAccount:t.getUserEmbeddedSolanaWallet(l.user)??void 0}),is_new_user:l.is_new_user,oauth_tokens:l.oauth_tokens}:o?{...await s.createSolana({ethereumAccount:e.getUserEmbeddedEthereumWallet(l.user)??void 0}),is_new_user:l.is_new_user,oauth_tokens:l.oauth_tokens}:l};
1
+ "use strict";var e=require("../../utils/getUserEmbeddedEthereumWallet.js"),t=require("../../utils/getUserEmbeddedSolanaWallet.js"),r=require("../../utils/shouldCreateEmbeddedEthWallet.js"),s=require("../../utils/shouldCreateEmbeddedSolWallet.js");require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js");exports.maybeCreateWalletOnLogin=async(a,l,u)=>{let d=r.shouldCreateEmbeddedEthWallet(l.user,u?.ethereum?.createOnLogin??"off"),o=s.shouldCreateEmbeddedSolWallet(l.user,u?.solana?.createOnLogin??"off");if(d&&o){let t=await a.create({recoveryMethod:"privy",skipCallbacks:!0});return{...await a.createSolana({ethereumAccount:e.getUserEmbeddedEthereumWallet(t.user)??void 0}),is_new_user:l.is_new_user,oauth_tokens:l.oauth_tokens}}return d?{...await a.create({recoveryMethod:"privy",solanaAccount:t.getUserEmbeddedSolanaWallet(l.user)??void 0}),is_new_user:l.is_new_user,oauth_tokens:l.oauth_tokens}:o?{...await a.createSolana({ethereumAccount:e.getUserEmbeddedEthereumWallet(l.user)??void 0}),is_new_user:l.is_new_user,oauth_tokens:l.oauth_tokens}:l};
@@ -1 +1 @@
1
- "use strict";var e=require("../Error.js");exports.EmbeddedBitcoinWalletProvider=class{async sign({message:e}){return await this.request({method:"sign",params:{message:new TextDecoder("utf8").decode(e)}})}async signTransaction({psbt:e}){return await this.request({method:"signTransaction",params:{psbt:e}})}async request(r){if(!await this._privyInternal.getAccessToken())throw new e.PrivyClientError({error:"Missing access token",code:"attempted_rpc_call_before_logged_in"});return this.handleIFrameRpc(r)}async handleIFrameRpc(r){try{let e=await this._privyInternal.getAccessToken();if(!e)throw Error("Missing access token. User must be authenticated.");return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:r.method,address:this._account.address}),(await this._proxy.rpcWallet({accessToken:e,request:r,entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,hdWalletIndex:this._account.wallet_index,chainType:this._account.chain_type})).response.data}catch(t){console.error(t);let s=t instanceof Error?t.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:r.method,address:this._account.address,error:s}),new e.PrivyClientError({code:"embedded_wallet_request_error",error:s})}}toJSON(){return`PrivyEmbeddedBitcoinProvider { address: '${this._account.address}', request: [Function] }`}constructor({proxy:e,privyInternal:r,account:t,entropyId:s,entropyIdVerifier:a}){this._proxy=e,this._privyInternal=r,this._account=t,this._entropyId=s,this._entropyIdVerifier=a}};
1
+ "use strict";var e=require("../Error.js"),t=require("../wallet-api/unified-wallet.js");exports.EmbeddedBitcoinWalletProvider=class{async sign({message:e}){return await this.request({method:"sign",params:{message:new TextDecoder("utf8").decode(e)}})}async signTransaction({psbt:e}){return await this.request({method:"signTransaction",params:{psbt:e}})}async request(r){if(t.isUnifiedWallet(this._account))throw new e.PrivyClientError({code:"unsupported_wallet_type",error:"Bitcoin wallet providers are only supported for on-device execution and this app uses TEE execution. Use the useSignRawHash hook from @privy-io/expo/extended-chains to sign over a hash with this wallet. Learn more at https://docs.privy.io/recipes/tee-wallet-migration-guide"});if(!await this._privyInternal.getAccessToken())throw new e.PrivyClientError({error:"Missing access token",code:"attempted_rpc_call_before_logged_in"});return this.handleIFrameRpc(r)}async handleIFrameRpc(t){try{let e=await this._privyInternal.getAccessToken();if(!e)throw Error("Missing access token. User must be authenticated.");return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:t.method,address:this._account.address}),(await this._proxy.rpcWallet({accessToken:e,request:t,entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,hdWalletIndex:this._account.wallet_index,chainType:this._account.chain_type})).response.data}catch(r){console.error(r);let s=r instanceof Error?r.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:t.method,address:this._account.address,error:s}),new e.PrivyClientError({code:"embedded_wallet_request_error",error:s})}}toJSON(){return`PrivyEmbeddedBitcoinProvider { address: '${this._account.address}', request: [Function] }`}constructor({proxy:e,privyInternal:t,account:r,entropyId:s,entropyIdVerifier:i}){this._proxy=e,this._privyInternal=t,this._account=r,this._entropyId=s,this._entropyIdVerifier=i}};
@@ -1 +1 @@
1
- "use strict";var e=require("../../action/delegatedActions/utils.js"),t=require("../../wallet-api/get-wallet.js"),r=require("../../wallet-api/unified-wallet.js"),i=require("../../wallet-api/update-wallet.js");async function a(e){let{user:t}=await e.user.get();if(!t)throw Error("Could not refresh user");return{user:t}}function l(e){return(...t)=>e.embeddedWallet.signWithUserSigner(...t)}require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("@privy-io/public-api"),require("../../wallet-api/generate-authorization-signature.js"),require("canonicalize"),require("../../Error.js"),exports.addSessionSigners=async function({client:s,wallet:n,signers:d}){if("ethereum"!==n.chain_type&&"solana"!==n.chain_type)throw Error("Session signers are only supported for Ethereum and Solana wallets");if(r.isUnifiedWallet(n)){if(0===d.length)throw Error("Must specify at least one signer to add.");let e={wallet_id:n.id},r=await t.getWallet(s,e);await i.updateWallet(s,e,l(s),{additional_signers:r.additional_signers.concat(d)})}else{if(n.delegated)return a(s);if(d.length>0)throw Error("Specifying signers in addSessionSigners is only supported for TEE execution and this app uses On-device execution. Pass an empty array for signers instead. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");let{user:t}=await s.user.get(),r=e.getRootWalletForDelegation(n,t);if(!r)throw Error("Unable to determine root address for delegated address.");await s.embeddedWallet.delegateWallets({rootWallet:{address:r.address,chainType:r.chain_type,imported:r.imported},delegatedWallets:[{address:n.address,chainType:n.chain_type,walletIndex:n.wallet_index}]})}return a(s)},exports.removeSessionSigners=async function({client:e,wallet:t}){if(r.isUnifiedWallet(t)){let r={wallet_id:t.id};await i.updateWallet(e,r,l(e),{additional_signers:[]})}else await e.delegated.revoke();return a(e)};
1
+ "use strict";var e=require("../../action/delegatedActions/utils.js"),t=require("../../wallet-api/get-wallet.js"),r=require("../../wallet-api/unified-wallet.js"),i=require("../../wallet-api/update-wallet.js");async function a(e){let{user:t}=await e.user.get();if(!t)throw Error("Could not refresh user");return{user:t}}function l(e){return(...t)=>e.embeddedWallet.signWithUserSigner(...t)}require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("@privy-io/public-api"),require("../../wallet-api/generate-authorization-signature.js"),require("canonicalize"),require("../../Error.js"),exports.addSessionSigners=async function({client:s,wallet:n,signers:d}){if("ethereum"!==n.chain_type&&"solana"!==n.chain_type)throw Error("Session signers are only supported for Ethereum and Solana wallets");if(r.isUnifiedWallet(n)){if(0===d.length)throw Error("Must specify at least one signer to add.");let e={wallet_id:n.id},r=await t.getWallet(s,e);await i.updateWallet(s,e,l(s),{additional_signers:r.additional_signers.concat(d)})}else{if(n.delegated)return a(s);if(d.length>0)throw Error("Specifying signers in addSessionSigners is only supported for TEE execution and this app uses On-device execution. Pass an empty array for signers instead. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");let{user:t}=await s.user.get(),r=e.getRootWalletForDelegation(n,t);if(!r)throw Error("Unable to determine root address for delegated address.");await s.embeddedWallet.delegateWallets({rootWallet:{address:r.address,chainType:r.chain_type,imported:r.imported},delegatedWallets:[{address:n.address,chainType:n.chain_type,walletIndex:n.wallet_index}]})}return a(s)},exports.removeSessionSigners=async function({client:e,wallet:t}){if(r.isUnifiedWallet(t)){let r={wallet_id:t.id};await i.updateWallet(e,r,l(e),{additional_signers:[]})}else await e.delegated.revoke();return a(e)};
@@ -1 +1 @@
1
- "use strict";var e=require("permissionless"),t=require("permissionless/accounts"),r=require("permissionless/clients/pimlico"),n=require("viem"),a=require("viem/account-abstraction"),i=require("@privy-io/public-api");let o={address:a.entryPoint06Address,version:"0.6"},s={address:a.entryPoint07Address,version:"0.7"},c=({owner:e,smartWalletType:r,publicClient:n})=>{switch(r){case i.SAFE:return t.toSafeSmartAccount({client:n,entryPoint:s,owners:[e],version:"1.4.1"});case i.KERNEL:return t.toKernelSmartAccount({client:n,version:"0.3.1",entryPoint:s,useMetaFactory:"optional",owners:[e]});case i.BICONOMY:return t.toBiconomySmartAccount({client:n,owners:[e],entryPoint:o});case i.LIGHT_ACCOUNT:return t.toLightSmartAccount({client:n,entryPoint:o,owner:e,version:"1.1.0"});case i.COINBASE_SMART_WALLET:return async function({client:e,owner:t}){let[r]=await t.request({method:"eth_accounts"});if(!r)throw Error("Unable to request embedded owner for eth_accounts");return await a.toCoinbaseSmartAccount({client:e,owners:[{type:"local",source:"privy",address:r,sign:async({hash:e})=>await t.request({method:"secp256k1_sign",params:[e]})}]})}({client:n,owner:e});case i.THIRDWEB:return t.toThirdwebSmartAccount({client:n,entryPoint:s,owner:e});default:throw Error(`Invalid smart account type: ${r}.`)}};exports.signerToSmartAccountClient=async({owner:t,smartWalletType:a,chain:i,publicClient:o,bundlerUrl:s,paymasterUrl:l,paymasterContext:u})=>{let m=await c({owner:t,smartWalletType:a,publicClient:o}),p=r.createPimlicoClient({transport:n.http(s),entryPoint:m.entryPoint}),y=l?r.createPimlicoClient({transport:n.http(l),entryPoint:m.entryPoint}):void 0;return e.createSmartAccountClient({account:m,chain:i,paymaster:y,paymasterContext:u,bundlerTransport:n.http(s),userOperation:{estimateFeesPerGas:async()=>{if(["public.pimlico.io","api.pimlico.io"].some((e=>s.includes(e))))return await p.getUserOperationGasPrice().then((e=>e.fast));if(["rpc.zerodev.app"].some((e=>s.includes(e))))return(await p.request({method:"zd_getUserOperationGasPrice",params:[]})).fast;if(["g.alchemy.com"].some((e=>s.includes(e)))){let[e,t]=await Promise.all([o.getBlock({blockTag:"latest"}),p.request({method:"rundler_maxPriorityFeePerGas",params:[]})]);if(!e.baseFeePerGas||!t)throw Error("Failed to get block or maxPriorityFeePerGasEstimate");return{maxFeePerGas:150n*e.baseFeePerGas/100n+BigInt(t.toString()),maxPriorityFeePerGas:BigInt(t.toString())}}{let e=await o.estimateFeesPerGas(),t=s.includes("api.developer.coinbase.com")?175n:150n;return{...e,maxFeePerGas:e.maxFeePerGas*t/100n,maxPriorityFeePerGas:e.maxPriorityFeePerGas*t/100n}}}}})};
1
+ "use strict";var e=require("permissionless"),t=require("permissionless/accounts"),r=require("permissionless/clients/pimlico"),n=require("viem"),i=require("viem/account-abstraction"),a=require("@privy-io/public-api");let o={address:i.entryPoint06Address,version:"0.6"},s={address:i.entryPoint07Address,version:"0.7"},c=({owner:e,smartWalletType:r,publicClient:n})=>{switch(r){case a.SAFE:return t.toSafeSmartAccount({client:n,entryPoint:s,owners:[e],version:"1.4.1"});case a.KERNEL:return t.toKernelSmartAccount({client:n,version:"0.3.1",entryPoint:s,useMetaFactory:"optional",owners:[e]});case a.BICONOMY:return t.toBiconomySmartAccount({client:n,owners:[e],entryPoint:o});case a.LIGHT_ACCOUNT:return t.toLightSmartAccount({client:n,entryPoint:o,owner:e,version:"1.1.0"});case a.COINBASE_SMART_WALLET:return async function({client:e,owner:t}){let[r]=await t.request({method:"eth_accounts"});if(!r)throw Error("Unable to request embedded owner for eth_accounts");return await i.toCoinbaseSmartAccount({client:e,version:"1",owners:[{type:"local",source:"privy",address:r,sign:async({hash:e})=>await t.request({method:"secp256k1_sign",params:[e]})}]})}({client:n,owner:e});case a.THIRDWEB:return t.toThirdwebSmartAccount({client:n,entryPoint:s,owner:e});default:throw Error(`Invalid smart account type: ${r}.`)}};exports.signerToSmartAccountClient=async({owner:t,smartWalletType:i,chain:a,publicClient:o,bundlerUrl:s,paymasterUrl:l,paymasterContext:u})=>{let m=await c({owner:t,smartWalletType:i,publicClient:o}),p=r.createPimlicoClient({transport:n.http(s),entryPoint:m.entryPoint}),y=l?r.createPimlicoClient({transport:n.http(l),entryPoint:m.entryPoint}):void 0;return e.createSmartAccountClient({account:m,chain:a,paymaster:y,paymasterContext:u,bundlerTransport:n.http(s),userOperation:{estimateFeesPerGas:async()=>{if(["public.pimlico.io","api.pimlico.io"].some((e=>s.includes(e))))return await p.getUserOperationGasPrice().then((e=>e.fast));if(["rpc.zerodev.app"].some((e=>s.includes(e))))return(await p.request({method:"zd_getUserOperationGasPrice",params:[]})).fast;if(["g.alchemy.com"].some((e=>s.includes(e)))){let[e,t]=await Promise.all([o.getBlock({blockTag:"latest"}),p.request({method:"rundler_maxPriorityFeePerGas",params:[]})]);if(!e.baseFeePerGas||!t)throw Error("Failed to get block or maxPriorityFeePerGasEstimate");return{maxFeePerGas:150n*e.baseFeePerGas/100n+BigInt(t.toString()),maxPriorityFeePerGas:BigInt(t.toString())}}{let e=await o.estimateFeesPerGas(),t=s.includes("api.developer.coinbase.com")?175n:150n;return{...e,maxFeePerGas:e.maxFeePerGas*t/100n,maxPriorityFeePerGas:e.maxPriorityFeePerGas*t/100n}}}}})};
@@ -1 +1 @@
1
- "use strict";var e=require("./getUserEmbeddedEthereumWallet.js"),r=require("./getUserEmbeddedSolanaWallet.js");require("./getAllUserEmbeddedEthereumWallets.js"),require("./getAllUserEmbeddedSolanaWallets.js");const t=e=>{if("ethereum"===e.chain_type)return{entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier"};if("solana"===e.chain_type)return{entropyId:e.address,entropyIdVerifier:"solana-address-verifier"};throw Error("Invalid embedded wallet account type")};exports.getEntropyDetailsFromAccount=t,exports.getEntropyDetailsFromUser=(d,l)=>{if(!d)return null;if(l?.imported)return t(l);let s=e.getUserEmbeddedEthereumWallet(d)??r.getUserEmbeddedSolanaWallet(d);return s?t(s):null};
1
+ "use strict";var e=require("./getUserEmbeddedEthereumWallet.js"),r=require("./getUserEmbeddedSolanaWallet.js");require("./getAllUserEmbeddedEthereumWallets.js"),require("./embedded-wallets.js"),require("./getAllUserEmbeddedSolanaWallets.js");const t=e=>{if("ethereum"===e.chain_type)return{entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier"};if("solana"===e.chain_type)return{entropyId:e.address,entropyIdVerifier:"solana-address-verifier"};throw Error("Invalid embedded wallet account type")};exports.getEntropyDetailsFromAccount=t,exports.getEntropyDetailsFromUser=(d,l)=>{if(!d)return null;if(l?.imported)return t(l);let s=e.getUserEmbeddedEthereumWallet(d)??r.getUserEmbeddedSolanaWallet(d);return s?t(s):null};
@@ -1 +1 @@
1
- "use strict";let e=e=>"wallet"===e.type&&"privy"===e.wallet_client_type&&"embedded"===e.connector_type&&("bitcoin-segwit"===e.chain_type||"bitcoin-taproot"===e.chain_type);exports.getAllUserEmbeddedBitcoinWallets=t=>t?t.linked_accounts.filter(e).sort(((e,t)=>e.wallet_index-t.wallet_index)):[];
1
+ "use strict";var e=require("./embedded-wallets.js");let t=e=>"bitcoin-segwit"===e.chain_type||"bitcoin-taproot"===e.chain_type;exports.getAllUserEmbeddedBitcoinWallets=i=>i?i.linked_accounts.filter(e.isEmbeddedWalletAccount).filter(t).sort(((e,t)=>e.wallet_index-t.wallet_index)):[];
@@ -1 +1 @@
1
- "use strict";let e=e=>"wallet"===e.type&&"privy"===e.wallet_client_type&&"embedded"===e.connector_type&&"ethereum"===e.chain_type;exports.getAllUserEmbeddedEthereumWallets=t=>t?t.linked_accounts.filter(e).sort(((e,t)=>e.wallet_index-t.wallet_index)):[];
1
+ "use strict";var e=require("./embedded-wallets.js");exports.getAllUserEmbeddedEthereumWallets=t=>t?t.linked_accounts.filter(e.isEmbeddedWalletAccount).filter((e=>"ethereum"===e.chain_type)).sort(((e,t)=>e.wallet_index-t.wallet_index)):[];
@@ -1 +1 @@
1
- "use strict";let e=e=>"wallet"===e.type&&"privy"===e.wallet_client_type&&"embedded"===e.connector_type&&"solana"===e.chain_type;exports.getAllUserEmbeddedSolanaWallets=t=>t?t.linked_accounts.filter(e).sort(((e,t)=>e.wallet_index-t.wallet_index)):[];
1
+ "use strict";var e=require("./embedded-wallets.js");exports.getAllUserEmbeddedSolanaWallets=l=>l?l.linked_accounts.filter(e.isEmbeddedWalletAccount).filter((e=>"solana"===e.chain_type)).sort(((e,l)=>e.wallet_index-l.wallet_index)):[];
@@ -1 +1 @@
1
- "use strict";var e=require("./getAllUserEmbeddedEthereumWallets.js");const t=t=>e.getAllUserEmbeddedEthereumWallets(t).find((e=>0===e.wallet_index))??null,l=t;exports.getUserEmbeddedEthereumWallet=t,exports.getUserEmbeddedWallet=l;
1
+ "use strict";var e=require("./getAllUserEmbeddedEthereumWallets.js");require("./embedded-wallets.js");const l=l=>e.getAllUserEmbeddedEthereumWallets(l).find((e=>0===e.wallet_index))??null,t=l;exports.getUserEmbeddedEthereumWallet=l,exports.getUserEmbeddedWallet=t;
@@ -1 +1 @@
1
- "use strict";var e=require("./getAllUserEmbeddedSolanaWallets.js");exports.getUserEmbeddedSolanaWallet=l=>e.getAllUserEmbeddedSolanaWallets(l).find((e=>0===e.wallet_index))??null;
1
+ "use strict";var e=require("./getAllUserEmbeddedSolanaWallets.js");require("./embedded-wallets.js");exports.getUserEmbeddedSolanaWallet=l=>e.getAllUserEmbeddedSolanaWallets(l).find((e=>0===e.wallet_index))??null;
@@ -1 +1 @@
1
- "use strict";var e=require("./getAllUserEmbeddedEthereumWallets.js");exports.shouldCreateEmbeddedEthWallet=(t,l)=>!("off"===l||e.getAllUserEmbeddedEthereumWallets(t).length>0||t.linked_accounts.filter((e=>"wallet"===e.type&&"ethereum"===e.chain_type)).length>0&&"all-users"!==l);
1
+ "use strict";var e=require("./getAllUserEmbeddedEthereumWallets.js");require("./embedded-wallets.js");exports.shouldCreateEmbeddedEthWallet=(l,t)=>!("off"===t||e.getAllUserEmbeddedEthereumWallets(l).length>0||l.linked_accounts.filter((e=>"wallet"===e.type&&"ethereum"===e.chain_type)).length>0&&"all-users"!==t);
@@ -1 +1 @@
1
- "use strict";var e=require("./getAllUserEmbeddedSolanaWallets.js");exports.shouldCreateEmbeddedSolWallet=(l,t)=>!("off"===t||e.getAllUserEmbeddedSolanaWallets(l).length>0||l.linked_accounts.filter((e=>"wallet"===e.type&&"solana"===e.chain_type)).length>0&&"all-users"!==t);
1
+ "use strict";var e=require("./getAllUserEmbeddedSolanaWallets.js");require("./embedded-wallets.js");exports.shouldCreateEmbeddedSolWallet=(l,t)=>!("off"===t||e.getAllUserEmbeddedSolanaWallets(l).length>0||l.linked_accounts.filter((e=>"wallet"===e.type&&"solana"===e.chain_type)).length>0&&"all-users"!==t);
@@ -1 +1 @@
1
- import{PrivyClientError as e}from"../../Error.mjs";import{isUnifiedWallet as t}from"../../wallet-api/unified-wallet.mjs";import{getUserValidDelegateWallets as r,getRootWalletForDelegation as s}from"./utils.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";const o=o=>async({address:d,chainType:a})=>{let{user:l}=await o.user.get();if(!l)throw new e({code:"delegated_actions_before_logged_in",error:"Must be logged in to delegate wallets"});if("solana"!==a&&"ethereum"!==a)throw new e({code:"unsupported_chain_type",error:"Only Solana and Ethereum embedded wallets are supported for delegation and revocation."});let i=r(l).find((e=>e.chain_type===a&&e.address===d));if(!i)throw new e({code:"delegated_actions_wallet_not_found",error:"Address to delegate is not associated with current user."});if(t(i))throw new e({code:"unsupported_wallet_type",error:"useDelegatedActions is only supported for on-device execution and this app uses TEE execution. Use the useSessionSigners hook to provision server side access on behalf of your users. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide"});if(i.delegated)return{user:l};let n=s(i,l);if(!n)throw new e({code:"delegated_actions_wallet_not_found",error:"Address to delegate is not associated with current user."});await o.embeddedWallet.delegateWallets({rootWallet:{address:n.address,chainType:n.chain_type,imported:n.imported},delegatedWallets:[{address:i.address,chainType:i.chain_type,walletIndex:i.wallet_index}]});let{user:u}=await o.user.get();return{user:u}};export{o as delegateWallet};
1
+ import{PrivyClientError as e}from"../../Error.mjs";import{isUnifiedWallet as t}from"../../wallet-api/unified-wallet.mjs";import{getUserValidDelegateWallets as r,getRootWalletForDelegation as s}from"./utils.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";const d=d=>async({address:o,chainType:a})=>{let{user:l}=await d.user.get();if(!l)throw new e({code:"delegated_actions_before_logged_in",error:"Must be logged in to delegate wallets"});if("solana"!==a&&"ethereum"!==a)throw new e({code:"unsupported_chain_type",error:"Only Solana and Ethereum embedded wallets are supported for delegation and revocation."});let i=r(l).find((e=>e.chain_type===a&&e.address===o));if(!i)throw new e({code:"delegated_actions_wallet_not_found",error:"Address to delegate is not associated with current user."});if(t(i))throw new e({code:"unsupported_wallet_type",error:"useDelegatedActions is only supported for on-device execution and this app uses TEE execution. Use the useSessionSigners hook to provision server side access on behalf of your users. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide"});if(i.delegated)return{user:l};let n=s(i,l);if(!n)throw new e({code:"delegated_actions_wallet_not_found",error:"Address to delegate is not associated with current user."});await d.embeddedWallet.delegateWallets({rootWallet:{address:n.address,chainType:n.chain_type,imported:n.imported},delegatedWallets:[{address:i.address,chainType:i.chain_type,walletIndex:i.wallet_index}]});let{user:u}=await d.user.get();return{user:u}};export{d as delegateWallet};
@@ -1 +1 @@
1
- export{delegateWallet}from"./delegateWallet.mjs";export{revokeWallets}from"./revokeWallets.mjs";import"../../Error.mjs";import"../../wallet-api/unified-wallet.mjs";import"./utils.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";
1
+ export{delegateWallet}from"./delegateWallet.mjs";export{revokeWallets}from"./revokeWallets.mjs";import"../../Error.mjs";import"../../wallet-api/unified-wallet.mjs";import"./utils.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";
@@ -1 +1 @@
1
- import{PrivyClientError as e}from"../../Error.mjs";import{isUnifiedWallet as t}from"../../wallet-api/unified-wallet.mjs";import{getUserValidDelegateWallets as r}from"./utils.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";const o=o=>async()=>{let{user:s}=await o.user.get();if(!s)throw new e({code:"delegated_actions_before_logged_in",error:"Must be logged in to revoke delegated wallets"});let l=r(s);if(l.some(t))throw new e({code:"unsupported_wallet_type",error:"revokeWallets is only supported for on-device execution and this app uses TEE execution. Use the useSessionSigners hook to manage server side access on behalf of your users. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide"});if(l.every((e=>!e.delegated)))throw new e({code:"delegated_actions_no_wallet_to_revoke",error:"User has no delegated wallets to revoke."});await o.delegated.revoke();let{user:a}=await o.user.get();return{user:a}};export{o as revokeWallets};
1
+ import{PrivyClientError as e}from"../../Error.mjs";import{isUnifiedWallet as t}from"../../wallet-api/unified-wallet.mjs";import{getUserValidDelegateWallets as r}from"./utils.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";const o=o=>async()=>{let{user:s}=await o.user.get();if(!s)throw new e({code:"delegated_actions_before_logged_in",error:"Must be logged in to revoke delegated wallets"});let l=r(s);if(l.some(t))throw new e({code:"unsupported_wallet_type",error:"revokeWallets is only supported for on-device execution and this app uses TEE execution. Use the useSessionSigners hook to manage server side access on behalf of your users. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide"});if(l.every((e=>!e.delegated)))throw new e({code:"delegated_actions_no_wallet_to_revoke",error:"User has no delegated wallets to revoke."});await o.delegated.revoke();let{user:a}=await o.user.get();return{user:a}};export{o as revokeWallets};
@@ -1 +1 @@
1
- import{getAllUserEmbeddedEthereumWallets as e}from"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import{getAllUserEmbeddedSolanaWallets as t}from"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import{getUserEmbeddedEthereumWallet as m}from"../../utils/getUserEmbeddedEthereumWallet.mjs";import{getUserEmbeddedSolanaWallet as l}from"../../utils/getUserEmbeddedSolanaWallet.mjs";const r=m=>[...e(m),...t(m)],s=(e,t)=>e.imported?e:m(t)??l(t);export{s as getRootWalletForDelegation,r as getUserValidDelegateWallets};
1
+ import{getAllUserEmbeddedEthereumWallets as e}from"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import{getAllUserEmbeddedSolanaWallets as t}from"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import{getUserEmbeddedEthereumWallet as m}from"../../utils/getUserEmbeddedEthereumWallet.mjs";import{getUserEmbeddedSolanaWallet as l}from"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/embedded-wallets.mjs";const s=m=>[...e(m),...t(m)],r=(e,t)=>e.imported?e:m(t)??l(t);export{r as getRootWalletForDelegation,s as getUserValidDelegateWallets};
@@ -1 +1 @@
1
- export{i as delegatedActions}from"../index-g0cxoRWQ.mjs";export{i as crossApp}from"../index-Bu3ySxLM.mjs";import"./delegatedActions/delegateWallet.mjs";import"../Error.mjs";import"../wallet-api/unified-wallet.mjs";import"./delegatedActions/utils.mjs";import"../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../utils/getUserEmbeddedEthereumWallet.mjs";import"../utils/getUserEmbeddedSolanaWallet.mjs";import"./delegatedActions/revokeWallets.mjs";import"./crossApp/loginWithCrossAppAuth.mjs";import"./crossApp/linkWithCrossAppAuth.mjs";import"../index-DTAjYY8z.mjs";import"./crossApp/wallet/signMessage.mjs";import"./crossApp/wallet/utils/isCrossAppWalletSmart.mjs";import"./crossApp/wallet/utils/sendCrossAppRequest.mjs";import"./crossApp/wallet/utils/getCrossAppAccountByWalletAddress.mjs";import"./crossApp/wallet/utils/getProviderAccessTokenOrRelink.mjs";import"./crossApp/wallet/utils/throwIfNotLoggedIn.mjs";import"./crossApp/wallet/signTypedData.mjs";import"../utils/typedData/generateDomainType.mjs";import"./crossApp/wallet/sendTransaction.mjs";
1
+ export{i as delegatedActions}from"../index-g0cxoRWQ.mjs";export{i as crossApp}from"../index-Bu3ySxLM.mjs";import"./delegatedActions/delegateWallet.mjs";import"../Error.mjs";import"../wallet-api/unified-wallet.mjs";import"./delegatedActions/utils.mjs";import"../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../utils/embedded-wallets.mjs";import"../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../utils/getUserEmbeddedEthereumWallet.mjs";import"../utils/getUserEmbeddedSolanaWallet.mjs";import"./delegatedActions/revokeWallets.mjs";import"./crossApp/loginWithCrossAppAuth.mjs";import"./crossApp/linkWithCrossAppAuth.mjs";import"../index-DTAjYY8z.mjs";import"./crossApp/wallet/signMessage.mjs";import"./crossApp/wallet/utils/isCrossAppWalletSmart.mjs";import"./crossApp/wallet/utils/sendCrossAppRequest.mjs";import"./crossApp/wallet/utils/getCrossAppAccountByWalletAddress.mjs";import"./crossApp/wallet/utils/getProviderAccessTokenOrRelink.mjs";import"./crossApp/wallet/utils/throwIfNotLoggedIn.mjs";import"./crossApp/wallet/signTypedData.mjs";import"../utils/typedData/generateDomainType.mjs";import"./crossApp/wallet/sendTransaction.mjs";
@@ -1 +1 @@
1
- import e from"./AppApi.mjs";import t from"./CrossAppApi.mjs";import i from"./DelegatedWalletsApi.mjs";import r from"./EmbeddedWalletApi.mjs";import s from"./MfaPromises.mjs";import{PrivyInternal as m}from"./PrivyInternal.mjs";import o from"./UserApi.mjs";import p from"./auth/AuthApi.mjs";import a from"./funding/FundingApi.mjs";import d from"./mfa/MfaApi.mjs";import n from"./recovery/RecoveryApi.mjs";import"@privy-io/public-api";import"../Token.mjs";import"jose";import"@privy-io/chains";import"../Error.mjs";import"../embedded/EmbeddedBitcoinWalletProvider.mjs";import"../embedded/errors.mjs";import"../embedded/types.mjs";import"../embedded/stack/walletCreate.mjs";import"../wallet-api/create.mjs";import"../embedded/utils/index.mjs";import"@ethersproject/abstract-signer";import"@ethersproject/providers";import"../embedded/gas/arbitrum.mjs";import"@ethersproject/bignumber";import"../embedded/utils/ethers.mjs";import"../embedded/gas/bsc.mjs";import"../embedded/gas/op-stack.mjs";import"@ethersproject/contracts";import"@ethersproject/transactions";import"../embedded/gas/polygon.mjs";import"@ethersproject/units";import"fetch-retry";import"../embedded/utils/gas.mjs";import"../wallet-api/unified-wallet.mjs";import"../embedded/EmbeddedWalletProxy.mjs";import"../utils/sleep.mjs";import"../embedded/EventCallbackQueue.mjs";import"../embedded/withMfa.mjs";import"../embedded/EmbeddedWalletProvider.mjs";import"eventemitter3";import"../embedded/methods.mjs";import"../embedded/stack/walletRpc.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"../embedded/stack/wallet-api-eth-transaction.mjs";import"../embedded/stack/wallet-api-eth-typed-data.mjs";import"../embedded/EmbeddedSolanaWalletProvider.mjs";import"../solana/getWalletPublicKeyFromTransaction.mjs";import"../solana/isVersionedTransaction.mjs";import"uuid";import"@privy-io/api-base";import"../Session.mjs";import"js-cookie";import"../utils/allSettled.mjs";import"../toAbortSignalTimeout.mjs";import"../utils/toSearchParams.mjs";import"./logger.mjs";import"../utils/noop.mjs";import"./auth/CustomProviderApi.mjs";import"./auth/maybeCreateWalletOnLogin.mjs";import"../utils/getUserEmbeddedEthereumWallet.mjs";import"../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../utils/getUserEmbeddedSolanaWallet.mjs";import"../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../utils/shouldCreateEmbeddedEthWallet.mjs";import"../utils/shouldCreateEmbeddedSolWallet.mjs";import"./auth/EmailApi.mjs";import"./auth/FarcasterApi.mjs";import"./auth/FarcasterV2Api.mjs";import"./auth/GuestApi.mjs";import"./auth/OAuthApi.mjs";import"../pkce.mjs";import"./auth/PasskeyApi.mjs";import"./auth/PhoneApi.mjs";import"./auth/SiweApi.mjs";import"./auth/SiwsApi.mjs";import"./auth/SmartWalletApi.mjs";import"./funding/CoinbaseOnRampApi.mjs";import"./funding/MoonpayOnRampApi.mjs";import"../funding/moonpay.mjs";import"./mfa/MfaPasskeyApi.mjs";import"./mfa/MfaSmsApi.mjs";import"./recovery/RecoveryICloudApi.mjs";import"./recovery/RecoveryOAuthApi.mjs";class l{async initialize(){await this._privyInternal._initialize()}setMessagePoster(e){this.embeddedWallet.setMessagePoster(e)}addOAuthTokensListener(e){return this._privyInternal.session.on("oauth_tokens_granted",e),{unsubscribe:()=>{this._privyInternal.session.removeListener("oauth_tokens_granted",e)}}}setCallbacks(e){this._privyInternal.setCallbacks(e)}getAccessToken(){return this._privyInternal.getAccessToken()}getIdentityToken(){return this._privyInternal.getIdentityToken()}getCompiledPath(e,t){return this._privyInternal.getPath(e,t)}async fetchPrivyRoute(e,t){return this._privyInternal.fetch(e,t)}get logger(){return this._privyInternal.logger}constructor({clientId:l,...j}){this._privyInternal=new m({...j,appClientId:l}),this.mfa=new d(this._privyInternal),this.mfaPromises=new s,this.app=new e(this._privyInternal),this.embeddedWallet=new r(this._privyInternal,j.embeddedWalletMessagePoster,j.supportedChains,this.mfa,this.mfaPromises,this.app),this.user=new o(this._privyInternal),this.auth=new p(this._privyInternal,this.embeddedWallet,j.storage,j.crypto),this.recovery=new n(this._privyInternal,j.storage,j.crypto),this.funding=new a(this._privyInternal),this.delegated=new i(this._privyInternal),this.crossApp=new t(this._privyInternal,j.storage)}}export{l as default};
1
+ import e from"./AppApi.mjs";import t from"./CrossAppApi.mjs";import i from"./DelegatedWalletsApi.mjs";import r from"./EmbeddedWalletApi.mjs";import s from"./MfaPromises.mjs";import{PrivyInternal as m}from"./PrivyInternal.mjs";import o from"./UserApi.mjs";import p from"./auth/AuthApi.mjs";import a from"./funding/FundingApi.mjs";import d from"./mfa/MfaApi.mjs";import n from"./recovery/RecoveryApi.mjs";import"@privy-io/public-api";import"../Token.mjs";import"jose";import"@privy-io/chains";import"../Error.mjs";import"../embedded/EmbeddedBitcoinWalletProvider.mjs";import"../wallet-api/unified-wallet.mjs";import"../embedded/errors.mjs";import"../embedded/types.mjs";import"../embedded/stack/walletCreate.mjs";import"../wallet-api/create.mjs";import"../embedded/utils/index.mjs";import"@ethersproject/abstract-signer";import"@ethersproject/providers";import"../embedded/gas/arbitrum.mjs";import"@ethersproject/bignumber";import"../embedded/utils/ethers.mjs";import"../embedded/gas/bsc.mjs";import"../embedded/gas/op-stack.mjs";import"@ethersproject/contracts";import"@ethersproject/transactions";import"../embedded/gas/polygon.mjs";import"@ethersproject/units";import"fetch-retry";import"../embedded/utils/gas.mjs";import"../embedded/EmbeddedWalletProxy.mjs";import"../utils/sleep.mjs";import"../embedded/EventCallbackQueue.mjs";import"../embedded/withMfa.mjs";import"../embedded/EmbeddedWalletProvider.mjs";import"eventemitter3";import"../embedded/methods.mjs";import"../embedded/stack/walletRpc.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"../embedded/stack/wallet-api-eth-transaction.mjs";import"../embedded/stack/wallet-api-eth-typed-data.mjs";import"../embedded/EmbeddedSolanaWalletProvider.mjs";import"../solana/getWalletPublicKeyFromTransaction.mjs";import"../solana/isVersionedTransaction.mjs";import"uuid";import"@privy-io/api-base";import"../Session.mjs";import"js-cookie";import"../utils/allSettled.mjs";import"../toAbortSignalTimeout.mjs";import"../utils/toSearchParams.mjs";import"./logger.mjs";import"../utils/noop.mjs";import"./auth/CustomProviderApi.mjs";import"./auth/maybeCreateWalletOnLogin.mjs";import"../utils/getUserEmbeddedEthereumWallet.mjs";import"../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../utils/embedded-wallets.mjs";import"../utils/getUserEmbeddedSolanaWallet.mjs";import"../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../utils/shouldCreateEmbeddedEthWallet.mjs";import"../utils/shouldCreateEmbeddedSolWallet.mjs";import"./auth/EmailApi.mjs";import"./auth/FarcasterApi.mjs";import"./auth/FarcasterV2Api.mjs";import"./auth/GuestApi.mjs";import"./auth/OAuthApi.mjs";import"../pkce.mjs";import"./auth/PasskeyApi.mjs";import"./auth/PhoneApi.mjs";import"./auth/SiweApi.mjs";import"./auth/SiwsApi.mjs";import"./auth/SmartWalletApi.mjs";import"./funding/CoinbaseOnRampApi.mjs";import"./funding/MoonpayOnRampApi.mjs";import"../funding/moonpay.mjs";import"./mfa/MfaPasskeyApi.mjs";import"./mfa/MfaSmsApi.mjs";import"./recovery/RecoveryICloudApi.mjs";import"./recovery/RecoveryOAuthApi.mjs";class l{async initialize(){await this._privyInternal._initialize()}setMessagePoster(e){this.embeddedWallet.setMessagePoster(e)}addOAuthTokensListener(e){return this._privyInternal.session.on("oauth_tokens_granted",e),{unsubscribe:()=>{this._privyInternal.session.removeListener("oauth_tokens_granted",e)}}}setCallbacks(e){this._privyInternal.setCallbacks(e)}getAccessToken(){return this._privyInternal.getAccessToken()}getIdentityToken(){return this._privyInternal.getIdentityToken()}getCompiledPath(e,t){return this._privyInternal.getPath(e,t)}async fetchPrivyRoute(e,t){return this._privyInternal.fetch(e,t)}get logger(){return this._privyInternal.logger}constructor({clientId:l,...j}){this._privyInternal=new m({...j,appClientId:l}),this.mfa=new d(this._privyInternal),this.mfaPromises=new s,this.app=new e(this._privyInternal),this.embeddedWallet=new r(this._privyInternal,j.embeddedWalletMessagePoster,j.supportedChains,this.mfa,this.mfaPromises,this.app),this.user=new o(this._privyInternal),this.auth=new p(this._privyInternal,this.embeddedWallet,j.storage,j.crypto),this.recovery=new n(this._privyInternal,j.storage,j.crypto),this.funding=new a(this._privyInternal),this.delegated=new i(this._privyInternal),this.crossApp=new t(this._privyInternal,j.storage)}}export{l as default};
@@ -1 +1 @@
1
- import e from"fetch-retry";import{v4 as t}from"uuid";import{PrivyErrorCode as s}from"@privy-io/api-base";import{getPathWithParams as i,AppConfig as r,AnalyticsEvent as a,RefreshSession as n}from"@privy-io/public-api";import{PrivyClientError as o,PrivyApiError as h}from"../Error.mjs";import{Session as l}from"../Session.mjs";import c from"../toAbortSignalTimeout.mjs";import{toSearchParams as g}from"../utils/toSearchParams.mjs";import{toConsoleLogger as d}from"./logger.mjs";import"eventemitter3";import"jose";import"js-cookie";import"../Token.mjs";import"../utils/allSettled.mjs";import"../utils/noop.mjs";let p="privy:caid";class u{setCallbacks(e){this.callbacks={...this.callbacks,...e}}get isReady(){return!!this._config}get config(){return this._config}get caid(){return this._analyticsId}async _initialize(){if(this.isReady)this.callbacks?.setIsReady?.(!0);else{if(!await this.isStorageAccessible())throw new o({code:"storage_error",error:"Unable to access storage"});this._config=await this.getAppConfig(),this._config?.custom_api_url&&(this.baseUrl=this._config.custom_api_url,this.session.isUsingServerCookies=!0),this.callbacks?.setIsReady?.(!0),this._sdkVersion.startsWith("react-auth:")||this.createAnalyticsEvent("sdk_initialize",{})}}getPath(e,{params:t,query:s}){return`${this.baseUrl}${i(e.path,t)}${g(s)}`}async fetch(e,{body:t,params:s,query:i,headers:r,onRequest:a=this._beforeRequest.bind(this)}){let n=new Request(this.getPath(e,{params:s,query:i}),{method:e.method,body:JSON.stringify(t),headers:r}),o=await a(n),l=await this._fetch(n,o),c=await l.json();if(l.status>299)throw new h(c);return c}async _beforeRequestWithoutInitialize(e){let t=await this.session.getToken(),s=new Headers(e.headers);s.set("privy-app-id",this.appId),this.appClientId&&s.set("privy-client-id",this.appClientId),s.set("privy-client",this._sdkVersion),t&&s.set("Authorization",`Bearer ${t}`),s.set("Content-Type","application/json"),s.set("Accept","application/json");let i=await this._getOrGenerateClientAnalyticsId();return i&&s.set("privy-ca-id",i),this.nativeAppIdentifier&&s.set("x-native-app-identifier",this.nativeAppIdentifier),{signal:c(2e4),headers:s,credentials:"include"}}async beforeRequestWithoutRefresh(e){return await this._initialize(),this._beforeRequestWithoutInitialize(e)}async _beforeRequest(e){return await this._initialize(),await this.getAccessToken(),this.beforeRequestWithoutRefresh(e)}async getAppConfig(){return await this.fetch(r,{params:{app_id:this.appId},onRequest:this._beforeRequestWithoutInitialize.bind(this)})}async _getOrGenerateClientAnalyticsId(){if(this._analyticsId)return this._analyticsId;try{let e=await this._storage.get(p);if("string"==typeof e&&e.length>0)return this._analyticsId=e,e}catch(e){this.logger.error("Unable to load clientId",e)}try{this._analyticsId=t()}catch(e){this.logger.error("Unable to generate uuidv4",e)}if(!this._analyticsId)return null;try{await this._storage.put(p,this._analyticsId)}catch(e){this.logger.error(`Unable to store clientId: ${this._analyticsId}`,e)}return this._analyticsId}async destroyClientAnalyticsId(){try{return await this._storage.del(p)}catch(e){this.logger.error("Unable to delete clientId",e)}}async createAnalyticsEvent(e,t){try{await this.fetch(a,{body:{event_name:e,client_id:await this._getOrGenerateClientAnalyticsId(),payload:t},onRequest:this.beforeRequestWithoutRefresh.bind(this)})}catch(e){}}async refreshSession(e=!1){if(!await this.isStorageAccessible())throw new o({code:"storage_error",error:"Unable to access storage"});let t=await this.session.getRefreshToken()??void 0,s=t??"key",i=this._cache.get(s);if(i)return this.logger.debug("[privy:refresh] found in-flight session refresh request, deduping"),await i;let r=this._refreshSession(t,e);this._cache.set(s,r);try{return await r}finally{this._cache.delete(s)}}async _refreshSession(e,t){let i=await this.session.getToken();if(!this.session.hasRefreshCredentials(i,e??null))throw this.logger.debug("[privy:refresh] missing tokens, skipping request"),await this._initialize(),new h({code:s.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage"});try{this.logger.debug(`[privy:refresh] fetching: ${n.path}`);let s=await this.fetch(n,{body:{refresh_token:e},onRequest:this.beforeRequestWithoutRefresh.bind(this)}),i=s.session_update_action;return this.logger.debug(`[privy:refresh] response: ${i}`),t||this.callbacks?.setUser?.(s.user),"set"===i&&(await this.session.updateWithTokensResponse(s),this.logger.debug("[privy:refresh] tokens stored")),"clear"===i&&(await this.session.destroyLocalState(),this.logger.debug("[privy:refresh] tokens cleared"),t||this.callbacks?.setUser?.(null)),"ignore"===i&&s.token&&(await this.session.storeToken(s.token),this.logger.debug("[privy:refresh] access token stored"),s.identity_token&&(this.logger.debug("[privy:refresh] identity token stored"),await this.session.storeIdentityToken(s.identity_token))),this.logger.debug("[privy:refresh] returning response"),s}catch(e){throw this.logger.debug(`[privy:refresh] error: ${e.message??"unknown error"}`),e instanceof h&&e.code===s.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),t||this.callbacks?.setUser?.(null)),e}}async getAccessToken(){let[e,t]=await Promise.all([this.session.getToken(),this.session.getRefreshToken()]);if(!this.session.tokenIsActive(e)&&this.session.hasRefreshCredentials(e,t)){let t=await this.refreshSession(),s=await this.session.getToken();return t.token||this.logger.debug("[privy:getAccessToken] expected token received null"),t.token===e&&this.logger.debug("[privy:getAccessToken] expected new token in response received existing"),s===e&&this.logger.debug("[privy:getAccessToken] expected new token in storage received existing"),t.token??s}return e}async getIdentityToken(){return await this.session.getIdentityToken()}async isStorageAccessible(){try{let e=`privy:__storage__test-${t()}`,s="blobby";await this._storage.put(e,s);let i=await this._storage.get(e);return await this._storage.del(e),i===s}catch(e){return this.logger.error(e),!1}}constructor(t){this._sdkVersion="js-sdk-core:0.52.6",this._cache=new Map,this.logger=d({level:t.logLevel??"ERROR"}),this._storage=t.storage,this._analyticsId=null,this._getOrGenerateClientAnalyticsId(),this.baseUrl=t.baseUrl??"https://auth.privy.io",this.appId=t.appId,this.appClientId=t.appClientId,this._sdkVersion=t.sdkVersion??this._sdkVersion,this.callbacks=t.callbacks,this.nativeAppIdentifier=t.nativeAppIdentifier,this.session=new l({storage:this._storage,isUsingServerCookies:!1,appId:t.appId}),this._fetch=e(globalThis.fetch,{retries:3,retryDelay:e=>3**e*500,retryOn:[408,409,425,500,502,503,504]}),this.session.on("error_storing_tokens",(e=>{this.createAnalyticsEvent("error_updating_tokens_in_storage",{reason:e})}))}}export{u as PrivyInternal};
1
+ import e from"fetch-retry";import{v4 as t}from"uuid";import{PrivyErrorCode as s}from"@privy-io/api-base";import{getPathWithParams as i,AppConfig as r,AnalyticsEvent as a,RefreshSession as n}from"@privy-io/public-api";import{PrivyClientError as o,PrivyApiError as h}from"../Error.mjs";import{Session as l}from"../Session.mjs";import c from"../toAbortSignalTimeout.mjs";import{toSearchParams as g}from"../utils/toSearchParams.mjs";import{toConsoleLogger as d}from"./logger.mjs";import"eventemitter3";import"jose";import"js-cookie";import"../Token.mjs";import"../utils/allSettled.mjs";import"../utils/noop.mjs";let p="privy:caid";class u{setCallbacks(e){this.callbacks={...this.callbacks,...e}}get isReady(){return!!this._config}get config(){return this._config}get caid(){return this._analyticsId}async _initialize(){if(this.isReady)this.callbacks?.setIsReady?.(!0);else{if(!await this.isStorageAccessible())throw new o({code:"storage_error",error:"Unable to access storage"});this._config=await this.getAppConfig(),this._config?.custom_api_url&&(this.baseUrl=this._config.custom_api_url,this.session.isUsingServerCookies=!0),this.callbacks?.setIsReady?.(!0),this._sdkVersion.startsWith("react-auth:")||this.createAnalyticsEvent("sdk_initialize",{})}}getPath(e,{params:t,query:s}){return`${this.baseUrl}${i(e.path,t)}${g(s)}`}async fetch(e,{body:t,params:s,query:i,headers:r,onRequest:a=this._beforeRequest.bind(this)}){let n=new Request(this.getPath(e,{params:s,query:i}),{method:e.method,body:JSON.stringify(t),headers:r}),o=await a(n),l=await this._fetch(n,o),c=await l.json();if(l.status>299)throw new h(c);return c}async _beforeRequestWithoutInitialize(e){let t=await this.session.getToken(),s=new Headers(e.headers);s.set("privy-app-id",this.appId),this.appClientId&&s.set("privy-client-id",this.appClientId),s.set("privy-client",this._sdkVersion),t&&s.set("Authorization",`Bearer ${t}`),s.set("Content-Type","application/json"),s.set("Accept","application/json");let i=await this._getOrGenerateClientAnalyticsId();return i&&s.set("privy-ca-id",i),this.nativeAppIdentifier&&s.set("x-native-app-identifier",this.nativeAppIdentifier),{signal:c(2e4),headers:s,credentials:"include"}}async beforeRequestWithoutRefresh(e){return await this._initialize(),this._beforeRequestWithoutInitialize(e)}async _beforeRequest(e){return await this._initialize(),await this.getAccessToken(),this.beforeRequestWithoutRefresh(e)}async getAppConfig(){return await this.fetch(r,{params:{app_id:this.appId},onRequest:this._beforeRequestWithoutInitialize.bind(this)})}async _getOrGenerateClientAnalyticsId(){if(this._analyticsId)return this._analyticsId;try{let e=await this._storage.get(p);if("string"==typeof e&&e.length>0)return this._analyticsId=e,e}catch(e){this.logger.error("Unable to load clientId",e)}try{this._analyticsId=t()}catch(e){this.logger.error("Unable to generate uuidv4",e)}if(!this._analyticsId)return null;try{await this._storage.put(p,this._analyticsId)}catch(e){this.logger.error(`Unable to store clientId: ${this._analyticsId}`,e)}return this._analyticsId}async destroyClientAnalyticsId(){try{return await this._storage.del(p)}catch(e){this.logger.error("Unable to delete clientId",e)}}async createAnalyticsEvent(e,t){try{await this.fetch(a,{body:{event_name:e,client_id:await this._getOrGenerateClientAnalyticsId(),payload:t},onRequest:this.beforeRequestWithoutRefresh.bind(this)})}catch(e){}}async refreshSession(e=!1){if(!await this.isStorageAccessible())throw new o({code:"storage_error",error:"Unable to access storage"});let t=await this.session.getRefreshToken()??void 0,s=t??"key",i=this._cache.get(s);if(i)return this.logger.debug("[privy:refresh] found in-flight session refresh request, deduping"),await i;let r=this._refreshSession(t,e);this._cache.set(s,r);try{return await r}finally{this._cache.delete(s)}}async _refreshSession(e,t){let i=await this.session.getToken();if(!this.session.hasRefreshCredentials(i,e??null))throw this.logger.debug("[privy:refresh] missing tokens, skipping request"),await this._initialize(),new h({code:s.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage"});try{this.logger.debug(`[privy:refresh] fetching: ${n.path}`);let s=await this.fetch(n,{body:{refresh_token:e},onRequest:this.beforeRequestWithoutRefresh.bind(this)}),i=s.session_update_action;return this.logger.debug(`[privy:refresh] response: ${i}`),t||this.callbacks?.setUser?.(s.user),"set"===i&&(await this.session.updateWithTokensResponse(s),this.logger.debug("[privy:refresh] tokens stored")),"clear"===i&&(await this.session.destroyLocalState(),this.logger.debug("[privy:refresh] tokens cleared"),t||this.callbacks?.setUser?.(null)),"ignore"===i&&s.token&&(await this.session.storeToken(s.token),this.logger.debug("[privy:refresh] access token stored"),s.identity_token&&(this.logger.debug("[privy:refresh] identity token stored"),await this.session.storeIdentityToken(s.identity_token))),this.logger.debug("[privy:refresh] returning response"),s}catch(e){throw this.logger.debug(`[privy:refresh] error: ${e.message??"unknown error"}`),e instanceof h&&e.code===s.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),t||this.callbacks?.setUser?.(null)),e}}async getAccessToken(){let[e,t]=await Promise.all([this.session.getToken(),this.session.getRefreshToken()]);if(!this.session.tokenIsActive(e)&&this.session.hasRefreshCredentials(e,t)){let t=await this.refreshSession(),s=await this.session.getToken();return t.token||this.logger.debug("[privy:getAccessToken] expected token received null"),t.token===e&&this.logger.debug("[privy:getAccessToken] expected new token in response received existing"),s===e&&this.logger.debug("[privy:getAccessToken] expected new token in storage received existing"),t.token??s}return e}async getIdentityToken(){return await this.session.getIdentityToken()}async isStorageAccessible(){try{let e=`privy:__storage__test-${t()}`,s="blobby";await this._storage.put(e,s);let i=await this._storage.get(e);return await this._storage.del(e),i===s}catch(e){return this.logger.error(e),!1}}constructor(t){this._sdkVersion="js-sdk-core:0.52.8",this._cache=new Map,this.logger=d({level:t.logLevel??"ERROR"}),this._storage=t.storage,this._analyticsId=null,this._getOrGenerateClientAnalyticsId(),this.baseUrl=t.baseUrl??"https://auth.privy.io",this.appId=t.appId,this.appClientId=t.appClientId,this._sdkVersion=t.sdkVersion??this._sdkVersion,this.callbacks=t.callbacks,this.nativeAppIdentifier=t.nativeAppIdentifier,this.session=new l({storage:this._storage,isUsingServerCookies:!1,appId:t.appId}),this._fetch=e(globalThis.fetch,{retries:3,retryDelay:e=>3**e*500,retryOn:[408,409,425,500,502,503,504]}),this.session.on("error_storing_tokens",(e=>{this.createAnalyticsEvent("error_updating_tokens_in_storage",{reason:e})}))}}export{u as PrivyInternal};
@@ -1 +1 @@
1
- import{Logout as t}from"@privy-io/public-api";import r from"./CustomProviderApi.mjs";import e from"./EmailApi.mjs";import i from"./FarcasterApi.mjs";import s from"./FarcasterV2Api.mjs";import o from"./GuestApi.mjs";import m from"./OAuthApi.mjs";import a from"./PasskeyApi.mjs";import l from"./PhoneApi.mjs";import n from"./SiweApi.mjs";import p from"./SiwsApi.mjs";import h from"./SmartWalletApi.mjs";import"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";import"../../Error.mjs";import"../../pkce.mjs";import"jose";class d{async logout(){try{let r=await this._privyInternal.session.getRefreshToken()??void 0;await this._privyInternal.fetch(t,{body:{refresh_token:r}})}catch(t){console.warn("Error destroying session")}await Promise.all([this._privyInternal.session.destroyLocalState({reason:"logout"}),this._privyInternal.destroyClientAnalyticsId()]),this._privyInternal.callbacks?.setUser?.(null)}constructor(t,d,y,u){this._privyInternal=t,this.customProvider=new r(this._privyInternal,d),this.phone=new l(this._privyInternal,d),this.email=new e(this._privyInternal,d),this.oauth=new m(this._privyInternal,d,y,u),this.guest=new o(this._privyInternal,d),this.siwe=new n(this._privyInternal,d),this.siws=new p(this._privyInternal,d),this.smartWallet=new h(this._privyInternal),this.passkey=new a(this._privyInternal,d),this.farcaster=new i(this._privyInternal,d),this.farcasterV2=new s(this._privyInternal,d)}}export{d as default};
1
+ import{Logout as t}from"@privy-io/public-api";import e from"./CustomProviderApi.mjs";import r from"./EmailApi.mjs";import i from"./FarcasterApi.mjs";import s from"./FarcasterV2Api.mjs";import o from"./GuestApi.mjs";import m from"./OAuthApi.mjs";import l from"./PasskeyApi.mjs";import a from"./PhoneApi.mjs";import n from"./SiweApi.mjs";import p from"./SiwsApi.mjs";import h from"./SmartWalletApi.mjs";import"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";import"../../Error.mjs";import"../../pkce.mjs";import"jose";class d{async logout(){try{let e=await this._privyInternal.session.getRefreshToken()??void 0;await this._privyInternal.fetch(t,{body:{refresh_token:e}})}catch(t){console.warn("Error destroying session")}await Promise.all([this._privyInternal.session.destroyLocalState({reason:"logout"}),this._privyInternal.destroyClientAnalyticsId()]),this._privyInternal.callbacks?.setUser?.(null)}constructor(t,d,y,u){this._privyInternal=t,this.customProvider=new e(this._privyInternal,d),this.phone=new a(this._privyInternal,d),this.email=new r(this._privyInternal,d),this.oauth=new m(this._privyInternal,d,y,u),this.guest=new o(this._privyInternal,d),this.siwe=new n(this._privyInternal,d),this.siws=new p(this._privyInternal,d),this.smartWallet=new h(this._privyInternal),this.passkey=new l(this._privyInternal,d),this.farcaster=new i(this._privyInternal,d),this.farcasterV2=new s(this._privyInternal,d)}}export{d as default};
@@ -1 +1 @@
1
- import{CustomJWTAuthenticate as e}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as t}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class s{async syncWithToken(s,l,i){let r=await this._privyInternal.fetch(e,{body:{token:s,mode:i}});await this._privyInternal.session.updateWithTokensResponse(r);let a=await t(this._embedded,r,l?.embedded);return this._privyInternal.callbacks?.setUser?.(a.user),a}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{s as default};
1
+ import{CustomJWTAuthenticate as e}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as t}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class s{async syncWithToken(s,l,i){let d=await this._privyInternal.fetch(e,{body:{token:s,mode:i}});await this._privyInternal.session.updateWithTokensResponse(d);let r=await t(this._embedded,d,l?.embedded);return this._privyInternal.callbacks?.setUser?.(r.user),r}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{s as default};
@@ -1 +1 @@
1
- import{PasswordlessInit as e,PasswordlessAuthenticate as t,PasswordlessLink as i,PasswordlessUpdate as s,PasswordlessUnlink as r}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as a}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class d{async sendCode(t,i){return this._privyInternal.fetch(e,{body:{email:t,token:i}})}async loginWithCode(e,i,s,r){let d=await this._privyInternal.fetch(t,{body:{email:e,code:i,mode:s}});await this._privyInternal.session.updateWithTokensResponse(d);let n=await a(this._embedded,d,r?.embedded);return this._privyInternal.callbacks?.setUser?.(n.user),n}async linkWithCode(e,t){await this._privyInternal.fetch(i,{body:{email:e,code:t}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}async updateEmail({oldEmailAddress:e,newEmailAddress:t,code:i}){await this._privyInternal.fetch(s,{body:{oldAddress:e,newAddress:t,code:i}});let r=await this._privyInternal.refreshSession();return{user:r.user,identity_token:r.identity_token}}async unlink(e){await this._privyInternal.fetch(r,{body:{address:e}});let t=await this._privyInternal.refreshSession();return{user:t.user,identity_token:t.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{d as default};
1
+ import{PasswordlessInit as e,PasswordlessAuthenticate as t,PasswordlessLink as i,PasswordlessUpdate as s,PasswordlessUnlink as r}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as d}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class a{async sendCode(t,i){return this._privyInternal.fetch(e,{body:{email:t,token:i}})}async loginWithCode(e,i,s,r){let a=await this._privyInternal.fetch(t,{body:{email:e,code:i,mode:s}});await this._privyInternal.session.updateWithTokensResponse(a);let l=await d(this._embedded,a,r?.embedded);return this._privyInternal.callbacks?.setUser?.(l.user),l}async linkWithCode(e,t){await this._privyInternal.fetch(i,{body:{email:e,code:t}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}async updateEmail({oldEmailAddress:e,newEmailAddress:t,code:i}){await this._privyInternal.fetch(s,{body:{oldAddress:e,newAddress:t,code:i}});let r=await this._privyInternal.refreshSession();return{user:r.user,identity_token:r.identity_token}}async unlink(e){await this._privyInternal.fetch(r,{body:{address:e}});let t=await this._privyInternal.refreshSession();return{user:t.user,identity_token:t.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{a as default};
@@ -1 +1 @@
1
- import{FarcasterInit as e,FarcasterStatus as t,FarcasterAuthenticate as i,FarcasterLink as r,FarcasterUnlink as a}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as n}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class s{async initializeAuth({relyingParty:t,redirectUrl:i,token:r}){return await this._privyInternal.fetch(e,{body:{relying_party:t,redirect_url:i,token:r}})}async getFarcasterStatus({channel_token:e}){return await this._privyInternal.fetch(t,{headers:{"farcaster-channel-token":e}})}async authenticate({channel_token:e,message:t,signature:r,fid:a,mode:s},l){let d=await this._privyInternal.fetch(i,{body:{channel_token:e,message:t,signature:r,fid:a,mode:s}});await this._privyInternal.session.updateWithTokensResponse(d);let o=await n(this._embedded,d,l?.embedded);return this._privyInternal.callbacks?.setUser?.(o.user),o}async link({channel_token:e,message:t,signature:i,fid:a}){await this._privyInternal.fetch(r,{body:{channel_token:e,message:t,signature:i,fid:a}});let n=await this._privyInternal.refreshSession();return{user:n.user,identity_token:n.identity_token}}async unlink({fid:e}){await this._privyInternal.fetch(a,{body:{fid:e}});let t=await this._privyInternal.refreshSession();return{user:t.user,identity_token:t.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{s as default};
1
+ import{FarcasterInit as e,FarcasterStatus as t,FarcasterAuthenticate as i,FarcasterLink as r,FarcasterUnlink as a}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as s}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class n{async initializeAuth({relyingParty:t,redirectUrl:i,token:r}){return await this._privyInternal.fetch(e,{body:{relying_party:t,redirect_url:i,token:r}})}async getFarcasterStatus({channel_token:e}){return await this._privyInternal.fetch(t,{headers:{"farcaster-channel-token":e}})}async authenticate({channel_token:e,message:t,signature:r,fid:a,mode:n},l){let d=await this._privyInternal.fetch(i,{body:{channel_token:e,message:t,signature:r,fid:a,mode:n}});await this._privyInternal.session.updateWithTokensResponse(d);let o=await s(this._embedded,d,l?.embedded);return this._privyInternal.callbacks?.setUser?.(o.user),o}async link({channel_token:e,message:t,signature:i,fid:a}){await this._privyInternal.fetch(r,{body:{channel_token:e,message:t,signature:i,fid:a}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}async unlink({fid:e}){await this._privyInternal.fetch(a,{body:{fid:e}});let t=await this._privyInternal.refreshSession();return{user:t.user,identity_token:t.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{n as default};
@@ -1 +1 @@
1
- import{FarcasterV2Init as e,FarcasterV2Authenticate as t}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as s}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class i{async initializeAuth(){return await this._privyInternal.fetch(e,{body:{}})}async authenticate({message:e,signature:i,fid:a},l){let r=await this._privyInternal.fetch(t,{body:{message:e,signature:i,fid:a}});await this._privyInternal.session.updateWithTokensResponse(r);let d=await s(this._embedded,r,l?.embedded);return this._privyInternal.callbacks?.setUser?.(d.user),d}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{i as default};
1
+ import{FarcasterV2Init as e,FarcasterV2Authenticate as t}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as s}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class i{async initializeAuth(){return await this._privyInternal.fetch(e,{body:{}})}async authenticate({message:e,signature:i,fid:a},l){let r=await this._privyInternal.fetch(t,{body:{message:e,signature:i,fid:a}});await this._privyInternal.session.updateWithTokensResponse(r);let d=await s(this._embedded,r,l?.embedded);return this._privyInternal.callbacks?.setUser?.(d.user),d}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{i as default};
@@ -1 +1 @@
1
- import{GuestAuthenticate as e}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as t}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class s{async create(s){let l=await this._privyInternal.session.getOrCreateGuestCredential(),r=await this._privyInternal.fetch(e,{body:{guest_credential:l}});await this._privyInternal.session.updateWithTokensResponse(r);let a=await t(this._embedded,r,s?.embedded);return this._privyInternal.callbacks?.setUser?.(a.user),a}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{s as default};
1
+ import{GuestAuthenticate as e}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as t}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class s{async create(s){let l=await this._privyInternal.session.getOrCreateGuestCredential(),r=await this._privyInternal.fetch(e,{body:{guest_credential:l}});await this._privyInternal.session.updateWithTokensResponse(r);let i=await t(this._embedded,r,s?.embedded);return this._privyInternal.callbacks?.setUser?.(i.user),i}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{s as default};
@@ -1 +1 @@
1
- import{OAuthInit as e,OAuthAuthenticate as t,OAuthLink as i,OAuthUnlink as r}from"@privy-io/public-api";import{PrivyClientError as s}from"../../Error.mjs";import{createCodeVerifier as a,createStateCode as o,deriveCodeChallengeFromCodeVerifier as l,CODE_VERIFIER_KEY as d,STATE_CODE_KEY as n}from"../../pkce.mjs";import{maybeCreateWalletOnLogin as h}from"./maybeCreateWalletOnLogin.mjs";import"jose";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class p{async generateURL(t,i){let r=a(),s=o(),h=await l({codeVerifier:r,digest:this._crypto?.digest});return await Promise.all([this._storage.put(d,r),this._storage.put(n,s)]),this._privyInternal.fetch(e,{body:{redirect_to:i,provider:t,code_challenge:h,state_code:s}})}async loginWithCode(e,i,r,a,o,l){let[p,_]=await Promise.all([this._storage.get(d),this._storage.get(n)]);if(_!==i)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:r,storedStateCode:_??"",returnedStateCode:i??""}),new s({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let m=await this._privyInternal.fetch(t,{body:{authorization_code:e,code_type:a,state_code:_,code_verifier:p,mode:o}});await this._privyInternal.session.updateWithTokensResponse(m);let c=await h(this._embedded,m,l?.embedded);return await Promise.all([this._storage.del(d),this._storage.del(n)]),this._privyInternal.callbacks?.setUser?.(c.user),c}async linkWithCode(e,t,r,a){let[o,l]=await Promise.all([this._storage.get(d),this._storage.get(n)]);if(l!==t)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:r,storedStateCode:l??"",returnedStateCode:t??""}),new s({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let h=await this._privyInternal.fetch(i,{body:{authorization_code:e,code_type:a,state_code:l,code_verifier:o}});await this._privyInternal.session.processOAuthTokens(h.oauth_tokens);let p=await this._privyInternal.refreshSession();return await Promise.all([this._storage.del(d),this._storage.del(n)]),{user:p.user,identity_token:p.identity_token}}async unlink(e,t){await this._privyInternal.fetch(r,{body:{provider:e,subject:t}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}constructor(e,t,i,r){this._privyInternal=e,this._embedded=t,this._storage=i,this._crypto=r}}export{p as default};
1
+ import{OAuthInit as e,OAuthAuthenticate as t,OAuthLink as i,OAuthUnlink as s}from"@privy-io/public-api";import{PrivyClientError as r}from"../../Error.mjs";import{createCodeVerifier as a,createStateCode as o,deriveCodeChallengeFromCodeVerifier as l,CODE_VERIFIER_KEY as d,STATE_CODE_KEY as n}from"../../pkce.mjs";import{maybeCreateWalletOnLogin as h}from"./maybeCreateWalletOnLogin.mjs";import"jose";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class p{async generateURL(t,i){let s=a(),r=o(),h=await l({codeVerifier:s,digest:this._crypto?.digest});return await Promise.all([this._storage.put(d,s),this._storage.put(n,r)]),this._privyInternal.fetch(e,{body:{redirect_to:i,provider:t,code_challenge:h,state_code:r}})}async loginWithCode(e,i,s,a,o,l){let[p,m]=await Promise.all([this._storage.get(d),this._storage.get(n)]);if(m!==i)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:s,storedStateCode:m??"",returnedStateCode:i??""}),new r({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let _=await this._privyInternal.fetch(t,{body:{authorization_code:e,code_type:a,state_code:m,code_verifier:p,mode:o}});await this._privyInternal.session.updateWithTokensResponse(_);let c=await h(this._embedded,_,l?.embedded);return await Promise.all([this._storage.del(d),this._storage.del(n)]),this._privyInternal.callbacks?.setUser?.(c.user),c}async linkWithCode(e,t,s,a){let[o,l]=await Promise.all([this._storage.get(d),this._storage.get(n)]);if(l!==t)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:s,storedStateCode:l??"",returnedStateCode:t??""}),new r({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let h=await this._privyInternal.fetch(i,{body:{authorization_code:e,code_type:a,state_code:l,code_verifier:o}});await this._privyInternal.session.processOAuthTokens(h.oauth_tokens);let p=await this._privyInternal.refreshSession();return await Promise.all([this._storage.del(d),this._storage.del(n)]),{user:p.user,identity_token:p.identity_token}}async unlink(e,t){await this._privyInternal.fetch(s,{body:{provider:e,subject:t}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}constructor(e,t,i,s){this._privyInternal=e,this._embedded=t,this._storage=i,this._crypto=s}}export{p as default};
@@ -1 +1 @@
1
- import{PasskeyLinkInit as e,PasskeyAuthenticateInit as t,PasskeyRegisterInit as s,PasskeyAuthenticate as a,PasskeyRegister as n,PasskeyLink as i}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as r}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class o{async generateRegistrationOptions(t){return await this._privyInternal.fetch(e,{body:{relying_party:t}})}async generateAuthenticationOptions(e){return await this._privyInternal.fetch(t,{body:{relying_party:e}})}async generateSignupOptions(e){return await this._privyInternal.fetch(s,{body:{relying_party:e}})}async loginWithPasskey(e,t,s,n){let i=await this._privyInternal.fetch(a,{body:{relying_party:s,challenge:t,authenticator_response:this._transformAuthenticationResponseToSnakeCase(e)}});await this._privyInternal.session.updateWithTokensResponse(i);let o=await r(this._embedded,i,n?.embedded);return this._privyInternal.callbacks?.setUser?.(o.user),o}async signupWithPasskey(e,t,s){let a=await this._privyInternal.fetch(n,{body:{relying_party:t,authenticator_response:this._transformRegistrationResponseToSnakeCase(e)}});await this._privyInternal.session.updateWithTokensResponse(a);let i=await r(this._embedded,a,s?.embedded);return this._privyInternal.callbacks?.setUser?.(i.user),i}async linkWithPasskey(e,t){await this._privyInternal.fetch(i,{body:{relying_party:t,authenticator_response:this._transformRegistrationResponseToSnakeCase(e)}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}_transformRegistrationResponseToSnakeCase(e){return{type:e.type,id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,attestation_object:e.response.attestationObject,authenticator_data:e.response.authenticatorData||void 0,transports:e.response.transports||void 0,public_key:e.response.publicKey||void 0,public_key_algorithm:e.response.publicKeyAlgorithm||void 0},authenticator_attachment:e.authenticatorAttachment||void 0,client_extension_results:{app_id:e.clientExtensionResults.appid||void 0,cred_props:e.clientExtensionResults.credProps||void 0,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret||void 0}}}_transformAuthenticationResponseToSnakeCase(e){return{type:e.type,id:e.id,raw_id:e.rawId,response:{signature:e.response.signature,client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,user_handle:e.response.userHandle||void 0},authenticator_attachment:e.authenticatorAttachment||void 0,client_extension_results:{app_id:e.clientExtensionResults.appid||void 0,cred_props:e.clientExtensionResults.credProps||void 0,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret||void 0}}}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{o as default};
1
+ import{PasskeyLinkInit as e,PasskeyAuthenticateInit as t,PasskeyRegisterInit as s,PasskeyAuthenticate as a,PasskeyRegister as i,PasskeyLink as n}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as r}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class o{async generateRegistrationOptions(t){return await this._privyInternal.fetch(e,{body:{relying_party:t}})}async generateAuthenticationOptions(e){return await this._privyInternal.fetch(t,{body:{relying_party:e}})}async generateSignupOptions(e){return await this._privyInternal.fetch(s,{body:{relying_party:e}})}async loginWithPasskey(e,t,s,i){let n=await this._privyInternal.fetch(a,{body:{relying_party:s,challenge:t,authenticator_response:this._transformAuthenticationResponseToSnakeCase(e)}});await this._privyInternal.session.updateWithTokensResponse(n);let o=await r(this._embedded,n,i?.embedded);return this._privyInternal.callbacks?.setUser?.(o.user),o}async signupWithPasskey(e,t,s){let a=await this._privyInternal.fetch(i,{body:{relying_party:t,authenticator_response:this._transformRegistrationResponseToSnakeCase(e)}});await this._privyInternal.session.updateWithTokensResponse(a);let n=await r(this._embedded,a,s?.embedded);return this._privyInternal.callbacks?.setUser?.(n.user),n}async linkWithPasskey(e,t){await this._privyInternal.fetch(n,{body:{relying_party:t,authenticator_response:this._transformRegistrationResponseToSnakeCase(e)}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}_transformRegistrationResponseToSnakeCase(e){return{type:e.type,id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,attestation_object:e.response.attestationObject,authenticator_data:e.response.authenticatorData||void 0,transports:e.response.transports||void 0,public_key:e.response.publicKey||void 0,public_key_algorithm:e.response.publicKeyAlgorithm||void 0},authenticator_attachment:e.authenticatorAttachment||void 0,client_extension_results:{app_id:e.clientExtensionResults.appid||void 0,cred_props:e.clientExtensionResults.credProps||void 0,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret||void 0}}}_transformAuthenticationResponseToSnakeCase(e){return{type:e.type,id:e.id,raw_id:e.rawId,response:{signature:e.response.signature,client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,user_handle:e.response.userHandle||void 0},authenticator_attachment:e.authenticatorAttachment||void 0,client_extension_results:{app_id:e.clientExtensionResults.appid||void 0,cred_props:e.clientExtensionResults.credProps||void 0,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret||void 0}}}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{o as default};
@@ -1 +1 @@
1
- import{PasswordlessSmsInit as e,PasswordlessSmsAuthenticate as t,PasswordlessSmsLink as r,PasswordlessSmsUpdate as i,PasswordlessSmsUnlink as n}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as s}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class o{async sendCode(t,r){return this._privyInternal.fetch(e,{body:{phoneNumber:t,token:r}})}async loginWithCode(e,r,i,n){let o=await this._privyInternal.fetch(t,{body:{phoneNumber:e,code:r,mode:i}});await this._privyInternal.session.updateWithTokensResponse(o);let a=await s(this._embedded,o,n?.embedded);return this._privyInternal.callbacks?.setUser?.(a.user),a}async linkWithCode(e,t){await this._privyInternal.fetch(r,{body:{phoneNumber:e,code:t}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}async updatePhone({oldPhoneNumber:e,newPhoneNumber:t,code:r}){await this._privyInternal.fetch(i,{body:{old_phone_number:e,new_phone_number:t,code:r}});let n=await this._privyInternal.refreshSession();return{user:n.user,identity_token:n.identity_token}}async unlink(e){await this._privyInternal.fetch(n,{body:{phoneNumber:e}});let t=await this._privyInternal.refreshSession();return{user:t.user,identity_token:t.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{o as default};
1
+ import{PasswordlessSmsInit as e,PasswordlessSmsAuthenticate as t,PasswordlessSmsLink as r,PasswordlessSmsUpdate as i,PasswordlessSmsUnlink as n}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as s}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class o{async sendCode(t,r){return this._privyInternal.fetch(e,{body:{phoneNumber:t,token:r}})}async loginWithCode(e,r,i,n){let o=await this._privyInternal.fetch(t,{body:{phoneNumber:e,code:r,mode:i}});await this._privyInternal.session.updateWithTokensResponse(o);let a=await s(this._embedded,o,n?.embedded);return this._privyInternal.callbacks?.setUser?.(a.user),a}async linkWithCode(e,t){await this._privyInternal.fetch(r,{body:{phoneNumber:e,code:t}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}async updatePhone({oldPhoneNumber:e,newPhoneNumber:t,code:r}){await this._privyInternal.fetch(i,{body:{old_phone_number:e,new_phone_number:t,code:r}});let n=await this._privyInternal.refreshSession();return{user:n.user,identity_token:n.identity_token}}async unlink(e){await this._privyInternal.fetch(n,{body:{phoneNumber:e}});let t=await this._privyInternal.refreshSession();return{user:t.user,identity_token:t.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{o as default};
@@ -1 +1 @@
1
- import{SiweUnlink as e,SiweLink as t,SiweAuthenticate as i,SiweInit as n}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as s}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class a{async unlinkWallet(t){await this._privyInternal.fetch(e,{body:{address:t}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}async linkWithSiwe(e,i,n){let s=i||this._wallet,a=n||this._preparedMessage;if(!s)throw Error("A wallet must be provided in the init step or as an argument to linkWithSiwe");if(!a)throw Error("A message must be generated and signed before being used to link a wallet to privy");await this._privyInternal.fetch(t,{body:{message:a,signature:e,chainId:s.chainId,walletClientType:s.walletClientType,connectorType:s.connectorType}});let r=await this._privyInternal.refreshSession();return{user:r.user,identity_token:r.identity_token}}async loginWithSiwe(e,t,n,a,r){let o=t||this._wallet,l=n||this._preparedMessage;if(!o)throw Error("A wallet must be provided in the init step or as an argument to loginWithSiwe");if(!l)throw Error("A message must be generated and signed before being used to login to privy with a wallet");let d=await this._privyInternal.fetch(i,{body:{signature:e,message:l,chainId:o.chainId,walletClientType:o.walletClientType,connectorType:o.connectorType,mode:a}});await this._privyInternal.session.updateWithTokensResponse(d);let h=await s(this._embedded,d,r?.embedded);return this._privyInternal.callbacks?.setUser?.(h.user),h}async init(e,t,i){var s;this._wallet=e;let{nonce:a}=await this._privyInternal.fetch(n,{body:{address:e.address}}),r=`${(s={chainId:e.chainId.toString().replace("eip155:",""),address:e.address,issuedAt:(new Date).toISOString(),statement:"By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",domain:t,nonce:a,uri:i}).domain} wants you to sign in with your Ethereum account:\n${s.address}\n\n${s.statement}\n\nURI: ${s.uri}\nVersion: 1\nChain ID: ${s.chainId}\nNonce: ${s.nonce}\nIssued At: ${s.issuedAt}\nResources:\n- https://privy.io`;return this._preparedMessage=r,{nonce:a,message:r}}constructor(e,t){this._wallet=void 0,this._privyInternal=e,this._embedded=t}}export{a as default};
1
+ import{SiweUnlink as e,SiweLink as t,SiweAuthenticate as i,SiweInit as n}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as s}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class a{async unlinkWallet(t){await this._privyInternal.fetch(e,{body:{address:t}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}async linkWithSiwe(e,i,n){let s=i||this._wallet,a=n||this._preparedMessage;if(!s)throw Error("A wallet must be provided in the init step or as an argument to linkWithSiwe");if(!a)throw Error("A message must be generated and signed before being used to link a wallet to privy");await this._privyInternal.fetch(t,{body:{message:a,signature:e,chainId:s.chainId,walletClientType:s.walletClientType,connectorType:s.connectorType}});let r=await this._privyInternal.refreshSession();return{user:r.user,identity_token:r.identity_token}}async loginWithSiwe(e,t,n,a,r){let l=t||this._wallet,o=n||this._preparedMessage;if(!l)throw Error("A wallet must be provided in the init step or as an argument to loginWithSiwe");if(!o)throw Error("A message must be generated and signed before being used to login to privy with a wallet");let d=await this._privyInternal.fetch(i,{body:{signature:e,message:o,chainId:l.chainId,walletClientType:l.walletClientType,connectorType:l.connectorType,mode:a}});await this._privyInternal.session.updateWithTokensResponse(d);let h=await s(this._embedded,d,r?.embedded);return this._privyInternal.callbacks?.setUser?.(h.user),h}async init(e,t,i){var s;this._wallet=e;let{nonce:a}=await this._privyInternal.fetch(n,{body:{address:e.address}}),r=`${(s={chainId:e.chainId.toString().replace("eip155:",""),address:e.address,issuedAt:(new Date).toISOString(),statement:"By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",domain:t,nonce:a,uri:i}).domain} wants you to sign in with your Ethereum account:\n${s.address}\n\n${s.statement}\n\nURI: ${s.uri}\nVersion: 1\nChain ID: ${s.chainId}\nNonce: ${s.nonce}\nIssued At: ${s.issuedAt}\nResources:\n- https://privy.io`;return this._preparedMessage=r,{nonce:a,message:r}}constructor(e,t){this._wallet=void 0,this._privyInternal=e,this._embedded=t}}export{a as default};
@@ -1 +1 @@
1
- import{SiwsUnlink as e,SiwsLink as t,SiwsAuthenticate as s,SiwsInit as r}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as i}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class n{async unlink({address:t}){await this._privyInternal.fetch(e,{body:{address:t}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}async link({message:e,signature:s,walletClientType:r,connectorType:i}){await this._privyInternal.fetch(t,{body:{message:e,signature:s,walletClientType:r,connectorType:i}});let n=await this._privyInternal.refreshSession();return{user:n.user,identity_token:n.identity_token}}async login({mode:e,message:t,signature:r,walletClientType:n,connectorType:a,opts:l}){let d=await this._privyInternal.fetch(s,{body:{signature:r,message:t,walletClientType:n,connectorType:a,mode:e}});await this._privyInternal.session.updateWithTokensResponse(d);let o=await i(this._embedded,d,l?.embedded);return this._privyInternal.callbacks?.setUser?.(o.user),o}async fetchNonce({address:e}){let{nonce:t}=await this._privyInternal.fetch(r,{body:{address:e}});return{nonce:t}}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{n as default};
1
+ import{SiwsUnlink as e,SiwsLink as t,SiwsAuthenticate as s,SiwsInit as i}from"@privy-io/public-api";import{maybeCreateWalletOnLogin as r}from"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class n{async unlink({address:t}){await this._privyInternal.fetch(e,{body:{address:t}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}async link({message:e,signature:s,walletClientType:i,connectorType:r}){await this._privyInternal.fetch(t,{body:{message:e,signature:s,walletClientType:i,connectorType:r}});let n=await this._privyInternal.refreshSession();return{user:n.user,identity_token:n.identity_token}}async login({mode:e,message:t,signature:i,walletClientType:n,connectorType:a,opts:l}){let d=await this._privyInternal.fetch(s,{body:{signature:i,message:t,walletClientType:n,connectorType:a,mode:e}});await this._privyInternal.session.updateWithTokensResponse(d);let o=await r(this._embedded,d,l?.embedded);return this._privyInternal.callbacks?.setUser?.(o.user),o}async fetchNonce({address:e}){let{nonce:t}=await this._privyInternal.fetch(i,{body:{address:e}});return{nonce:t}}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{n as default};
@@ -1 +1 @@
1
- import{getUserEmbeddedEthereumWallet as e}from"../../utils/getUserEmbeddedEthereumWallet.mjs";import{getUserEmbeddedSolanaWallet as t}from"../../utils/getUserEmbeddedSolanaWallet.mjs";import{shouldCreateEmbeddedEthWallet as r}from"../../utils/shouldCreateEmbeddedEthWallet.mjs";import{shouldCreateEmbeddedSolWallet as s}from"../../utils/shouldCreateEmbeddedSolWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";const o=async(o,a,l)=>{let u=r(a.user,l?.ethereum?.createOnLogin??"off"),i=s(a.user,l?.solana?.createOnLogin??"off");if(u&&i){let t=await o.create({recoveryMethod:"privy",skipCallbacks:!0});return{...await o.createSolana({ethereumAccount:e(t.user)??void 0}),is_new_user:a.is_new_user,oauth_tokens:a.oauth_tokens}}return u?{...await o.create({recoveryMethod:"privy",solanaAccount:t(a.user)??void 0}),is_new_user:a.is_new_user,oauth_tokens:a.oauth_tokens}:i?{...await o.createSolana({ethereumAccount:e(a.user)??void 0}),is_new_user:a.is_new_user,oauth_tokens:a.oauth_tokens}:a};export{o as maybeCreateWalletOnLogin};
1
+ import{getUserEmbeddedEthereumWallet as e}from"../../utils/getUserEmbeddedEthereumWallet.mjs";import{getUserEmbeddedSolanaWallet as t}from"../../utils/getUserEmbeddedSolanaWallet.mjs";import{shouldCreateEmbeddedEthWallet as s}from"../../utils/shouldCreateEmbeddedEthWallet.mjs";import{shouldCreateEmbeddedSolWallet as r}from"../../utils/shouldCreateEmbeddedSolWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";const o=async(o,a,l)=>{let u=s(a.user,l?.ethereum?.createOnLogin??"off"),i=r(a.user,l?.solana?.createOnLogin??"off");if(u&&i){let t=await o.create({recoveryMethod:"privy",skipCallbacks:!0});return{...await o.createSolana({ethereumAccount:e(t.user)??void 0}),is_new_user:a.is_new_user,oauth_tokens:a.oauth_tokens}}return u?{...await o.create({recoveryMethod:"privy",solanaAccount:t(a.user)??void 0}),is_new_user:a.is_new_user,oauth_tokens:a.oauth_tokens}:i?{...await o.createSolana({ethereumAccount:e(a.user)??void 0}),is_new_user:a.is_new_user,oauth_tokens:a.oauth_tokens}:a};export{o as maybeCreateWalletOnLogin};
@@ -1 +1 @@
1
- import{PrivyClientError as e}from"../Error.mjs";class t{async sign({message:e}){return await this.request({method:"sign",params:{message:new TextDecoder("utf8").decode(e)}})}async signTransaction({psbt:e}){return await this.request({method:"signTransaction",params:{psbt:e}})}async request(t){if(!await this._privyInternal.getAccessToken())throw new e({error:"Missing access token",code:"attempted_rpc_call_before_logged_in"});return this.handleIFrameRpc(t)}async handleIFrameRpc(t){try{let e=await this._privyInternal.getAccessToken();if(!e)throw Error("Missing access token. User must be authenticated.");return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:t.method,address:this._account.address}),(await this._proxy.rpcWallet({accessToken:e,request:t,entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,hdWalletIndex:this._account.wallet_index,chainType:this._account.chain_type})).response.data}catch(r){console.error(r);let s=r instanceof Error?r.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:t.method,address:this._account.address,error:s}),new e({code:"embedded_wallet_request_error",error:s})}}toJSON(){return`PrivyEmbeddedBitcoinProvider { address: '${this._account.address}', request: [Function] }`}constructor({proxy:e,privyInternal:t,account:r,entropyId:s,entropyIdVerifier:a}){this._proxy=e,this._privyInternal=t,this._account=r,this._entropyId=s,this._entropyIdVerifier=a}}export{t as EmbeddedBitcoinWalletProvider};
1
+ import{PrivyClientError as e}from"../Error.mjs";import{isUnifiedWallet as t}from"../wallet-api/unified-wallet.mjs";class r{async sign({message:e}){return await this.request({method:"sign",params:{message:new TextDecoder("utf8").decode(e)}})}async signTransaction({psbt:e}){return await this.request({method:"signTransaction",params:{psbt:e}})}async request(r){if(t(this._account))throw new e({code:"unsupported_wallet_type",error:"Bitcoin wallet providers are only supported for on-device execution and this app uses TEE execution. Use the useSignRawHash hook from @privy-io/expo/extended-chains to sign over a hash with this wallet. Learn more at https://docs.privy.io/recipes/tee-wallet-migration-guide"});if(!await this._privyInternal.getAccessToken())throw new e({error:"Missing access token",code:"attempted_rpc_call_before_logged_in"});return this.handleIFrameRpc(r)}async handleIFrameRpc(t){try{let e=await this._privyInternal.getAccessToken();if(!e)throw Error("Missing access token. User must be authenticated.");return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:t.method,address:this._account.address}),(await this._proxy.rpcWallet({accessToken:e,request:t,entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,hdWalletIndex:this._account.wallet_index,chainType:this._account.chain_type})).response.data}catch(r){console.error(r);let s=r instanceof Error?r.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:t.method,address:this._account.address,error:s}),new e({code:"embedded_wallet_request_error",error:s})}}toJSON(){return`PrivyEmbeddedBitcoinProvider { address: '${this._account.address}', request: [Function] }`}constructor({proxy:e,privyInternal:t,account:r,entropyId:s,entropyIdVerifier:a}){this._proxy=e,this._privyInternal=t,this._account=r,this._entropyId=s,this._entropyIdVerifier=a}}export{r as EmbeddedBitcoinWalletProvider};
@@ -1 +1 @@
1
- import{getRootWalletForDelegation as e}from"../../action/delegatedActions/utils.mjs";import{getWallet as t}from"../../wallet-api/get-wallet.mjs";import{isUnifiedWallet as r}from"../../wallet-api/unified-wallet.mjs";import{updateWallet as i}from"../../wallet-api/update-wallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"@privy-io/public-api";import"../../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"../../Error.mjs";async function a({client:a,wallet:s,signers:o}){if("ethereum"!==s.chain_type&&"solana"!==s.chain_type)throw Error("Session signers are only supported for Ethereum and Solana wallets");if(r(s)){if(0===o.length)throw Error("Must specify at least one signer to add.");let e={wallet_id:s.id},r=await t(a,e);await i(a,e,n(a),{additional_signers:r.additional_signers.concat(o)})}else{if(s.delegated)return l(a);if(o.length>0)throw Error("Specifying signers in addSessionSigners is only supported for TEE execution and this app uses On-device execution. Pass an empty array for signers instead. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");let{user:t}=await a.user.get(),r=e(s,t);if(!r)throw Error("Unable to determine root address for delegated address.");await a.embeddedWallet.delegateWallets({rootWallet:{address:r.address,chainType:r.chain_type,imported:r.imported},delegatedWallets:[{address:s.address,chainType:s.chain_type,walletIndex:s.wallet_index}]})}return l(a)}async function s({client:e,wallet:t}){if(r(t)){let r={wallet_id:t.id};await i(e,r,n(e),{additional_signers:[]})}else await e.delegated.revoke();return l(e)}async function l(e){let{user:t}=await e.user.get();if(!t)throw Error("Could not refresh user");return{user:t}}function n(e){return(...t)=>e.embeddedWallet.signWithUserSigner(...t)}export{a as addSessionSigners,s as removeSessionSigners};
1
+ import{getRootWalletForDelegation as e}from"../../action/delegatedActions/utils.mjs";import{getWallet as t}from"../../wallet-api/get-wallet.mjs";import{isUnifiedWallet as r}from"../../wallet-api/unified-wallet.mjs";import{updateWallet as i}from"../../wallet-api/update-wallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"@privy-io/public-api";import"../../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"../../Error.mjs";async function a({client:a,wallet:s,signers:d}){if("ethereum"!==s.chain_type&&"solana"!==s.chain_type)throw Error("Session signers are only supported for Ethereum and Solana wallets");if(r(s)){if(0===d.length)throw Error("Must specify at least one signer to add.");let e={wallet_id:s.id},r=await t(a,e);await i(a,e,o(a),{additional_signers:r.additional_signers.concat(d)})}else{if(s.delegated)return l(a);if(d.length>0)throw Error("Specifying signers in addSessionSigners is only supported for TEE execution and this app uses On-device execution. Pass an empty array for signers instead. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");let{user:t}=await a.user.get(),r=e(s,t);if(!r)throw Error("Unable to determine root address for delegated address.");await a.embeddedWallet.delegateWallets({rootWallet:{address:r.address,chainType:r.chain_type,imported:r.imported},delegatedWallets:[{address:s.address,chainType:s.chain_type,walletIndex:s.wallet_index}]})}return l(a)}async function s({client:e,wallet:t}){if(r(t)){let r={wallet_id:t.id};await i(e,r,o(e),{additional_signers:[]})}else await e.delegated.revoke();return l(e)}async function l(e){let{user:t}=await e.user.get();if(!t)throw Error("Could not refresh user");return{user:t}}function o(e){return(...t)=>e.embeddedWallet.signWithUserSigner(...t)}export{a as addSessionSigners,s as removeSessionSigners};
@@ -1 +1 @@
1
- import{createSmartAccountClient as e}from"permissionless";import{toThirdwebSmartAccount as r,toLightSmartAccount as t,toBiconomySmartAccount as a,toKernelSmartAccount as i,toSafeSmartAccount as n}from"permissionless/accounts";import{createPimlicoClient as s}from"permissionless/clients/pimlico";import{http as o}from"viem";import{toCoinbaseSmartAccount as c,entryPoint06Address as l,entryPoint07Address as m}from"viem/account-abstraction";import{THIRDWEB as p,COINBASE_SMART_WALLET as u,LIGHT_ACCOUNT as y,BICONOMY as P,KERNEL as d,SAFE as w}from"@privy-io/public-api";let f={address:l,version:"0.6"},h={address:m,version:"0.7"},b=({owner:e,smartWalletType:s,publicClient:o})=>{switch(s){case w:return n({client:o,entryPoint:h,owners:[e],version:"1.4.1"});case d:return i({client:o,version:"0.3.1",entryPoint:h,useMetaFactory:"optional",owners:[e]});case P:return a({client:o,owners:[e],entryPoint:f});case y:return t({client:o,entryPoint:f,owner:e,version:"1.1.0"});case u:return async function({client:e,owner:r}){let[t]=await r.request({method:"eth_accounts"});if(!t)throw Error("Unable to request embedded owner for eth_accounts");return await c({client:e,owners:[{type:"local",source:"privy",address:t,sign:async({hash:e})=>await r.request({method:"secp256k1_sign",params:[e]})}]})}({client:o,owner:e});case p:return r({client:o,entryPoint:h,owner:e});default:throw Error(`Invalid smart account type: ${s}.`)}};const F=async({owner:r,smartWalletType:t,chain:a,publicClient:i,bundlerUrl:n,paymasterUrl:c,paymasterContext:l})=>{let m=await b({owner:r,smartWalletType:t,publicClient:i}),p=s({transport:o(n),entryPoint:m.entryPoint}),u=c?s({transport:o(c),entryPoint:m.entryPoint}):void 0;return e({account:m,chain:a,paymaster:u,paymasterContext:l,bundlerTransport:o(n),userOperation:{estimateFeesPerGas:async()=>{if(["public.pimlico.io","api.pimlico.io"].some((e=>n.includes(e))))return await p.getUserOperationGasPrice().then((e=>e.fast));if(["rpc.zerodev.app"].some((e=>n.includes(e))))return(await p.request({method:"zd_getUserOperationGasPrice",params:[]})).fast;if(["g.alchemy.com"].some((e=>n.includes(e)))){let[e,r]=await Promise.all([i.getBlock({blockTag:"latest"}),p.request({method:"rundler_maxPriorityFeePerGas",params:[]})]);if(!e.baseFeePerGas||!r)throw Error("Failed to get block or maxPriorityFeePerGasEstimate");return{maxFeePerGas:150n*e.baseFeePerGas/100n+BigInt(r.toString()),maxPriorityFeePerGas:BigInt(r.toString())}}{let e=await i.estimateFeesPerGas(),r=n.includes("api.developer.coinbase.com")?175n:150n;return{...e,maxFeePerGas:e.maxFeePerGas*r/100n,maxPriorityFeePerGas:e.maxPriorityFeePerGas*r/100n}}}}})};export{F as signerToSmartAccountClient};
1
+ import{createSmartAccountClient as e}from"permissionless";import{toThirdwebSmartAccount as r,toLightSmartAccount as t,toBiconomySmartAccount as a,toKernelSmartAccount as i,toSafeSmartAccount as n}from"permissionless/accounts";import{createPimlicoClient as s}from"permissionless/clients/pimlico";import{http as o}from"viem";import{toCoinbaseSmartAccount as c,entryPoint06Address as l,entryPoint07Address as m}from"viem/account-abstraction";import{THIRDWEB as p,COINBASE_SMART_WALLET as u,LIGHT_ACCOUNT as y,BICONOMY as P,KERNEL as d,SAFE as w}from"@privy-io/public-api";let f={address:l,version:"0.6"},h={address:m,version:"0.7"},b=({owner:e,smartWalletType:s,publicClient:o})=>{switch(s){case w:return n({client:o,entryPoint:h,owners:[e],version:"1.4.1"});case d:return i({client:o,version:"0.3.1",entryPoint:h,useMetaFactory:"optional",owners:[e]});case P:return a({client:o,owners:[e],entryPoint:f});case y:return t({client:o,entryPoint:f,owner:e,version:"1.1.0"});case u:return async function({client:e,owner:r}){let[t]=await r.request({method:"eth_accounts"});if(!t)throw Error("Unable to request embedded owner for eth_accounts");return await c({client:e,version:"1",owners:[{type:"local",source:"privy",address:t,sign:async({hash:e})=>await r.request({method:"secp256k1_sign",params:[e]})}]})}({client:o,owner:e});case p:return r({client:o,entryPoint:h,owner:e});default:throw Error(`Invalid smart account type: ${s}.`)}};const v=async({owner:r,smartWalletType:t,chain:a,publicClient:i,bundlerUrl:n,paymasterUrl:c,paymasterContext:l})=>{let m=await b({owner:r,smartWalletType:t,publicClient:i}),p=s({transport:o(n),entryPoint:m.entryPoint}),u=c?s({transport:o(c),entryPoint:m.entryPoint}):void 0;return e({account:m,chain:a,paymaster:u,paymasterContext:l,bundlerTransport:o(n),userOperation:{estimateFeesPerGas:async()=>{if(["public.pimlico.io","api.pimlico.io"].some((e=>n.includes(e))))return await p.getUserOperationGasPrice().then((e=>e.fast));if(["rpc.zerodev.app"].some((e=>n.includes(e))))return(await p.request({method:"zd_getUserOperationGasPrice",params:[]})).fast;if(["g.alchemy.com"].some((e=>n.includes(e)))){let[e,r]=await Promise.all([i.getBlock({blockTag:"latest"}),p.request({method:"rundler_maxPriorityFeePerGas",params:[]})]);if(!e.baseFeePerGas||!r)throw Error("Failed to get block or maxPriorityFeePerGasEstimate");return{maxFeePerGas:150n*e.baseFeePerGas/100n+BigInt(r.toString()),maxPriorityFeePerGas:BigInt(r.toString())}}{let e=await i.estimateFeesPerGas(),r=n.includes("api.developer.coinbase.com")?175n:150n;return{...e,maxFeePerGas:e.maxFeePerGas*r/100n,maxPriorityFeePerGas:e.maxPriorityFeePerGas*r/100n}}}}})};export{v as signerToSmartAccountClient};
@@ -1 +1 @@
1
- import{getUserEmbeddedEthereumWallet as e}from"./getUserEmbeddedEthereumWallet.mjs";import{getUserEmbeddedSolanaWallet as r}from"./getUserEmbeddedSolanaWallet.mjs";import"./getAllUserEmbeddedEthereumWallets.mjs";import"./getAllUserEmbeddedSolanaWallets.mjs";const t=(t,l)=>{if(!t)return null;if(l?.imported)return d(l);let a=e(t)??r(t);return a?d(a):null},d=e=>{if("ethereum"===e.chain_type)return{entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier"};if("solana"===e.chain_type)return{entropyId:e.address,entropyIdVerifier:"solana-address-verifier"};throw Error("Invalid embedded wallet account type")};export{d as getEntropyDetailsFromAccount,t as getEntropyDetailsFromUser};
1
+ import{getUserEmbeddedEthereumWallet as e}from"./getUserEmbeddedEthereumWallet.mjs";import{getUserEmbeddedSolanaWallet as r}from"./getUserEmbeddedSolanaWallet.mjs";import"./getAllUserEmbeddedEthereumWallets.mjs";import"./embedded-wallets.mjs";import"./getAllUserEmbeddedSolanaWallets.mjs";const t=(t,l)=>{if(!t)return null;if(l?.imported)return d(l);let m=e(t)??r(t);return m?d(m):null},d=e=>{if("ethereum"===e.chain_type)return{entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier"};if("solana"===e.chain_type)return{entropyId:e.address,entropyIdVerifier:"solana-address-verifier"};throw Error("Invalid embedded wallet account type")};export{d as getEntropyDetailsFromAccount,t as getEntropyDetailsFromUser};
@@ -1 +1 @@
1
- const t=t=>t?t.linked_accounts.filter(e).sort(((t,e)=>t.wallet_index-e.wallet_index)):[];let e=t=>"wallet"===t.type&&"privy"===t.wallet_client_type&&"embedded"===t.connector_type&&("bitcoin-segwit"===t.chain_type||"bitcoin-taproot"===t.chain_type);export{t as getAllUserEmbeddedBitcoinWallets};
1
+ import{isEmbeddedWalletAccount as t}from"./embedded-wallets.mjs";const e=e=>e?e.linked_accounts.filter(t).filter(i).sort(((t,e)=>t.wallet_index-e.wallet_index)):[];let i=t=>"bitcoin-segwit"===t.chain_type||"bitcoin-taproot"===t.chain_type;export{e as getAllUserEmbeddedBitcoinWallets};
@@ -1 +1 @@
1
- const e=e=>e?e.linked_accounts.filter(t).sort(((e,t)=>e.wallet_index-t.wallet_index)):[];let t=e=>"wallet"===e.type&&"privy"===e.wallet_client_type&&"embedded"===e.connector_type&&"ethereum"===e.chain_type;export{e as getAllUserEmbeddedEthereumWallets};
1
+ import{isEmbeddedWalletAccount as e}from"./embedded-wallets.mjs";const t=t=>t?t.linked_accounts.filter(e).filter((e=>"ethereum"===e.chain_type)).sort(((e,t)=>e.wallet_index-t.wallet_index)):[];export{t as getAllUserEmbeddedEthereumWallets};
@@ -1 +1 @@
1
- const e=e=>e?e.linked_accounts.filter(t).sort(((e,t)=>e.wallet_index-t.wallet_index)):[];let t=e=>"wallet"===e.type&&"privy"===e.wallet_client_type&&"embedded"===e.connector_type&&"solana"===e.chain_type;export{e as getAllUserEmbeddedSolanaWallets};
1
+ import{isEmbeddedWalletAccount as e}from"./embedded-wallets.mjs";const t=t=>t?t.linked_accounts.filter(e).filter((e=>"solana"===e.chain_type)).sort(((e,t)=>e.wallet_index-t.wallet_index)):[];export{t as getAllUserEmbeddedSolanaWallets};
@@ -1 +1 @@
1
- import{getAllUserEmbeddedEthereumWallets as e}from"./getAllUserEmbeddedEthereumWallets.mjs";const l=l=>e(l).find((e=>0===e.wallet_index))??null,t=l;export{l as getUserEmbeddedEthereumWallet,t as getUserEmbeddedWallet};
1
+ import{getAllUserEmbeddedEthereumWallets as e}from"./getAllUserEmbeddedEthereumWallets.mjs";import"./embedded-wallets.mjs";const l=l=>e(l).find((e=>0===e.wallet_index))??null,t=l;export{l as getUserEmbeddedEthereumWallet,t as getUserEmbeddedWallet};
@@ -1 +1 @@
1
- import{getAllUserEmbeddedSolanaWallets as l}from"./getAllUserEmbeddedSolanaWallets.mjs";const e=e=>l(e).find((l=>0===l.wallet_index))??null;export{e as getUserEmbeddedSolanaWallet};
1
+ import{getAllUserEmbeddedSolanaWallets as e}from"./getAllUserEmbeddedSolanaWallets.mjs";import"./embedded-wallets.mjs";const l=l=>e(l).find((e=>0===e.wallet_index))??null;export{l as getUserEmbeddedSolanaWallet};
@@ -1 +1 @@
1
- import{getAllUserEmbeddedEthereumWallets as e}from"./getAllUserEmbeddedEthereumWallets.mjs";const t=(t,l)=>!("off"===l||e(t).length>0||t.linked_accounts.filter((e=>"wallet"===e.type&&"ethereum"===e.chain_type)).length>0&&"all-users"!==l);export{t as shouldCreateEmbeddedEthWallet};
1
+ import{getAllUserEmbeddedEthereumWallets as e}from"./getAllUserEmbeddedEthereumWallets.mjs";import"./embedded-wallets.mjs";const t=(t,l)=>!("off"===l||e(t).length>0||t.linked_accounts.filter((e=>"wallet"===e.type&&"ethereum"===e.chain_type)).length>0&&"all-users"!==l);export{t as shouldCreateEmbeddedEthWallet};
@@ -1 +1 @@
1
- import{getAllUserEmbeddedSolanaWallets as e}from"./getAllUserEmbeddedSolanaWallets.mjs";const l=(l,t)=>!("off"===t||e(l).length>0||l.linked_accounts.filter((e=>"wallet"===e.type&&"solana"===e.chain_type)).length>0&&"all-users"!==t);export{l as shouldCreateEmbeddedSolWallet};
1
+ import{getAllUserEmbeddedSolanaWallets as e}from"./getAllUserEmbeddedSolanaWallets.mjs";import"./embedded-wallets.mjs";const l=(l,t)=>!("off"===t||e(l).length>0||l.linked_accounts.filter((e=>"wallet"===e.type&&"solana"===e.chain_type)).length>0&&"all-users"!==t);export{l as shouldCreateEmbeddedSolWallet};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@privy-io/js-sdk-core",
3
- "version": "0.52.6",
3
+ "version": "0.52.8",
4
4
  "description": "Vanilla JS client for the Privy Auth API",
5
5
  "keywords": [
6
6
  "authentication",
@@ -69,7 +69,7 @@
69
69
  "@ethersproject/transactions": "^5.7.0",
70
70
  "@ethersproject/units": "^5.7.0",
71
71
  "@privy-io/api-base": "1.5.2",
72
- "@privy-io/public-api": "2.39.0",
72
+ "@privy-io/public-api": "2.39.2",
73
73
  "canonicalize": "^2.0.0",
74
74
  "@privy-io/chains": "0.0.2",
75
75
  "eventemitter3": "^5.0.1",