@privy-io/react-auth 1.34.2-beta.1 → 1.35.0-beta.10

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
@@ -459,7 +459,7 @@ type WalletBranding = {
459
459
  name: string;
460
460
  icon?: string | EmbeddedSVG;
461
461
  };
462
- type LinkedAccountType = 'wallet' | 'email' | 'phone' | 'google_oauth' | 'twitter_oauth' | 'discord_oauth' | 'github_oauth' | 'apple_oauth';
462
+ type LinkedAccountType = 'wallet' | 'email' | 'phone' | 'google_oauth' | 'twitter_oauth' | 'discord_oauth' | 'github_oauth' | 'apple_oauth' | 'custom_auth';
463
463
  /** @ignore */
464
464
  interface LinkMetadata {
465
465
  /** Account type, most commonly useful when filtering through linkedAccounts */
@@ -634,6 +634,10 @@ interface Apple {
634
634
  /** The email associated with the Apple account. */
635
635
  email: string;
636
636
  }
637
+ interface CustomJwtAccount {
638
+ /** The user ID given by the custom auth provider */
639
+ customUserId: string;
640
+ }
637
641
  /** Object representation of a user's email, with additional metadata for advanced use cases. */
638
642
  interface EmailWithMetadata extends LinkMetadata, Email {
639
643
  /** Denotes that this is an email account. */
@@ -674,10 +678,15 @@ interface AppleOAuthWithMetadata extends LinkMetadata, Apple {
674
678
  /** Denotes that this is a Apple account. */
675
679
  type: 'apple_oauth';
676
680
  }
681
+ /** Object representation of a user's Custom JWT Account, with additional metadata for advanced use cases. */
682
+ interface CustomJwtAccountWithMetadata extends LinkMetadata, CustomJwtAccount {
683
+ /** Denotes that this is an custom account. */
684
+ type: 'custom_auth';
685
+ }
677
686
  /**
678
687
  * Object representation of a user's linked accounts
679
688
  */
680
- type LinkedAccountWithMetadata = WalletWithMetadata | EmailWithMetadata | PhoneWithMetadata | GoogleOAuthWithMetadata | TwitterOAuthWithMetadata | DiscordOAuthWithMetadata | GithubOAuthWithMetadata | AppleOAuthWithMetadata;
689
+ type LinkedAccountWithMetadata = WalletWithMetadata | EmailWithMetadata | PhoneWithMetadata | GoogleOAuthWithMetadata | TwitterOAuthWithMetadata | DiscordOAuthWithMetadata | GithubOAuthWithMetadata | AppleOAuthWithMetadata | CustomJwtAccountWithMetadata;
681
690
  interface User {
682
691
  /** The Privy-issued DID for the user. If you need to store additional information
683
692
  * about a user, you can use this DID to reference them. */
@@ -767,6 +776,52 @@ type PrivyClientConfig = {
767
776
  * `loginMethods` cannot be an empty array if specified.
768
777
  * The order of this array does not currently dictate order of the login methods in the UI, but may in the future. */
769
778
  loginMethods?: Array<'wallet' | 'email' | 'sms' | 'google' | 'twitter' | 'discord' | 'github' | 'apple'>;
779
+ /**
780
+ * This property is only required for apps that use a third-party authentication provider.
781
+ */
782
+ customAuth?: {
783
+ /**
784
+ * If true, enable custom authentication integration.
785
+ * This enables a JWT from a custom auth provider to be used to authenticate Privy embedded wallets.
786
+ * Defaults to true.
787
+ *
788
+ * @default true
789
+ */
790
+ enabled?: boolean;
791
+ /**
792
+ * A callback that returns the user's custom auth provider's access token as a string.
793
+ * Can be left blank if using cookies to store and send access tokens
794
+ *
795
+ * @example
796
+ * const {getAccessTokenSilently} = useAuth();
797
+ *
798
+ * <PrivyProvider
799
+ * {...props}
800
+ * config={{
801
+ * customAuth: {
802
+ * getCustomAccessToken: getAccessTokenSilently
803
+ * },
804
+ * }}
805
+ * />
806
+ */
807
+ getCustomAccessToken: () => Promise<string | undefined>;
808
+ /**
809
+ * Custom auth providers loading state
810
+ *
811
+ * @example
812
+ * const {isLoading} = useAuth();
813
+ *
814
+ * <PrivyProvider
815
+ * {...props}
816
+ * config={{
817
+ * customAuth: {
818
+ * isLoading,
819
+ * },
820
+ * }}
821
+ * />
822
+ */
823
+ isLoading: boolean;
824
+ };
770
825
  /** All legal configuration */
771
826
  legal?: {
772
827
  /** URL to the terms and conditions page for your application.
@@ -1443,7 +1498,12 @@ interface ResponseOAuthApple {
1443
1498
  email: string;
1444
1499
  verified_at: number;
1445
1500
  }
1446
- type LinkedAccountsResponseType = Array<ResponseEmailAccount | ResponsePhoneAccount | ResponseEthereumAccount | ResponseOAuthGoogle | ResponseOAuthTwitter | ResponseOAuthDiscord | ResponseOAuthGithub | ResponseOAuthApple>;
1501
+ interface ResponseCustomJwtAccount {
1502
+ type: 'custom_auth';
1503
+ custom_user_id: string;
1504
+ verified_at: number;
1505
+ }
1506
+ type LinkedAccountsResponseType = Array<ResponseEmailAccount | ResponsePhoneAccount | ResponseEthereumAccount | ResponseOAuthGoogle | ResponseOAuthTwitter | ResponseOAuthDiscord | ResponseOAuthGithub | ResponseOAuthApple | ResponseCustomJwtAccount>;
1447
1507
  interface GetCurrentUserResponse {
1448
1508
  id: string;
1449
1509
  created_at: number;