@rhinestone/1auth 0.1.2 → 0.5.0
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/{chunk-TACK3LJN.mjs → chunk-N4BLW5UR.mjs} +49 -25
- package/dist/chunk-N4BLW5UR.mjs.map +1 -0
- package/dist/{client-DyYGKWj3.d.mts → client-Di8SBnPO.d.mts} +242 -85
- package/dist/{client-DyYGKWj3.d.ts → client-Di8SBnPO.d.ts} +242 -85
- package/dist/index.d.mts +5 -9
- package/dist/index.d.ts +5 -9
- package/dist/index.js +559 -178
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +513 -155
- package/dist/index.mjs.map +1 -1
- package/dist/{provider-CNTZPPFz.d.ts → provider-8anOtc87.d.mts} +2 -8
- package/dist/{provider-Ctr7HQHR.d.mts → provider-CFnLQt5m.d.ts} +2 -8
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +16 -9
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +16 -9
- package/dist/react.mjs.map +1 -1
- package/dist/server.d.mts +2 -5
- package/dist/server.d.ts +2 -5
- package/dist/server.js +2 -2
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +2 -2
- package/dist/server.mjs.map +1 -1
- package/dist/wagmi.d.mts +2 -2
- package/dist/wagmi.d.ts +2 -2
- package/dist/wagmi.js +48 -23
- package/dist/wagmi.js.map +1 -1
- package/dist/wagmi.mjs +3 -3
- package/dist/wagmi.mjs.map +1 -1
- package/package.json +7 -6
- package/dist/chunk-TACK3LJN.mjs.map +0 -1
|
@@ -19,27 +19,26 @@ interface PasskeyProviderConfig {
|
|
|
19
19
|
/** Optional theme configuration for the dialog */
|
|
20
20
|
theme?: ThemeConfig;
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Result of {@link OneAuthClient.authWithModal} — covers both sign-in and sign-up.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const result = await client.authWithModal();
|
|
28
|
+
* if (result.success) {
|
|
29
|
+
* console.log(result.user?.username); // "alice"
|
|
30
|
+
* console.log(result.user?.address); // "0x1234..."
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
interface AuthResult {
|
|
26
35
|
success: boolean;
|
|
27
|
-
|
|
36
|
+
/** Authenticated user details (present when `success` is true) */
|
|
28
37
|
user?: {
|
|
29
38
|
id: string;
|
|
30
|
-
username
|
|
31
|
-
|
|
32
|
-
error?: {
|
|
33
|
-
code: string;
|
|
34
|
-
message: string;
|
|
39
|
+
username?: string;
|
|
40
|
+
address: `0x${string}`;
|
|
35
41
|
};
|
|
36
|
-
}
|
|
37
|
-
interface RegisterOptions {
|
|
38
|
-
username: string;
|
|
39
|
-
}
|
|
40
|
-
interface RegisterResult {
|
|
41
|
-
success: boolean;
|
|
42
|
-
username?: string;
|
|
43
42
|
error?: {
|
|
44
43
|
code: string;
|
|
45
44
|
message: string;
|
|
@@ -50,8 +49,11 @@ interface RegisterResult {
|
|
|
50
49
|
*/
|
|
51
50
|
interface ConnectResult {
|
|
52
51
|
success: boolean;
|
|
53
|
-
/**
|
|
54
|
-
|
|
52
|
+
/** Connected user details (present when `success` is true) */
|
|
53
|
+
user?: {
|
|
54
|
+
username?: string;
|
|
55
|
+
address: `0x${string}`;
|
|
56
|
+
};
|
|
55
57
|
/** Whether this was auto-connected (user had auto-connect enabled) */
|
|
56
58
|
autoConnected?: boolean;
|
|
57
59
|
/** Action to take when connection was not successful */
|
|
@@ -73,40 +75,39 @@ interface AuthenticateOptions {
|
|
|
73
75
|
challenge?: string;
|
|
74
76
|
}
|
|
75
77
|
/**
|
|
76
|
-
* Result of
|
|
78
|
+
* Result of {@link OneAuthClient.authenticate} — extends {@link AuthResult}
|
|
79
|
+
* with challenge-signing fields.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const result = await client.authenticate({
|
|
84
|
+
* challenge: `Login to MyApp\nNonce: ${crypto.randomUUID()}`
|
|
85
|
+
* });
|
|
86
|
+
* if (result.success && result.challenge) {
|
|
87
|
+
* await verifyOnServer(result.user?.username, result.challenge.signature, result.challenge.signedHash);
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
77
90
|
*/
|
|
78
|
-
interface AuthenticateResult {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
accountAddress?: `0x${string}`;
|
|
89
|
-
/**
|
|
90
|
-
* Signature of the hashed challenge.
|
|
91
|
-
* Only present if a challenge was provided in the options.
|
|
92
|
-
*/
|
|
93
|
-
signature?: WebAuthnSignature;
|
|
94
|
-
/**
|
|
95
|
-
* The hash that was actually signed (so apps can verify server-side).
|
|
96
|
-
* Computed as: keccak256("\x19Ethereum Signed Message:\n" + len + challenge) (EIP-191)
|
|
97
|
-
*/
|
|
98
|
-
signedHash?: `0x${string}`;
|
|
99
|
-
error?: {
|
|
100
|
-
code: string;
|
|
101
|
-
message: string;
|
|
91
|
+
interface AuthenticateResult extends AuthResult {
|
|
92
|
+
/** Challenge signing result (present when a challenge was provided) */
|
|
93
|
+
challenge?: {
|
|
94
|
+
/** WebAuthn signature of the hashed challenge */
|
|
95
|
+
signature: WebAuthnSignature;
|
|
96
|
+
/**
|
|
97
|
+
* The hash that was actually signed (so apps can verify server-side).
|
|
98
|
+
* Computed as: keccak256("\x19Ethereum Signed Message:\n" + len + challenge) (EIP-191)
|
|
99
|
+
*/
|
|
100
|
+
signedHash: `0x${string}`;
|
|
102
101
|
};
|
|
103
102
|
}
|
|
104
103
|
/**
|
|
105
104
|
* Options for signMessage
|
|
106
105
|
*/
|
|
107
106
|
interface SignMessageOptions {
|
|
108
|
-
/** Username of the signer */
|
|
109
|
-
username
|
|
107
|
+
/** Username of the signer (required if accountAddress is not provided) */
|
|
108
|
+
username?: string;
|
|
109
|
+
/** Account address of the signer (alternative to username) */
|
|
110
|
+
accountAddress?: string;
|
|
110
111
|
/** Human-readable message to sign */
|
|
111
112
|
message: string;
|
|
112
113
|
/** Optional custom challenge (defaults to message hash) */
|
|
@@ -119,19 +120,13 @@ interface SignMessageOptions {
|
|
|
119
120
|
theme?: ThemeConfig;
|
|
120
121
|
}
|
|
121
122
|
/**
|
|
122
|
-
*
|
|
123
|
+
* Base result for all signing operations (message signing, typed data signing).
|
|
123
124
|
*/
|
|
124
|
-
interface
|
|
125
|
+
interface SigningResultBase {
|
|
125
126
|
success: boolean;
|
|
126
127
|
/** WebAuthn signature if successful */
|
|
127
128
|
signature?: WebAuthnSignature;
|
|
128
|
-
/** The
|
|
129
|
-
signedMessage?: string;
|
|
130
|
-
/**
|
|
131
|
-
* The hash that was actually signed (EIP-191 format).
|
|
132
|
-
* Computed as: keccak256("\x19Ethereum Signed Message:\n" + len + message)
|
|
133
|
-
* Use hashMessage() from the SDK to verify this matches your original message.
|
|
134
|
-
*/
|
|
129
|
+
/** The hash that was signed */
|
|
135
130
|
signedHash?: `0x${string}`;
|
|
136
131
|
/** Passkey credentials used for signing */
|
|
137
132
|
passkey?: PasskeyCredentials;
|
|
@@ -141,12 +136,33 @@ interface SignMessageResult {
|
|
|
141
136
|
message: string;
|
|
142
137
|
};
|
|
143
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Result of signMessage
|
|
141
|
+
*/
|
|
142
|
+
interface SignMessageResult extends SigningResultBase {
|
|
143
|
+
/** The original message that was signed */
|
|
144
|
+
signedMessage?: string;
|
|
145
|
+
}
|
|
146
|
+
interface ClearSignData {
|
|
147
|
+
decoded: boolean;
|
|
148
|
+
verified: boolean;
|
|
149
|
+
functionName?: string;
|
|
150
|
+
intent?: string;
|
|
151
|
+
args?: Array<{
|
|
152
|
+
name: string;
|
|
153
|
+
type: string;
|
|
154
|
+
value: string;
|
|
155
|
+
label?: string;
|
|
156
|
+
}>;
|
|
157
|
+
selector?: string;
|
|
158
|
+
}
|
|
144
159
|
interface TransactionAction {
|
|
145
|
-
type: 'send' | 'receive' | 'approve' | 'swap' | 'mint' | 'custom';
|
|
160
|
+
type: 'send' | 'receive' | 'approve' | 'swap' | 'mint' | 'custom' | 'module_install';
|
|
146
161
|
label: string;
|
|
147
162
|
sublabel?: string;
|
|
148
163
|
amount?: string;
|
|
149
164
|
icon?: string;
|
|
165
|
+
clearSign?: ClearSignData;
|
|
150
166
|
}
|
|
151
167
|
interface TransactionFees {
|
|
152
168
|
estimated: string;
|
|
@@ -295,8 +311,6 @@ interface DeveloperSignedIntent {
|
|
|
295
311
|
/** Optional token requests */
|
|
296
312
|
tokenRequests?: IntentTokenRequest[];
|
|
297
313
|
}
|
|
298
|
-
/** @deprecated Use DeveloperSignedIntent instead */
|
|
299
|
-
type MerchantSignedIntent = DeveloperSignedIntent;
|
|
300
314
|
type IntentSigner = (params: {
|
|
301
315
|
username: string;
|
|
302
316
|
accountAddress?: string;
|
|
@@ -311,6 +325,8 @@ type IntentSigner = (params: {
|
|
|
311
325
|
interface SendIntentOptions {
|
|
312
326
|
/** Username of the signer (for unsigned requests) */
|
|
313
327
|
username?: string;
|
|
328
|
+
/** Account address of the signer (alternative to username for unsigned requests) */
|
|
329
|
+
accountAddress?: string;
|
|
314
330
|
/** Target chain ID (for unsigned requests) */
|
|
315
331
|
targetChain?: number;
|
|
316
332
|
/** Calls to execute on the target chain (for unsigned requests) */
|
|
@@ -426,6 +442,8 @@ interface PrepareIntentResponse {
|
|
|
426
442
|
chainId: number;
|
|
427
443
|
messageHash: string;
|
|
428
444
|
}>;
|
|
445
|
+
/** Serialized DigestResult from module SDK (EIP-712 wrapped challenge + merkle proofs) */
|
|
446
|
+
digestResult?: string;
|
|
429
447
|
}
|
|
430
448
|
/**
|
|
431
449
|
* Execute intent response from auth service
|
|
@@ -536,8 +554,10 @@ type EIP712Types = {
|
|
|
536
554
|
* Options for signTypedData
|
|
537
555
|
*/
|
|
538
556
|
interface SignTypedDataOptions {
|
|
539
|
-
/** Username of the signer */
|
|
540
|
-
username
|
|
557
|
+
/** Username of the signer (required if accountAddress is not provided) */
|
|
558
|
+
username?: string;
|
|
559
|
+
/** Account address of the signer (alternative to username) */
|
|
560
|
+
accountAddress?: string;
|
|
541
561
|
/** EIP-712 domain parameters */
|
|
542
562
|
domain: EIP712Domain;
|
|
543
563
|
/** Type definitions for all types used in the message */
|
|
@@ -554,19 +574,7 @@ interface SignTypedDataOptions {
|
|
|
554
574
|
/**
|
|
555
575
|
* Result of signTypedData
|
|
556
576
|
*/
|
|
557
|
-
interface SignTypedDataResult {
|
|
558
|
-
success: boolean;
|
|
559
|
-
/** WebAuthn signature if successful */
|
|
560
|
-
signature?: WebAuthnSignature;
|
|
561
|
-
/** The EIP-712 hash that was signed */
|
|
562
|
-
signedHash?: `0x${string}`;
|
|
563
|
-
/** Passkey credentials used for signing */
|
|
564
|
-
passkey?: PasskeyCredentials;
|
|
565
|
-
/** Error details if failed */
|
|
566
|
-
error?: {
|
|
567
|
-
code: SigningErrorCode;
|
|
568
|
-
message: string;
|
|
569
|
-
};
|
|
577
|
+
interface SignTypedDataResult extends SigningResultBase {
|
|
570
578
|
}
|
|
571
579
|
/**
|
|
572
580
|
* Options for querying intent history
|
|
@@ -620,20 +628,28 @@ interface BatchIntentItem {
|
|
|
620
628
|
/** Target chain ID */
|
|
621
629
|
targetChain: number;
|
|
622
630
|
/** Calls to execute on the target chain */
|
|
623
|
-
calls
|
|
631
|
+
calls?: IntentCall[];
|
|
624
632
|
/** Optional token requests */
|
|
625
633
|
tokenRequests?: IntentTokenRequest[];
|
|
626
634
|
/** Constrain which tokens can be used as input */
|
|
627
635
|
sourceAssets?: string[];
|
|
628
636
|
/** Source chain ID for the assets */
|
|
629
637
|
sourceChainId?: number;
|
|
638
|
+
/** Install an ERC-7579 module instead of executing calls */
|
|
639
|
+
moduleInstall?: {
|
|
640
|
+
moduleType: "validator" | "executor" | "fallback" | "hook";
|
|
641
|
+
moduleAddress: string;
|
|
642
|
+
initData?: string;
|
|
643
|
+
};
|
|
630
644
|
}
|
|
631
645
|
/**
|
|
632
646
|
* Options for sendBatchIntent
|
|
633
647
|
*/
|
|
634
648
|
interface SendBatchIntentOptions {
|
|
635
649
|
/** Username of the signer */
|
|
636
|
-
username
|
|
650
|
+
username?: string;
|
|
651
|
+
/** Account address of the signer (alternative to username) */
|
|
652
|
+
accountAddress?: string;
|
|
637
653
|
/** Array of intents to execute as a batch */
|
|
638
654
|
intents: BatchIntentItem[];
|
|
639
655
|
/** When to close the dialog for each intent. Defaults to "preconfirmed" */
|
|
@@ -669,6 +685,8 @@ interface SendBatchIntentResult {
|
|
|
669
685
|
successCount: number;
|
|
670
686
|
/** Count of failed intents */
|
|
671
687
|
failureCount: number;
|
|
688
|
+
/** Top-level error message when batch-prepare itself fails */
|
|
689
|
+
error?: string;
|
|
672
690
|
}
|
|
673
691
|
/**
|
|
674
692
|
* Prepared intent data within a batch response
|
|
@@ -698,8 +716,14 @@ interface PreparedBatchIntent {
|
|
|
698
716
|
* Prepare batch intent response from auth service
|
|
699
717
|
*/
|
|
700
718
|
interface PrepareBatchIntentResponse {
|
|
701
|
-
/** Per-intent prepared data */
|
|
719
|
+
/** Per-intent prepared data (successful quotes only) */
|
|
702
720
|
intents: PreparedBatchIntent[];
|
|
721
|
+
/** Intents that failed to get quotes (unsupported chains, etc.) */
|
|
722
|
+
failedIntents?: Array<{
|
|
723
|
+
index: number;
|
|
724
|
+
targetChain: number;
|
|
725
|
+
error: string;
|
|
726
|
+
}>;
|
|
703
727
|
/** Shared challenge (merkle root of ALL origin hashes across ALL intents) */
|
|
704
728
|
challenge: string;
|
|
705
729
|
/** User ID */
|
|
@@ -709,6 +733,61 @@ interface PrepareBatchIntentResponse {
|
|
|
709
733
|
/** Global expiry (earliest of all intent expiries) */
|
|
710
734
|
expiresAt: string;
|
|
711
735
|
}
|
|
736
|
+
/** Fields available for consent sharing */
|
|
737
|
+
type ConsentField = "email" | "deviceNames";
|
|
738
|
+
/** Shared data returned from consent */
|
|
739
|
+
interface ConsentData {
|
|
740
|
+
email?: string;
|
|
741
|
+
deviceNames?: string[];
|
|
742
|
+
}
|
|
743
|
+
/** Options for checkConsent (read-only, no dialog) */
|
|
744
|
+
interface CheckConsentOptions {
|
|
745
|
+
/** Username of the account (required if accountAddress not provided) */
|
|
746
|
+
username?: string;
|
|
747
|
+
/** Account address (alternative to username) */
|
|
748
|
+
accountAddress?: string;
|
|
749
|
+
/** Fields to check */
|
|
750
|
+
fields: ConsentField[];
|
|
751
|
+
/** Override clientId from SDK config */
|
|
752
|
+
clientId?: string;
|
|
753
|
+
}
|
|
754
|
+
/** Result of checkConsent */
|
|
755
|
+
interface CheckConsentResult {
|
|
756
|
+
/** Whether consent has been granted for ALL requested fields */
|
|
757
|
+
hasConsent: boolean;
|
|
758
|
+
/** Shared data (present when hasConsent is true) */
|
|
759
|
+
data?: ConsentData;
|
|
760
|
+
/** When consent was granted (ISO timestamp) */
|
|
761
|
+
grantedAt?: string;
|
|
762
|
+
}
|
|
763
|
+
/** Options for requestConsent (opens dialog if needed) */
|
|
764
|
+
interface RequestConsentOptions {
|
|
765
|
+
/** Username of the account (required if accountAddress not provided) */
|
|
766
|
+
username?: string;
|
|
767
|
+
/** Account address (alternative to username) */
|
|
768
|
+
accountAddress?: string;
|
|
769
|
+
/** Fields to request access to */
|
|
770
|
+
fields: ConsentField[];
|
|
771
|
+
/** Override clientId from SDK config */
|
|
772
|
+
clientId?: string;
|
|
773
|
+
/** Theme configuration */
|
|
774
|
+
theme?: ThemeConfig;
|
|
775
|
+
}
|
|
776
|
+
/** Result of requestConsent */
|
|
777
|
+
interface RequestConsentResult {
|
|
778
|
+
success: boolean;
|
|
779
|
+
/** Shared data (present when success is true) */
|
|
780
|
+
data?: ConsentData;
|
|
781
|
+
/** When consent was granted (ISO timestamp) */
|
|
782
|
+
grantedAt?: string;
|
|
783
|
+
/** Whether data came from an existing grant (no dialog shown) */
|
|
784
|
+
cached?: boolean;
|
|
785
|
+
/** Error details */
|
|
786
|
+
error?: {
|
|
787
|
+
code: "USER_REJECTED" | "USER_CANCELLED" | "INVALID_REQUEST" | "NETWORK_ERROR" | "UNKNOWN";
|
|
788
|
+
message: string;
|
|
789
|
+
};
|
|
790
|
+
}
|
|
712
791
|
|
|
713
792
|
declare class OneAuthClient {
|
|
714
793
|
private config;
|
|
@@ -742,13 +821,34 @@ declare class OneAuthClient {
|
|
|
742
821
|
getClientId(): string | undefined;
|
|
743
822
|
private waitForTransactionHash;
|
|
744
823
|
/**
|
|
745
|
-
* Open the
|
|
824
|
+
* Open the authentication modal (sign in + sign up).
|
|
825
|
+
*
|
|
826
|
+
* Handles both new user registration and returning user login in a single
|
|
827
|
+
* call — the modal shows the appropriate flow based on whether the user
|
|
828
|
+
* has a passkey registered.
|
|
829
|
+
*
|
|
830
|
+
* @param options.username - Pre-fill the username field
|
|
831
|
+
* @param options.theme - Override the theme for this modal invocation
|
|
832
|
+
* @param options.oauthEnabled - Set to false to hide OAuth sign-in buttons
|
|
833
|
+
* @returns {@link AuthResult} with user details and typed address
|
|
834
|
+
*
|
|
835
|
+
* @example
|
|
836
|
+
* ```typescript
|
|
837
|
+
* const result = await client.authWithModal();
|
|
838
|
+
*
|
|
839
|
+
* if (result.success) {
|
|
840
|
+
* console.log('Signed in as:', result.user?.username);
|
|
841
|
+
* console.log('Address:', result.user?.address); // typed `0x${string}`
|
|
842
|
+
* } else if (result.error?.code === 'USER_CANCELLED') {
|
|
843
|
+
* // User closed the modal
|
|
844
|
+
* }
|
|
845
|
+
* ```
|
|
746
846
|
*/
|
|
747
847
|
authWithModal(options?: {
|
|
748
848
|
username?: string;
|
|
749
849
|
theme?: ThemeConfig;
|
|
750
850
|
oauthEnabled?: boolean;
|
|
751
|
-
}): Promise<
|
|
851
|
+
}): Promise<AuthResult>;
|
|
752
852
|
/**
|
|
753
853
|
* Open the connect dialog (lightweight connection without passkey auth).
|
|
754
854
|
*
|
|
@@ -764,7 +864,7 @@ declare class OneAuthClient {
|
|
|
764
864
|
* const result = await client.connectWithModal();
|
|
765
865
|
*
|
|
766
866
|
* if (result.success) {
|
|
767
|
-
* console.log('Connected as:', result.username);
|
|
867
|
+
* console.log('Connected as:', result.user?.username);
|
|
768
868
|
* } else if (result.action === 'switch') {
|
|
769
869
|
* // User needs to sign in first
|
|
770
870
|
* const authResult = await client.authWithModal();
|
|
@@ -774,6 +874,41 @@ declare class OneAuthClient {
|
|
|
774
874
|
connectWithModal(options?: {
|
|
775
875
|
theme?: ThemeConfig;
|
|
776
876
|
}): Promise<ConnectResult>;
|
|
877
|
+
/**
|
|
878
|
+
* Check if a user has already granted consent for the requested fields.
|
|
879
|
+
* This is a read-only check — no dialog is shown.
|
|
880
|
+
*
|
|
881
|
+
* @example
|
|
882
|
+
* ```typescript
|
|
883
|
+
* const result = await client.checkConsent({
|
|
884
|
+
* username: "alice",
|
|
885
|
+
* fields: ["email"],
|
|
886
|
+
* });
|
|
887
|
+
* if (result.hasConsent) {
|
|
888
|
+
* console.log(result.data?.email);
|
|
889
|
+
* }
|
|
890
|
+
* ```
|
|
891
|
+
*/
|
|
892
|
+
checkConsent(options: CheckConsentOptions): Promise<CheckConsentResult>;
|
|
893
|
+
/**
|
|
894
|
+
* Request consent from the user to share their data.
|
|
895
|
+
*
|
|
896
|
+
* First checks if consent was already granted (returns cached data immediately).
|
|
897
|
+
* If not, opens the consent dialog where the user can review and approve sharing.
|
|
898
|
+
*
|
|
899
|
+
* @example
|
|
900
|
+
* ```typescript
|
|
901
|
+
* const result = await client.requestConsent({
|
|
902
|
+
* username: "alice",
|
|
903
|
+
* fields: ["email", "deviceNames"],
|
|
904
|
+
* });
|
|
905
|
+
* if (result.success) {
|
|
906
|
+
* console.log(result.data?.email);
|
|
907
|
+
* console.log(result.cached); // true if no dialog was shown
|
|
908
|
+
* }
|
|
909
|
+
* ```
|
|
910
|
+
*/
|
|
911
|
+
requestConsent(options: RequestConsentOptions): Promise<RequestConsentResult>;
|
|
777
912
|
/**
|
|
778
913
|
* Authenticate a user with an optional challenge to sign.
|
|
779
914
|
*
|
|
@@ -791,17 +926,16 @@ declare class OneAuthClient {
|
|
|
791
926
|
*
|
|
792
927
|
* @example
|
|
793
928
|
* ```typescript
|
|
794
|
-
* // Authenticate with a login challenge
|
|
795
929
|
* const result = await client.authenticate({
|
|
796
930
|
* challenge: `Login to MyApp\nTimestamp: ${Date.now()}\nNonce: ${crypto.randomUUID()}`
|
|
797
931
|
* });
|
|
798
932
|
*
|
|
799
|
-
* if (result.success && result.
|
|
933
|
+
* if (result.success && result.challenge) {
|
|
800
934
|
* // Verify signature server-side
|
|
801
935
|
* const isValid = await verifyOnServer(
|
|
802
|
-
* result.username,
|
|
803
|
-
* result.signature,
|
|
804
|
-
* result.signedHash
|
|
936
|
+
* result.user?.username,
|
|
937
|
+
* result.challenge.signature,
|
|
938
|
+
* result.challenge.signedHash
|
|
805
939
|
* );
|
|
806
940
|
* }
|
|
807
941
|
* ```
|
|
@@ -894,6 +1028,28 @@ declare class OneAuthClient {
|
|
|
894
1028
|
* Wait for the dialog to be closed
|
|
895
1029
|
*/
|
|
896
1030
|
private waitForDialogClose;
|
|
1031
|
+
/**
|
|
1032
|
+
* Inject a preconnect link tag to pre-warm DNS + TLS for a given URL.
|
|
1033
|
+
*/
|
|
1034
|
+
private injectPreconnect;
|
|
1035
|
+
/**
|
|
1036
|
+
* Wait for the dialog iframe to signal ready without sending init data.
|
|
1037
|
+
* Returns a sendInit function the caller uses once prepare data is available.
|
|
1038
|
+
*/
|
|
1039
|
+
private waitForDialogReadyDeferred;
|
|
1040
|
+
/**
|
|
1041
|
+
* Prepare an intent by calling the orchestrator for a quote.
|
|
1042
|
+
* Returns the prepare response and the origin tier from the response header.
|
|
1043
|
+
*/
|
|
1044
|
+
private prepareIntent;
|
|
1045
|
+
/**
|
|
1046
|
+
* Prepare a batch intent by calling the orchestrator for quotes on all intents.
|
|
1047
|
+
*/
|
|
1048
|
+
private prepareBatchIntent;
|
|
1049
|
+
/**
|
|
1050
|
+
* Send a prepare error message to the dialog iframe.
|
|
1051
|
+
*/
|
|
1052
|
+
private sendPrepareError;
|
|
897
1053
|
/**
|
|
898
1054
|
* Poll for intent status
|
|
899
1055
|
*
|
|
@@ -1057,9 +1213,10 @@ declare class OneAuthClient {
|
|
|
1057
1213
|
private waitForPopupAuthResponse;
|
|
1058
1214
|
private waitForAuthenticateResponse;
|
|
1059
1215
|
private waitForConnectResponse;
|
|
1216
|
+
private waitForConsentResponse;
|
|
1060
1217
|
private waitForModalSigningResponse;
|
|
1061
1218
|
private waitForPopupResponse;
|
|
1062
1219
|
private fetchSigningResult;
|
|
1063
1220
|
}
|
|
1064
1221
|
|
|
1065
|
-
export { type
|
|
1222
|
+
export { type RequestConsentResult as $, type AuthResult as A, type BalanceRequirement as B, type CreateSigningRequestResponse as C, type DeveloperSignedIntent as D, type EmbedOptions as E, type CloseOnStatus as F, type PrepareIntentResponse as G, type ExecuteIntentResponse as H, type IntentSigner as I, type IntentHistoryOptions as J, type IntentHistoryItem as K, type IntentHistoryResult as L, type SendSwapOptions as M, type SendSwapResult as N, OneAuthClient as O, type PasskeyProviderConfig as P, type SwapQuote as Q, type ThemeConfig as R, type SendIntentResult as S, type TransactionAction as T, type UserPasskeysResponse as U, type ConsentField as V, type WebAuthnSignature as W, type ConsentData as X, type CheckConsentOptions as Y, type CheckConsentResult as Z, type RequestConsentOptions as _, type IntentCall as a, type BatchIntentItem as a0, type SendBatchIntentOptions as a1, type SendBatchIntentResult as a2, type BatchIntentItemResult as a3, type PreparedBatchIntent as a4, type PrepareBatchIntentResponse as a5, type SigningRequestOptions as b, type SigningResult as c, type SigningSuccess as d, type SigningError as e, type SigningErrorCode as f, type SigningRequestStatus as g, type PasskeyCredential as h, type ConnectResult as i, type AuthenticateOptions as j, type AuthenticateResult as k, type SigningResultBase as l, type SignMessageOptions as m, type SignMessageResult as n, type SignTypedDataOptions as o, type SignTypedDataResult as p, type EIP712Domain as q, type EIP712Types as r, type EIP712TypeField as s, type TransactionFees as t, type TransactionDetails as u, type IntentTokenRequest as v, type SendIntentOptions as w, type IntentQuote as x, type IntentStatus as y, type OrchestratorStatus as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { O as OneAuthClient, I as IntentSigner, W as WebAuthnSignature, a as IntentCall, S as SendIntentResult } from './client-
|
|
2
|
-
export { A as AuthenticateOptions,
|
|
3
|
-
export { O as OneAuthProvider, a as OneAuthProviderOptions,
|
|
4
|
-
import {
|
|
1
|
+
import { O as OneAuthClient, I as IntentSigner, W as WebAuthnSignature, a as IntentCall, S as SendIntentResult } from './client-Di8SBnPO.mjs';
|
|
2
|
+
export { A as AuthResult, j as AuthenticateOptions, k as AuthenticateResult, B as BalanceRequirement, a0 as BatchIntentItem, a3 as BatchIntentItemResult, Y as CheckConsentOptions, Z as CheckConsentResult, F as CloseOnStatus, i as ConnectResult, X as ConsentData, V as ConsentField, C as CreateSigningRequestResponse, D as DeveloperSignedIntent, q as EIP712Domain, s as EIP712TypeField, r as EIP712Types, E as EmbedOptions, H as ExecuteIntentResponse, K as IntentHistoryItem, J as IntentHistoryOptions, L as IntentHistoryResult, x as IntentQuote, y as IntentStatus, v as IntentTokenRequest, z as OrchestratorStatus, h as PasskeyCredential, P as PasskeyProviderConfig, a5 as PrepareBatchIntentResponse, G as PrepareIntentResponse, a4 as PreparedBatchIntent, _ as RequestConsentOptions, $ as RequestConsentResult, a1 as SendBatchIntentOptions, a2 as SendBatchIntentResult, w as SendIntentOptions, M as SendSwapOptions, N as SendSwapResult, m as SignMessageOptions, n as SignMessageResult, o as SignTypedDataOptions, p as SignTypedDataResult, e as SigningError, f as SigningErrorCode, b as SigningRequestOptions, g as SigningRequestStatus, c as SigningResult, l as SigningResultBase, d as SigningSuccess, Q as SwapQuote, R as ThemeConfig, T as TransactionAction, u as TransactionDetails, t as TransactionFees, U as UserPasskeysResponse } from './client-Di8SBnPO.mjs';
|
|
3
|
+
export { O as OneAuthProvider, a as OneAuthProviderOptions, c as createOneAuthProvider } from './provider-8anOtc87.mjs';
|
|
4
|
+
import { Address, LocalAccount, Chain, Transport, Hex, WalletClient, Hash } from 'viem';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
export { getTokenAddress, getTokenDecimals } from '@rhinestone/sdk';
|
|
@@ -232,10 +232,6 @@ declare function isTokenAddressSupported(tokenAddress: Address, chainId: number)
|
|
|
232
232
|
* This is the standard Ethereum message prefix for `personal_sign`.
|
|
233
233
|
*/
|
|
234
234
|
declare const ETHEREUM_MESSAGE_PREFIX = "\u0019Ethereum Signed Message:\n";
|
|
235
|
-
/**
|
|
236
|
-
* @deprecated Use ETHEREUM_MESSAGE_PREFIX instead. Kept for backwards compatibility.
|
|
237
|
-
*/
|
|
238
|
-
declare const PASSKEY_MESSAGE_PREFIX = "\u0019Ethereum Signed Message:\n";
|
|
239
235
|
/**
|
|
240
236
|
* Hash a message with the EIP-191 Ethereum prefix.
|
|
241
237
|
*
|
|
@@ -277,4 +273,4 @@ declare function hashMessage(message: string): `0x${string}`;
|
|
|
277
273
|
*/
|
|
278
274
|
declare function verifyMessageHash(message: string, signedHash: string | undefined): boolean;
|
|
279
275
|
|
|
280
|
-
export { type BatchQueueContextValue, BatchQueueProvider, type BatchQueueProviderProps, BatchQueueWidget, type BatchQueueWidgetProps, type BatchedCall, type ChainFilterOptions, ETHEREUM_MESSAGE_PREFIX, IntentCall, IntentSigner, OneAuthClient,
|
|
276
|
+
export { type BatchQueueContextValue, BatchQueueProvider, type BatchQueueProviderProps, BatchQueueWidget, type BatchQueueWidgetProps, type BatchedCall, type ChainFilterOptions, ETHEREUM_MESSAGE_PREFIX, IntentCall, IntentSigner, OneAuthClient, type PasskeyAccount, type PasskeyWalletClient, type PasskeyWalletClientConfig, type SendCallsParams, SendIntentResult, type TokenConfig, type TransactionCall, WebAuthnSignature, createPasskeyAccount, createPasskeyWalletClient, encodeWebAuthnSignature, getAllSupportedChainsAndTokens, getChainById, getChainExplorerUrl, getChainName, getChainRpcUrl, getSupportedChainIds, getSupportedChains, getSupportedTokenSymbols, getSupportedTokens, getTokenSymbol, hashCalls, hashMessage, isTestnet, isTokenAddressSupported, resolveTokenAddress, useBatchQueue, verifyMessageHash };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { O as OneAuthClient, I as IntentSigner, W as WebAuthnSignature, a as IntentCall, S as SendIntentResult } from './client-
|
|
2
|
-
export { A as AuthenticateOptions,
|
|
3
|
-
export { O as OneAuthProvider, a as OneAuthProviderOptions,
|
|
4
|
-
import {
|
|
1
|
+
import { O as OneAuthClient, I as IntentSigner, W as WebAuthnSignature, a as IntentCall, S as SendIntentResult } from './client-Di8SBnPO.js';
|
|
2
|
+
export { A as AuthResult, j as AuthenticateOptions, k as AuthenticateResult, B as BalanceRequirement, a0 as BatchIntentItem, a3 as BatchIntentItemResult, Y as CheckConsentOptions, Z as CheckConsentResult, F as CloseOnStatus, i as ConnectResult, X as ConsentData, V as ConsentField, C as CreateSigningRequestResponse, D as DeveloperSignedIntent, q as EIP712Domain, s as EIP712TypeField, r as EIP712Types, E as EmbedOptions, H as ExecuteIntentResponse, K as IntentHistoryItem, J as IntentHistoryOptions, L as IntentHistoryResult, x as IntentQuote, y as IntentStatus, v as IntentTokenRequest, z as OrchestratorStatus, h as PasskeyCredential, P as PasskeyProviderConfig, a5 as PrepareBatchIntentResponse, G as PrepareIntentResponse, a4 as PreparedBatchIntent, _ as RequestConsentOptions, $ as RequestConsentResult, a1 as SendBatchIntentOptions, a2 as SendBatchIntentResult, w as SendIntentOptions, M as SendSwapOptions, N as SendSwapResult, m as SignMessageOptions, n as SignMessageResult, o as SignTypedDataOptions, p as SignTypedDataResult, e as SigningError, f as SigningErrorCode, b as SigningRequestOptions, g as SigningRequestStatus, c as SigningResult, l as SigningResultBase, d as SigningSuccess, Q as SwapQuote, R as ThemeConfig, T as TransactionAction, u as TransactionDetails, t as TransactionFees, U as UserPasskeysResponse } from './client-Di8SBnPO.js';
|
|
3
|
+
export { O as OneAuthProvider, a as OneAuthProviderOptions, c as createOneAuthProvider } from './provider-CFnLQt5m.js';
|
|
4
|
+
import { Address, LocalAccount, Chain, Transport, Hex, WalletClient, Hash } from 'viem';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
export { getTokenAddress, getTokenDecimals } from '@rhinestone/sdk';
|
|
@@ -232,10 +232,6 @@ declare function isTokenAddressSupported(tokenAddress: Address, chainId: number)
|
|
|
232
232
|
* This is the standard Ethereum message prefix for `personal_sign`.
|
|
233
233
|
*/
|
|
234
234
|
declare const ETHEREUM_MESSAGE_PREFIX = "\u0019Ethereum Signed Message:\n";
|
|
235
|
-
/**
|
|
236
|
-
* @deprecated Use ETHEREUM_MESSAGE_PREFIX instead. Kept for backwards compatibility.
|
|
237
|
-
*/
|
|
238
|
-
declare const PASSKEY_MESSAGE_PREFIX = "\u0019Ethereum Signed Message:\n";
|
|
239
235
|
/**
|
|
240
236
|
* Hash a message with the EIP-191 Ethereum prefix.
|
|
241
237
|
*
|
|
@@ -277,4 +273,4 @@ declare function hashMessage(message: string): `0x${string}`;
|
|
|
277
273
|
*/
|
|
278
274
|
declare function verifyMessageHash(message: string, signedHash: string | undefined): boolean;
|
|
279
275
|
|
|
280
|
-
export { type BatchQueueContextValue, BatchQueueProvider, type BatchQueueProviderProps, BatchQueueWidget, type BatchQueueWidgetProps, type BatchedCall, type ChainFilterOptions, ETHEREUM_MESSAGE_PREFIX, IntentCall, IntentSigner, OneAuthClient,
|
|
276
|
+
export { type BatchQueueContextValue, BatchQueueProvider, type BatchQueueProviderProps, BatchQueueWidget, type BatchQueueWidgetProps, type BatchedCall, type ChainFilterOptions, ETHEREUM_MESSAGE_PREFIX, IntentCall, IntentSigner, OneAuthClient, type PasskeyAccount, type PasskeyWalletClient, type PasskeyWalletClientConfig, type SendCallsParams, SendIntentResult, type TokenConfig, type TransactionCall, WebAuthnSignature, createPasskeyAccount, createPasskeyWalletClient, encodeWebAuthnSignature, getAllSupportedChainsAndTokens, getChainById, getChainExplorerUrl, getChainName, getChainRpcUrl, getSupportedChainIds, getSupportedChains, getSupportedTokenSymbols, getSupportedTokens, getTokenSymbol, hashCalls, hashMessage, isTestnet, isTokenAddressSupported, resolveTokenAddress, useBatchQueue, verifyMessageHash };
|