@privy-io/react-auth 1.3.0-beta.3 → 1.3.0-beta.4

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +58 -7
  2. package/dist/index.js +1326 -983
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -3,12 +3,11 @@ import React from 'react';
3
3
  import { Web3Provider } from '@ethersproject/providers';
4
4
  import { AbstractProvider } from 'web3-core';
5
5
 
6
- /** The types of wallet we currently support. */
7
6
  declare const SUPPORTED_WALLET_TYPES: readonly ["metamask", "coinbase_wallet", "wallet_connect"];
8
7
  declare type WalletType = typeof SUPPORTED_WALLET_TYPES[number];
9
8
  interface LinkMetadata {
10
9
  /** Link type, most commonly useful when filtering through linkedAccounts */
11
- type: 'wallet' | 'email';
10
+ type: 'wallet' | 'email' | 'google_oauth' | 'twitter_oauth' | 'discord_oauth';
12
11
  /** Datetime when this email or wallet was associated to the user account. */
13
12
  verifiedAt: Date;
14
13
  }
@@ -34,12 +33,36 @@ interface Email {
34
33
  /** Email address */
35
34
  address: string;
36
35
  }
37
- interface WalletWithMetadata extends LinkMetadata, Wallet {
38
- type: 'wallet';
36
+ interface Google {
37
+ subject: string;
38
+ email: string;
39
+ name: string | null;
40
+ }
41
+ interface Twitter {
42
+ subject: string;
43
+ username: string | null;
44
+ name: string | null;
45
+ }
46
+ interface Discord {
47
+ subject: string;
48
+ username: string | null;
49
+ email: string | null;
39
50
  }
40
51
  interface EmailWithMetadata extends LinkMetadata, Email {
41
52
  type: 'email';
42
53
  }
54
+ interface WalletWithMetadata extends LinkMetadata, Wallet {
55
+ type: 'wallet';
56
+ }
57
+ interface GoogleOauthWithMetadata extends LinkMetadata, Google {
58
+ type: 'google_oauth';
59
+ }
60
+ interface TwitterOauthWithMetadata extends LinkMetadata, Twitter {
61
+ type: 'twitter_oauth';
62
+ }
63
+ interface DiscordOauthWithMetadata extends LinkMetadata, Discord {
64
+ type: 'discord_oauth';
65
+ }
43
66
  interface User {
44
67
  /** The Privy DID for the user. If you need to store or link additional information
45
68
  * about a user, you can use this DID to reference the user identity. */
@@ -50,9 +73,15 @@ interface User {
50
73
  email?: Email;
51
74
  /** The wallet associated with this user. It cannot be associated with another account. */
52
75
  wallet?: Wallet;
76
+ /** The google oauth account associated with this user */
77
+ google?: Google;
78
+ /** The twitter oauth account associated with this user */
79
+ twitter?: Twitter;
80
+ /** The discord oauth account associated with this user */
81
+ discord?: Discord;
53
82
  /** The list of accounts associated with this user. Accounts contain additional metadata
54
83
  * about the account and its linking that may be necessary for advanced use cases. */
55
- linkedAccounts: Array<WalletWithMetadata | EmailWithMetadata>;
84
+ linkedAccounts: Array<WalletWithMetadata | EmailWithMetadata | GoogleOauthWithMetadata | TwitterOauthWithMetadata | DiscordOauthWithMetadata>;
56
85
  }
57
86
  interface AppSettings {
58
87
  id?: string;
@@ -96,10 +125,32 @@ interface ResponseEthereumAccount {
96
125
  chain_type: 'ethereum';
97
126
  verified_at: number;
98
127
  }
128
+ interface ResponseOauthGoogle {
129
+ type: 'google_oauth';
130
+ subject: string;
131
+ email: string;
132
+ name: string | null;
133
+ verified_at: number;
134
+ }
135
+ interface ResponseOauthTwitter {
136
+ type: 'twitter_oauth';
137
+ subject: string;
138
+ username: string | null;
139
+ name: string | null;
140
+ verified_at: number;
141
+ }
142
+ interface ResponseOauthDiscord {
143
+ type: 'discord_oauth';
144
+ subject: string;
145
+ username: string | null;
146
+ email: string | null;
147
+ verified_at: number;
148
+ }
149
+ declare type LinkedAccountsType = Array<ResponseEmailAccount | ResponseEthereumAccount | ResponseOauthGoogle | ResponseOauthTwitter | ResponseOauthDiscord>;
99
150
  interface GetCurrentUserResponse {
100
151
  id: string;
101
152
  created_at: number;
102
- linked_accounts: Array<ResponseEmailAccount | ResponseEthereumAccount>;
153
+ linked_accounts: LinkedAccountsType;
103
154
  }
104
155
 
105
156
  /**
@@ -400,4 +451,4 @@ declare class PrivySessionError extends PrivyError {
400
451
  constructor(message: string, cause?: unknown);
401
452
  }
402
453
 
403
- export { Email, EmailWithMetadata, PrivyApiError, PrivyClient, PrivyClientError, PrivyError, PrivyProvider, PrivySessionError, User, Wallet, WalletWithMetadata, usePrivy };
454
+ export { Discord, DiscordOauthWithMetadata, Email, EmailWithMetadata, Google, GoogleOauthWithMetadata, PrivyApiError, PrivyClient, PrivyClientError, PrivyError, PrivyProvider, PrivySessionError, Twitter, TwitterOauthWithMetadata, User, Wallet, WalletWithMetadata, usePrivy };