@privy-io/react-auth 1.12.0-beta.6 → 1.12.0-beta.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.
- package/dist/esm/index.js +87 -75
- package/dist/index.d.ts +41 -5
- package/dist/index.js +87 -75
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ import { ExternalProvider, Web3Provider } from '@ethersproject/providers';
|
|
|
3
3
|
import { AbstractProvider } from 'web3-core';
|
|
4
4
|
import { AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
5
5
|
|
|
6
|
-
declare const SUPPORTED_OAUTH_PROVIDERS: readonly ["google", "discord", "twitter"];
|
|
6
|
+
declare const SUPPORTED_OAUTH_PROVIDERS: readonly ["google", "discord", "twitter", "github"];
|
|
7
7
|
type OAuthProviderType = typeof SUPPORTED_OAUTH_PROVIDERS[number];
|
|
8
8
|
declare const SUPPORTED_WALLET_TYPES: readonly ["metamask", "coinbase_wallet", "wallet_connect"];
|
|
9
9
|
type WalletType = typeof SUPPORTED_WALLET_TYPES[number];
|
|
10
|
-
type LinkedAccountType = 'wallet' | 'email' | 'phone' | 'google_oauth' | 'twitter_oauth' | 'discord_oauth';
|
|
10
|
+
type LinkedAccountType = 'wallet' | 'email' | 'phone' | 'google_oauth' | 'twitter_oauth' | 'discord_oauth' | 'github_oauth';
|
|
11
11
|
/** @ignore */
|
|
12
12
|
interface LinkMetadata {
|
|
13
13
|
/** Account type, most commonly useful when filtering through linkedAccounts */
|
|
@@ -78,6 +78,17 @@ interface Discord {
|
|
|
78
78
|
/** The email associated with the Discord account. */
|
|
79
79
|
email: string | null;
|
|
80
80
|
}
|
|
81
|
+
/** Object representation of a user's Discord account. */
|
|
82
|
+
interface Github {
|
|
83
|
+
/** The `sub` claim from the Github-issued JWT for this account. */
|
|
84
|
+
subject: string;
|
|
85
|
+
/** The username associated with the Github account. */
|
|
86
|
+
username: string | null;
|
|
87
|
+
/** The name associated with the Github account. */
|
|
88
|
+
name: string | null;
|
|
89
|
+
/** The email associated with the Github account. */
|
|
90
|
+
email: string | null;
|
|
91
|
+
}
|
|
81
92
|
/** Object representation of a user's email, with additional metadata for advanced use cases. */
|
|
82
93
|
interface EmailWithMetadata extends LinkMetadata, Email {
|
|
83
94
|
/** Denotes that this is an email account. */
|
|
@@ -108,7 +119,12 @@ interface DiscordOAuthWithMetadata extends LinkMetadata, Discord {
|
|
|
108
119
|
/** Denotes that this is a Discord account. */
|
|
109
120
|
type: 'discord_oauth';
|
|
110
121
|
}
|
|
111
|
-
|
|
122
|
+
/** Object representation of a user's Github Account, with additional metadata for advanced use cases. */
|
|
123
|
+
interface GithubOAuthWithMetadata extends LinkMetadata, Github {
|
|
124
|
+
/** Denotes that this is a Github account. */
|
|
125
|
+
type: 'github_oauth';
|
|
126
|
+
}
|
|
127
|
+
type LinkedAccountWithMetadata = WalletWithMetadata | EmailWithMetadata | PhoneWithMetadata | GoogleOAuthWithMetadata | TwitterOAuthWithMetadata | DiscordOAuthWithMetadata | GithubOAuthWithMetadata;
|
|
112
128
|
interface User {
|
|
113
129
|
/** The Privy-issued DID for the user. If you need to store additional information
|
|
114
130
|
* about a user, you can use this DID to reference them. */
|
|
@@ -131,6 +147,8 @@ interface User {
|
|
|
131
147
|
twitter?: Twitter;
|
|
132
148
|
/** The user's Discord account, if they have linked one. It cannot be linked to another user. */
|
|
133
149
|
discord?: Discord;
|
|
150
|
+
/** The user's Github account, if they have linked one. It cannot be linked to another user. */
|
|
151
|
+
github?: Github;
|
|
134
152
|
/** The list of accounts associated with this user. Each account contains additional metadata
|
|
135
153
|
* that may be helpful for advanced use cases. */
|
|
136
154
|
linkedAccounts: Array<LinkedAccountWithMetadata>;
|
|
@@ -149,6 +167,7 @@ interface AppSettings {
|
|
|
149
167
|
googleOAuth?: boolean;
|
|
150
168
|
twitterOAuth?: boolean;
|
|
151
169
|
discordOAuth?: boolean;
|
|
170
|
+
githubOAuth?: boolean;
|
|
152
171
|
termsAndConditionsUrl: string | null;
|
|
153
172
|
privacyPolicyUrl: string | null;
|
|
154
173
|
createdAt?: Date;
|
|
@@ -331,6 +350,11 @@ interface PrivyInterface {
|
|
|
331
350
|
* This will directly initiate the OAuth flow for Discord.
|
|
332
351
|
*/
|
|
333
352
|
linkDiscord: () => void;
|
|
353
|
+
/**
|
|
354
|
+
* For users who are authenticated, prompts the user to link Github OAuth account
|
|
355
|
+
* This will directly initiate the OAuth flow for Github.
|
|
356
|
+
*/
|
|
357
|
+
linkGithub: () => void;
|
|
334
358
|
/**
|
|
335
359
|
* 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.
|
|
336
360
|
*
|
|
@@ -390,6 +414,10 @@ interface PrivyInterface {
|
|
|
390
414
|
* Unlink a Discord social account from a user, by passing the discord subject ID. Note that you can only unlink a social account if the user has at least one other account.
|
|
391
415
|
*/
|
|
392
416
|
unlinkDiscord: (subject: string) => Promise<User>;
|
|
417
|
+
/**
|
|
418
|
+
* 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.
|
|
419
|
+
*/
|
|
420
|
+
unlinkGithub: (subject: string) => Promise<User>;
|
|
393
421
|
/**
|
|
394
422
|
* Set one of the authenticated wallet addresses (part of user.linkedAccounts with type 'wallet'). as the active wallet.
|
|
395
423
|
* If you pass a wallet that's not one of the linkedAccounts, this will throw an error.
|
|
@@ -473,7 +501,15 @@ interface ResponseOAuthDiscord {
|
|
|
473
501
|
email: string | null;
|
|
474
502
|
verified_at: number;
|
|
475
503
|
}
|
|
476
|
-
|
|
504
|
+
interface ResponseOAuthGithub {
|
|
505
|
+
type: 'github_oauth';
|
|
506
|
+
subject: string;
|
|
507
|
+
username: string | null;
|
|
508
|
+
name: string | null;
|
|
509
|
+
email: string | null;
|
|
510
|
+
verified_at: number;
|
|
511
|
+
}
|
|
512
|
+
type LinkedAccountsType = Array<ResponseEmailAccount | ResponsePhoneAccount | ResponseEthereumAccount | ResponseOAuthGoogle | ResponseOAuthTwitter | ResponseOAuthDiscord | ResponseOAuthGithub>;
|
|
477
513
|
interface GetCurrentUserResponse {
|
|
478
514
|
id: string;
|
|
479
515
|
created_at: number;
|
|
@@ -673,4 +709,4 @@ declare class PrivyClient {
|
|
|
673
709
|
forkSession(): Promise<string>;
|
|
674
710
|
}
|
|
675
711
|
|
|
676
|
-
export { AsExternalProvider, Discord, DiscordOAuthWithMetadata, Email, EmailWithMetadata, Google, GoogleOAuthWithMetadata, Phone, PhoneWithMetadata, PrivyClient, PrivyConnector, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, Twitter, TwitterOAuthWithMetadata, User, VERSION, Wallet, WalletWithMetadata, getAccessToken, usePrivy };
|
|
712
|
+
export { AsExternalProvider, Discord, DiscordOAuthWithMetadata, Email, EmailWithMetadata, GithubOAuthWithMetadata, Google, GoogleOAuthWithMetadata, Phone, PhoneWithMetadata, PrivyClient, PrivyConnector, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, Twitter, TwitterOAuthWithMetadata, User, VERSION, Wallet, WalletWithMetadata, getAccessToken, usePrivy };
|