@privy-io/react-auth 1.12.1-beta.5 → 1.13.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/esm/index.js +229 -154
- package/dist/index.d.ts +55 -38
- package/dist/index.js +229 -154
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ 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
|
|
81
|
+
/** Object representation of a user's Github account. */
|
|
82
82
|
interface Github {
|
|
83
83
|
/** The `sub` claim from the Github-issued JWT for this account. */
|
|
84
84
|
subject: string;
|
|
@@ -161,6 +161,7 @@ interface AppSettings {
|
|
|
161
161
|
theme?: 'System' | 'Light' | 'Dark' | string;
|
|
162
162
|
accentColor?: string;
|
|
163
163
|
showWalletLoginFirst?: boolean;
|
|
164
|
+
allowlistConfig: AllowlistConfig;
|
|
164
165
|
walletAuth?: boolean;
|
|
165
166
|
emailAuth?: boolean;
|
|
166
167
|
smsAuth?: boolean;
|
|
@@ -173,6 +174,12 @@ interface AppSettings {
|
|
|
173
174
|
createdAt?: Date;
|
|
174
175
|
updatedAt?: Date;
|
|
175
176
|
}
|
|
177
|
+
interface AllowlistConfig {
|
|
178
|
+
errorTitle: string | null;
|
|
179
|
+
errorDetail: string | null;
|
|
180
|
+
errorCtaText: string | null;
|
|
181
|
+
errorCtaLink: string | null;
|
|
182
|
+
}
|
|
176
183
|
|
|
177
184
|
declare function getAccessToken(): Promise<string | null>;
|
|
178
185
|
/**
|
|
@@ -190,16 +197,6 @@ interface PrivyProviderProps {
|
|
|
190
197
|
*
|
|
191
198
|
*/
|
|
192
199
|
onSuccess?: (user: User, isNewUser: boolean) => void;
|
|
193
|
-
/**
|
|
194
|
-
* @experimental **Experimental**: This feature is {@link https://docs.privy.io/guide/faq/experimental-features subject to change at any time}.
|
|
195
|
-
*
|
|
196
|
-
* An optional callback that will execute if a `login` call fails.
|
|
197
|
-
*
|
|
198
|
-
* Within this callback, you can access:
|
|
199
|
-
* - an `isNotAllowed` boolean flag indicating if the user was prevented from logging in by
|
|
200
|
-
* your app's allowlist, if you have one enabled
|
|
201
|
-
*/
|
|
202
|
-
onError?: (isNotAllowed: boolean) => void;
|
|
203
200
|
/** @ignore */
|
|
204
201
|
children: React.ReactNode;
|
|
205
202
|
}
|
|
@@ -261,37 +258,57 @@ declare class AsExternalProvider extends PrivyProxyProvider implements ExternalP
|
|
|
261
258
|
}, callback: (error: any, response: any) => void) => void;
|
|
262
259
|
}
|
|
263
260
|
|
|
264
|
-
declare class
|
|
265
|
-
|
|
266
|
-
walletType: WalletType
|
|
261
|
+
declare abstract class WalletConnector {
|
|
262
|
+
provider: PrivyProxyProvider;
|
|
263
|
+
walletType: WalletType;
|
|
264
|
+
connected: boolean;
|
|
265
|
+
address: string | null;
|
|
266
|
+
chain: string | null;
|
|
267
|
+
constructor(walletType: WalletType, provider: PrivyProxyProvider, address: string | null);
|
|
268
|
+
fetchAddress(): Promise<string | null>;
|
|
269
|
+
fetchChainId(): Promise<string>;
|
|
270
|
+
getConnectedWallet(): Promise<Wallet | null>;
|
|
271
|
+
abstract connect(options: {
|
|
272
|
+
showPrompt: boolean;
|
|
273
|
+
}): Promise<Wallet | null>;
|
|
274
|
+
abstract isConnected(): Promise<boolean>;
|
|
275
|
+
abstract promptConnection(walletType: WalletType): void;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
declare class ConnectorManager {
|
|
279
|
+
walletConnectors: WalletConnector[];
|
|
280
|
+
activeWalletConnector?: WalletConnector;
|
|
281
|
+
initialized: boolean;
|
|
267
282
|
constructor();
|
|
268
|
-
getEthereumProvider: () => EIP1193Provider;
|
|
269
283
|
initialize(): void;
|
|
270
|
-
|
|
271
|
-
getConnectedWallet(): Promise<Wallet | null>;
|
|
284
|
+
getEthereumProvider: () => EIP1193Provider;
|
|
272
285
|
/**
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
286
|
+
* Load state from the server user object (linked wallets).
|
|
287
|
+
* Currently, we can't load them because we don't know the wallet type.
|
|
288
|
+
* Once we've fixed this, we can load the wallets from the server and
|
|
289
|
+
* initialize their WalletConnector objects accordingly.
|
|
290
|
+
**/
|
|
291
|
+
initializeLinkedWallets(user: User): void;
|
|
292
|
+
load(): void;
|
|
293
|
+
save(): void;
|
|
294
|
+
/**
|
|
295
|
+
* Note that we purposefully don't delete CONNECTORS_STATE_KEY from localStorage
|
|
296
|
+
* This is because we can't recuperate state from the server state along yet (PRI-569).
|
|
277
297
|
*/
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
private isConnected;
|
|
282
|
-
private promptConnection;
|
|
298
|
+
destroy(): void;
|
|
299
|
+
addWalletConnector(walletConnector: WalletConnector): void;
|
|
300
|
+
removeWallet(address: string): void;
|
|
283
301
|
/**
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
* @returns {string} The EIP-155 chain id.
|
|
302
|
+
* Performing personal_sign with the active wallet
|
|
303
|
+
* If the active wallet is not connected, we connect it in just-in-time" fashion.
|
|
287
304
|
*/
|
|
288
|
-
|
|
305
|
+
activeWalletSign(message: string): Promise<string | null>;
|
|
289
306
|
/**
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
307
|
+
* Set a wallet as active, by passing the address.
|
|
308
|
+
* If the address is null or not found, do nothing and return false.
|
|
309
|
+
* If the connector was successfully found and set active, return true.
|
|
293
310
|
*/
|
|
294
|
-
address
|
|
311
|
+
setActiveWallet(address: string | null): boolean;
|
|
295
312
|
}
|
|
296
313
|
|
|
297
314
|
/**
|
|
@@ -386,10 +403,10 @@ interface PrivyInterface {
|
|
|
386
403
|
*/
|
|
387
404
|
getWeb3jsProvider: () => AbstractProvider;
|
|
388
405
|
/**
|
|
389
|
-
* Get the
|
|
406
|
+
* Get the ConnectorManager object
|
|
390
407
|
* This shouldn't need to be used directly unless creating a plugin, like a WAGMI plugin
|
|
391
408
|
*/
|
|
392
|
-
|
|
409
|
+
walletConnectors: ConnectorManager | null;
|
|
393
410
|
/**
|
|
394
411
|
* Unlink an email account from a user, by passing the email address. Note that you can only unlink an email account if the user has at least one other account.
|
|
395
412
|
*/
|
|
@@ -570,7 +587,7 @@ declare class PrivyClient {
|
|
|
570
587
|
private appId;
|
|
571
588
|
private session;
|
|
572
589
|
authFlow?: AuthFlow;
|
|
573
|
-
|
|
590
|
+
connectors: ConnectorManager;
|
|
574
591
|
/**
|
|
575
592
|
* Creates a new Privy client.
|
|
576
593
|
* @param options Initialization options.
|
|
@@ -643,4 +660,4 @@ declare class PrivyClient {
|
|
|
643
660
|
forkSession(): Promise<string>;
|
|
644
661
|
}
|
|
645
662
|
|
|
646
|
-
export { AsExternalProvider, Discord, DiscordOAuthWithMetadata, Email, EmailWithMetadata, GithubOAuthWithMetadata, Google, GoogleOAuthWithMetadata, Phone, PhoneWithMetadata, PrivyClient,
|
|
663
|
+
export { AsExternalProvider, ConnectorManager, Discord, DiscordOAuthWithMetadata, Email, EmailWithMetadata, GithubOAuthWithMetadata, Google, GoogleOAuthWithMetadata, Phone, PhoneWithMetadata, PrivyClient, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, Twitter, TwitterOAuthWithMetadata, User, VERSION, Wallet, WalletWithMetadata, getAccessToken, usePrivy };
|