@privy-io/react-auth 1.21.0 → 1.22.0-beta.1
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/README.md +2 -0
- package/dist/esm/index.js +135 -171
- package/dist/index.d.ts +43 -6
- package/dist/index.js +135 -171
- package/package.json +2 -1
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;
|
|
@@ -248,6 +263,12 @@ interface PrivyProviderProps {
|
|
|
248
263
|
* Values here will override their server-configuration counterparts.
|
|
249
264
|
*/
|
|
250
265
|
config?: PrivyClientConfig;
|
|
266
|
+
/**
|
|
267
|
+
* Override the URL of the Privy API, which is 'https://auth.privy.io' by default.
|
|
268
|
+
* For development and testing use only.
|
|
269
|
+
* @hidden
|
|
270
|
+
*/
|
|
271
|
+
apiUrl?: string;
|
|
251
272
|
/**
|
|
252
273
|
* @ignore
|
|
253
274
|
* @class
|
|
@@ -545,6 +566,11 @@ interface PrivyInterface {
|
|
|
545
566
|
* This will directly initiate the OAuth flow for Github.
|
|
546
567
|
*/
|
|
547
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;
|
|
548
574
|
/**
|
|
549
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.
|
|
550
576
|
*
|
|
@@ -609,6 +635,10 @@ interface PrivyInterface {
|
|
|
609
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.
|
|
610
636
|
*/
|
|
611
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>;
|
|
612
642
|
/**
|
|
613
643
|
* Set one of the authenticated wallet addresses (part of user.linkedAccounts with type 'wallet'). as the active wallet.
|
|
614
644
|
* If you pass a wallet that's not one of the linkedAccounts, this will throw an error.
|
|
@@ -705,7 +735,13 @@ interface ResponseOAuthGithub {
|
|
|
705
735
|
email: string | null;
|
|
706
736
|
verified_at: number;
|
|
707
737
|
}
|
|
708
|
-
|
|
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>;
|
|
709
745
|
interface GetCurrentUserResponse {
|
|
710
746
|
id: string;
|
|
711
747
|
created_at: number;
|
|
@@ -786,6 +822,7 @@ declare class PrivyClient {
|
|
|
786
822
|
private appId;
|
|
787
823
|
private session;
|
|
788
824
|
private clientAnalyticsId;
|
|
825
|
+
apiUrl: string;
|
|
789
826
|
authFlow?: AuthFlow;
|
|
790
827
|
connectors: ConnectorManager;
|
|
791
828
|
/**
|
|
@@ -796,7 +833,7 @@ declare class PrivyClient {
|
|
|
796
833
|
/**
|
|
797
834
|
* The URL of the Privy API. Defaults to `https://api.privy.io/v0`.
|
|
798
835
|
*/
|
|
799
|
-
|
|
836
|
+
apiUrl?: string;
|
|
800
837
|
/**
|
|
801
838
|
* The app id from your console
|
|
802
839
|
*/
|
|
@@ -863,4 +900,4 @@ declare class PrivyClient {
|
|
|
863
900
|
forkSession(): Promise<string>;
|
|
864
901
|
}
|
|
865
902
|
|
|
866
|
-
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 };
|