@privy-io/react-auth 1.60.7 → 1.61.0-beta-20240423144828

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -223,6 +223,8 @@ declare const DEFAULT_SUPPORTED_CHAINS: readonly [Chain, Chain, Chain, Chain, Ch
223
223
  type WalletCreateRequestDataType = {
224
224
  accessToken: string;
225
225
  recoveryPassword?: string;
226
+ recoveryMethod?: 'user-passcode' | 'google-drive';
227
+ recoveryAccessToken?: string;
226
228
  /**
227
229
  * Will be deprecated in a future release, use `recoveryPassword` instead
228
230
  * @deprecated
@@ -245,6 +247,8 @@ type WalletRecoverRequestDataType = {
245
247
  mfaCode?: string;
246
248
  mfaMethod?: MfaMethod;
247
249
  recoveryPassword?: string;
250
+ recoveryMethod?: 'user-passcode' | 'google-drive';
251
+ recoveryAccessToken?: string;
248
252
  /**
249
253
  * Will be deprecated in a future release, use `recoveryPassword` instead
250
254
  * @deprecated
@@ -456,6 +460,7 @@ declare enum PrivyErrorCode {
456
460
  UNKNOWN_EMBEDDED_WALLET_ERROR = "unknown_embedded_wallet_error",
457
461
  EMBEDDED_WALLET_PASSWORD_UNCONFIRMED = "embedded_wallet_password_unconfirmed",
458
462
  EMBEDDED_WALLET_PASSWORD_ALREADY_EXISTS = "embedded_wallet_password_already_exists",
463
+ EMBEDDED_WALLET_RECOVERY_ALREADY_EXISTS = "embedded_wallet_recovery_already_exists",
459
464
  TRANSACTION_FAILURE = "transaction_failure",
460
465
  UNSUPPORTED_CHAIN_ID = "unsupported_chain_id",
461
466
  CAPTCHA_TIMEOUT = "captcha_timeout",
@@ -934,10 +939,10 @@ interface MfaFlow {
934
939
  */
935
940
  declare class PrivyClient {
936
941
  #private;
937
- private api;
938
942
  private appId;
939
943
  private session;
940
944
  private timeout;
945
+ api: Http;
941
946
  clientAnalyticsId: string | null;
942
947
  useServerCookies: boolean;
943
948
  apiUrl: string;
@@ -1137,6 +1142,11 @@ type FundWalletConfig = {
1137
1142
  config: MoonpayConfig;
1138
1143
  provider?: 'moonpay';
1139
1144
  };
1145
+ /**
1146
+ * Possible methods of user-driven recovery.
1147
+ * This is set, per app, on the server.
1148
+ */
1149
+ type UserRecoveryMethod = 'user-passcode' | 'google-drive';
1140
1150
  /**
1141
1151
  * Object representation of a user's wallet.
1142
1152
  */
@@ -1196,7 +1206,7 @@ interface Wallet {
1196
1206
  * 1. 'privy': privy escrow of the recovery material
1197
1207
  * 2. 'user-passcode': recovery protected by user-input passcode
1198
1208
  */
1199
- recoveryMethod?: 'privy' | 'user-passcode';
1209
+ recoveryMethod?: 'privy' | UserRecoveryMethod;
1200
1210
  }
1201
1211
  /**
1202
1212
  * Object representation of metadata reported by a connected wallet from a wallet connector
@@ -1871,7 +1881,8 @@ interface AllowlistConfig {
1871
1881
  type EmbeddedWalletCreateOnLoginConfig = 'users-without-wallets' | 'all-users' | 'off';
1872
1882
  interface EmbeddedWalletsConfig {
1873
1883
  createOnLogin: EmbeddedWalletCreateOnLoginConfig;
1874
- requireUserPasswordOnCreate: boolean;
1884
+ requireUserOwnedRecoveryOnCreate: boolean;
1885
+ userOwnedRecoveryOptions: UserRecoveryMethod[];
1875
1886
  }
1876
1887
  type OtpFlowState = {
1877
1888
  status: 'initial';
@@ -2388,9 +2399,9 @@ interface PrivyInterface {
2388
2399
  * This method will error if the user already has an embedded wallet or if they
2389
2400
  * exit in the middle of the flow.
2390
2401
  *
2391
- * If the `config.embeddedWallets.requireUserPasswordOnCreate` property is set to true,
2392
- * this will prompt the user to enter a passcode to secure the recovery share of their
2393
- * embedded wallet.
2402
+ * If the `config.embeddedWallets.requireUserOwnedRecoveryOnCreate` property is set to true,
2403
+ * this will prompt the user to complete a recovery flow to secure the recovery
2404
+ * share of their embedded wallet.
2394
2405
  *
2395
2406
  * Otherwise (the default), Privy will secure the recovery share, and the embedded wallet
2396
2407
  * will be created without showing any UIs to the user.
@@ -2399,8 +2410,6 @@ interface PrivyInterface {
2399
2410
  */
2400
2411
  createWallet: () => Promise<Wallet>;
2401
2412
  /**
2402
- * Prompt the user to enter a password to secure the recovery of their embedded wallet.
2403
- *
2404
2413
  * This method will error if the user does not have an embedded wallet, if the user's
2405
2414
  * embedded wallet already has a password set, or if the user exits in the middle of the flow.
2406
2415
  *
@@ -3171,9 +3180,9 @@ declare function useCreateWallet(callbacks?: PrivyEvents['createWallet']): {
3171
3180
  *
3172
3181
  * This method will error if the user already has an embedded wallet
3173
3182
  *
3174
- * If the `config.embeddedWallets.requireUserPasswordOnCreate` property is set to true,
3175
- * this will prompt the user to enter a password to secure the recovery share of their
3176
- * embedded wallet.
3183
+ * If the `config.embeddedWallets.requireUserOwnedRecoveryOnCreate` property is set to true,
3184
+ * this will prompt the user to complete a recovery flow to secure
3185
+ * the recovery share of their embedded wallet.
3177
3186
  *
3178
3187
  * Otherwise (the default), Privy will secure the recovery share, and the embedded wallet
3179
3188
  * will be created without showing any UIs to the user.