@privy-io/react-auth 1.21.1-beta.1 → 1.22.0-beta.2

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
@@ -4,7 +4,7 @@ import WCProvider from '@walletconnect/web3-provider';
4
4
  import { AbstractProvider } from 'web3-core';
5
5
  import { AxiosResponse, AxiosRequestConfig } from 'axios';
6
6
 
7
- declare const SUPPORTED_OAUTH_PROVIDERS: readonly ["google", "discord", "twitter", "github"];
7
+ declare const SUPPORTED_OAUTH_PROVIDERS: readonly ["google", "discord", "twitter", "github", "apple"];
8
8
  type OAuthProviderType = typeof SUPPORTED_OAUTH_PROVIDERS[number];
9
9
  declare const SUPPORTED_WALLET_CONNECTION_TYPES: readonly ["metamask", "phantom", "coinbase_wallet", "wallet_connect"];
10
10
  type WalletType = typeof SUPPORTED_WALLET_CONNECTION_TYPES[number];
@@ -15,7 +15,7 @@ type WalletBranding = {
15
15
  name: string;
16
16
  icon?: string | EmbeddedSVG;
17
17
  };
18
- type LinkedAccountType = 'wallet' | 'email' | 'phone' | 'google_oauth' | 'twitter_oauth' | 'discord_oauth' | 'github_oauth';
18
+ type LinkedAccountType = 'wallet' | 'email' | 'phone' | 'google_oauth' | 'twitter_oauth' | 'discord_oauth' | 'github_oauth' | 'apple_oauth';
19
19
  /** @ignore */
20
20
  interface LinkMetadata {
21
21
  /** Account type, most commonly useful when filtering through linkedAccounts */
@@ -101,6 +101,13 @@ interface Github {
101
101
  /** The email associated with the Github account. */
102
102
  email: string | null;
103
103
  }
104
+ /** Object representation of a user's Apple account. */
105
+ interface Apple {
106
+ /** The `sub` claim from the Apple-issued JWT for this account. */
107
+ subject: string;
108
+ /** The email associated with the Apple account. */
109
+ email: string;
110
+ }
104
111
  /** Object representation of a user's email, with additional metadata for advanced use cases. */
105
112
  interface EmailWithMetadata extends LinkMetadata, Email {
106
113
  /** Denotes that this is an email account. */
@@ -136,10 +143,15 @@ interface GithubOAuthWithMetadata extends LinkMetadata, Github {
136
143
  /** Denotes that this is a Github account. */
137
144
  type: 'github_oauth';
138
145
  }
146
+ /** Object representation of a user's Apple Account, with additional metadata for advanced use cases. */
147
+ interface AppleOAuthWithMetadata extends LinkMetadata, Apple {
148
+ /** Denotes that this is a Apple account. */
149
+ type: 'apple_oauth';
150
+ }
139
151
  /**
140
152
  * Object representation of a user's linked accounts
141
153
  */
142
- type LinkedAccountWithMetadata = WalletWithMetadata | EmailWithMetadata | PhoneWithMetadata | GoogleOAuthWithMetadata | TwitterOAuthWithMetadata | DiscordOAuthWithMetadata | GithubOAuthWithMetadata;
154
+ type LinkedAccountWithMetadata = WalletWithMetadata | EmailWithMetadata | PhoneWithMetadata | GoogleOAuthWithMetadata | TwitterOAuthWithMetadata | DiscordOAuthWithMetadata | GithubOAuthWithMetadata | AppleOAuthWithMetadata;
143
155
  interface User {
144
156
  /** The Privy-issued DID for the user. If you need to store additional information
145
157
  * about a user, you can use this DID to reference them. */
@@ -164,6 +176,8 @@ interface User {
164
176
  discord?: Discord;
165
177
  /** The user's Github account, if they have linked one. It cannot be linked to another user. */
166
178
  github?: Github;
179
+ /** The user's Apple account, if they have linked one. It cannot be linked to another user. */
180
+ apple?: Apple;
167
181
  /** The list of accounts associated with this user. Each account contains additional metadata
168
182
  * that may be helpful for advanced use cases. */
169
183
  linkedAccounts: Array<LinkedAccountWithMetadata>;
@@ -181,6 +195,7 @@ type PrivyServerConfig = {
181
195
  twitterOAuth?: boolean;
182
196
  discordOAuth?: boolean;
183
197
  githubOAuth?: boolean;
198
+ appleOAuth?: boolean;
184
199
  termsAndConditionsUrl: string | null;
185
200
  privacyPolicyUrl: string | null;
186
201
  createdAt?: Date;
@@ -551,6 +566,11 @@ interface PrivyInterface {
551
566
  * This will directly initiate the OAuth flow for Github.
552
567
  */
553
568
  linkGithub: () => void;
569
+ /**
570
+ * For users who are authenticated, prompts the user to link Apple OAuth account
571
+ * This will directly initiate the OAuth flow for Apple.
572
+ */
573
+ linkApple: () => void;
554
574
  /**
555
575
  * Log the current user out and clears their authentication state. `authenticated` will become false, `user` will become null, and the Privy Auth tokens will be deleted from the browser's local storage.
556
576
  *
@@ -615,6 +635,10 @@ interface PrivyInterface {
615
635
  * Unlink a Github social account from a user, by passing the github subject ID. Note that you can only unlink a social account if the user has at least one other account.
616
636
  */
617
637
  unlinkGithub: (subject: string) => Promise<User>;
638
+ /**
639
+ * Unlink a Apple social account from a user, by passing the apple subject ID. Note that you can only unlink a social account if the user has at least one other account.
640
+ */
641
+ unlinkApple: (subject: string) => Promise<User>;
618
642
  /**
619
643
  * Set one of the authenticated wallet addresses (part of user.linkedAccounts with type 'wallet'). as the active wallet.
620
644
  * If you pass a wallet that's not one of the linkedAccounts, this will throw an error.
@@ -711,7 +735,13 @@ interface ResponseOAuthGithub {
711
735
  email: string | null;
712
736
  verified_at: number;
713
737
  }
714
- type LinkedAccountsResponseType = Array<ResponseEmailAccount | ResponsePhoneAccount | ResponseEthereumAccount | ResponseOAuthGoogle | ResponseOAuthTwitter | ResponseOAuthDiscord | ResponseOAuthGithub>;
738
+ interface ResponseOAuthApple {
739
+ type: 'apple_oauth';
740
+ subject: string;
741
+ email: string;
742
+ verified_at: number;
743
+ }
744
+ type LinkedAccountsResponseType = Array<ResponseEmailAccount | ResponsePhoneAccount | ResponseEthereumAccount | ResponseOAuthGoogle | ResponseOAuthTwitter | ResponseOAuthDiscord | ResponseOAuthGithub | ResponseOAuthApple>;
715
745
  interface GetCurrentUserResponse {
716
746
  id: string;
717
747
  created_at: number;
@@ -870,4 +900,4 @@ declare class PrivyClient {
870
900
  forkSession(): Promise<string>;
871
901
  }
872
902
 
873
- export { AsExternalProvider, ConnectorManager, Discord, DiscordOAuthWithMetadata, Email, EmailWithMetadata, Github, GithubOAuthWithMetadata, Google, GoogleOAuthWithMetadata, Phone, PhoneWithMetadata, PrivyClient, PrivyClientConfig, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, SignMessageModalUIOptions, Twitter, TwitterOAuthWithMetadata, User, VERSION, Wallet, WalletConnector, WalletWithMetadata, getAccessToken, usePrivy };
903
+ export { Apple, AppleOAuthWithMetadata, AsExternalProvider, ConnectorManager, Discord, DiscordOAuthWithMetadata, Email, EmailWithMetadata, Github, GithubOAuthWithMetadata, Google, GoogleOAuthWithMetadata, Phone, PhoneWithMetadata, PrivyClient, PrivyClientConfig, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, SignMessageModalUIOptions, Twitter, TwitterOAuthWithMetadata, User, VERSION, Wallet, WalletConnector, WalletWithMetadata, getAccessToken, usePrivy };