@rhinestone/1auth 0.6.8 → 0.6.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/README.md +171 -12
- package/dist/chunk-GUAI55LL.mjs +179 -0
- package/dist/chunk-GUAI55LL.mjs.map +1 -0
- package/dist/chunk-IHBVEU33.mjs +20 -0
- package/dist/chunk-IHBVEU33.mjs.map +1 -0
- package/dist/chunk-IIACVHR3.mjs +28 -0
- package/dist/chunk-IIACVHR3.mjs.map +1 -0
- package/dist/chunk-N6KE5CII.mjs +72 -0
- package/dist/chunk-N6KE5CII.mjs.map +1 -0
- package/dist/{chunk-SXISYG2P.mjs → chunk-THKG3FAG.mjs} +137 -255
- package/dist/chunk-THKG3FAG.mjs.map +1 -0
- package/dist/{client-BrMrhetG.d.mts → client-B_CzDa_I.d.ts} +360 -857
- package/dist/{client-BrMrhetG.d.ts → client-F4DnFM8d.d.mts} +360 -857
- package/dist/headless.d.mts +109 -0
- package/dist/headless.d.ts +109 -0
- package/dist/headless.js +467 -0
- package/dist/headless.js.map +1 -0
- package/dist/headless.mjs +382 -0
- package/dist/headless.mjs.map +1 -0
- package/dist/index.d.mts +96 -144
- package/dist/index.d.ts +96 -144
- package/dist/index.js +3212 -756
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3010 -705
- package/dist/index.mjs.map +1 -1
- package/dist/{provider-CDl9wYEc.d.mts → provider-Cd7Ip5L-.d.ts} +6 -5
- package/dist/{provider-Dgv533YQ.d.ts → provider-IvYXPMpk.d.mts} +6 -5
- package/dist/react.d.mts +42 -2
- package/dist/react.d.ts +42 -2
- package/dist/react.js +92 -2
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +66 -1
- package/dist/react.mjs.map +1 -1
- package/dist/server.d.mts +118 -0
- package/dist/server.d.ts +118 -0
- package/dist/server.js +356 -0
- package/dist/server.js.map +1 -0
- package/dist/server.mjs +282 -0
- package/dist/server.mjs.map +1 -0
- package/dist/types-U_dwxbtS.d.mts +1488 -0
- package/dist/types-U_dwxbtS.d.ts +1488 -0
- package/dist/verify-BLgZzwmJ.d.ts +150 -0
- package/dist/verify-C8-a5c3K.d.mts +150 -0
- package/dist/wagmi.d.mts +5 -2
- package/dist/wagmi.d.ts +5 -2
- package/dist/wagmi.js +138 -43
- package/dist/wagmi.js.map +1 -1
- package/dist/wagmi.mjs +3 -1
- package/dist/wagmi.mjs.map +1 -1
- package/package.json +15 -2
- package/dist/chunk-SXISYG2P.mjs.map +0 -1
|
@@ -1,756 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
* Theme configuration for the dialog UI
|
|
3
|
-
*/
|
|
4
|
-
interface ThemeConfig {
|
|
5
|
-
/** Color mode: 'light', 'dark', or 'system' (follows user's OS preference) */
|
|
6
|
-
mode?: 'light' | 'dark' | 'system';
|
|
7
|
-
/** Primary accent color (hex). Used for buttons and interactive elements */
|
|
8
|
-
accent?: string;
|
|
9
|
-
}
|
|
10
|
-
interface PasskeyProviderConfig {
|
|
11
|
-
/** Base URL of the auth API. Defaults to https://passkey.1auth.box */
|
|
12
|
-
providerUrl?: string;
|
|
13
|
-
/** Client identifier for this application (optional for development) */
|
|
14
|
-
clientId?: string;
|
|
15
|
-
/** Optional redirect URL for redirect flow */
|
|
16
|
-
redirectUrl?: string;
|
|
17
|
-
/** Optional URL of the dialog UI. Defaults to providerUrl */
|
|
18
|
-
dialogUrl?: string;
|
|
19
|
-
/** Optional theme configuration for the dialog */
|
|
20
|
-
theme?: ThemeConfig;
|
|
21
|
-
}
|
|
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 {
|
|
35
|
-
success: boolean;
|
|
36
|
-
/** Authenticated user details (present when `success` is true) */
|
|
37
|
-
user?: {
|
|
38
|
-
id: string;
|
|
39
|
-
username?: string;
|
|
40
|
-
address: `0x${string}`;
|
|
41
|
-
};
|
|
42
|
-
error?: {
|
|
43
|
-
code: string;
|
|
44
|
-
message: string;
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Result of the connect modal (lightweight connection without passkey auth)
|
|
49
|
-
*/
|
|
50
|
-
interface ConnectResult {
|
|
51
|
-
success: boolean;
|
|
52
|
-
/** Connected user details (present when `success` is true) */
|
|
53
|
-
user?: {
|
|
54
|
-
username?: string;
|
|
55
|
-
address: `0x${string}`;
|
|
56
|
-
};
|
|
57
|
-
/** Whether this was auto-connected (user had auto-connect enabled) */
|
|
58
|
-
autoConnected?: boolean;
|
|
59
|
-
/** Action to take when connection was not successful */
|
|
60
|
-
action?: "switch" | "cancel";
|
|
61
|
-
error?: {
|
|
62
|
-
code: string;
|
|
63
|
-
message: string;
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Options for the authenticate() method
|
|
68
|
-
*/
|
|
69
|
-
interface AuthenticateOptions {
|
|
70
|
-
/**
|
|
71
|
-
* Human-readable challenge message for the user to sign.
|
|
72
|
-
* The provider will hash this with a domain separator to prevent
|
|
73
|
-
* the signature from being reused for transaction signing.
|
|
74
|
-
*/
|
|
75
|
-
challenge?: string;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
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
|
-
* ```
|
|
90
|
-
*/
|
|
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}`;
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Options for signMessage
|
|
105
|
-
*/
|
|
106
|
-
interface SignMessageOptions {
|
|
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;
|
|
111
|
-
/** Human-readable message to sign */
|
|
112
|
-
message: string;
|
|
113
|
-
/** Optional custom challenge (defaults to message hash) */
|
|
114
|
-
challenge?: string;
|
|
115
|
-
/** Description shown to user in the dialog */
|
|
116
|
-
description?: string;
|
|
117
|
-
/** Optional metadata to display to the user */
|
|
118
|
-
metadata?: Record<string, unknown>;
|
|
119
|
-
/** Theme configuration */
|
|
120
|
-
theme?: ThemeConfig;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Base result for all signing operations (message signing, typed data signing).
|
|
124
|
-
*/
|
|
125
|
-
interface SigningResultBase {
|
|
126
|
-
success: boolean;
|
|
127
|
-
/** WebAuthn signature if successful */
|
|
128
|
-
signature?: WebAuthnSignature;
|
|
129
|
-
/** The hash that was signed */
|
|
130
|
-
signedHash?: `0x${string}`;
|
|
131
|
-
/** Passkey credentials used for signing */
|
|
132
|
-
passkey?: PasskeyCredentials;
|
|
133
|
-
/** Error details if failed */
|
|
134
|
-
error?: {
|
|
135
|
-
code: SigningErrorCode;
|
|
136
|
-
message: string;
|
|
137
|
-
};
|
|
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
|
-
}
|
|
159
|
-
interface TransactionAction {
|
|
160
|
-
type: 'send' | 'receive' | 'approve' | 'swap' | 'mint' | 'custom' | 'module_install';
|
|
161
|
-
label: string;
|
|
162
|
-
sublabel?: string;
|
|
163
|
-
amount?: string;
|
|
164
|
-
icon?: string;
|
|
165
|
-
clearSign?: ClearSignData;
|
|
166
|
-
}
|
|
167
|
-
interface TransactionFees {
|
|
168
|
-
estimated: string;
|
|
169
|
-
network: {
|
|
170
|
-
name: string;
|
|
171
|
-
icon?: string;
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
interface BalanceRequirement {
|
|
175
|
-
token: string;
|
|
176
|
-
amount: string;
|
|
177
|
-
faucetUrl?: string;
|
|
178
|
-
}
|
|
179
|
-
interface TransactionDetails {
|
|
180
|
-
actions: TransactionAction[];
|
|
181
|
-
fees?: TransactionFees;
|
|
182
|
-
requiredBalance?: BalanceRequirement;
|
|
183
|
-
account?: {
|
|
184
|
-
address: string;
|
|
185
|
-
label?: string;
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
interface SigningRequestOptions {
|
|
189
|
-
challenge: string;
|
|
190
|
-
username: string;
|
|
191
|
-
description?: string;
|
|
192
|
-
metadata?: Record<string, unknown>;
|
|
193
|
-
transaction?: TransactionDetails;
|
|
194
|
-
}
|
|
195
|
-
interface PasskeyCredential {
|
|
196
|
-
id: string;
|
|
197
|
-
deviceName: string | null;
|
|
198
|
-
publicKeyX: string;
|
|
199
|
-
publicKeyY: string;
|
|
200
|
-
}
|
|
201
|
-
interface UserPasskeysResponse {
|
|
202
|
-
passkeys: PasskeyCredential[];
|
|
203
|
-
}
|
|
204
|
-
interface WebAuthnSignature {
|
|
205
|
-
authenticatorData: string;
|
|
206
|
-
clientDataJSON: string;
|
|
207
|
-
challengeIndex: number;
|
|
208
|
-
typeIndex: number;
|
|
209
|
-
r: string;
|
|
210
|
-
s: string;
|
|
211
|
-
topOrigin: string | null;
|
|
212
|
-
}
|
|
213
|
-
interface PasskeyCredentials {
|
|
214
|
-
credentialId: string;
|
|
215
|
-
publicKeyX: string;
|
|
216
|
-
publicKeyY: string;
|
|
217
|
-
}
|
|
218
|
-
interface SigningSuccess {
|
|
219
|
-
success: true;
|
|
220
|
-
requestId?: string;
|
|
221
|
-
/** WebAuthn signature - present for message/typedData signing */
|
|
222
|
-
signature?: WebAuthnSignature;
|
|
223
|
-
/** Array of signatures for multi-origin cross-chain intents (one per source chain) */
|
|
224
|
-
originSignatures?: WebAuthnSignature[];
|
|
225
|
-
/** Credentials of the passkey used for signing - present for message/typedData signing */
|
|
226
|
-
passkey?: PasskeyCredentials;
|
|
227
|
-
/** Intent ID - present for intent signing (after execute in dialog) */
|
|
228
|
-
intentId?: string;
|
|
229
|
-
}
|
|
230
|
-
type SigningErrorCode = "USER_REJECTED" | "EXPIRED" | "INVALID_REQUEST" | "NETWORK_ERROR" | "POPUP_BLOCKED" | "SIGNING_FAILED" | "UNKNOWN";
|
|
231
|
-
interface EmbedOptions {
|
|
232
|
-
container: HTMLElement;
|
|
233
|
-
width?: string;
|
|
234
|
-
height?: string;
|
|
235
|
-
onReady?: () => void;
|
|
236
|
-
onClose?: () => void;
|
|
237
|
-
}
|
|
238
|
-
interface SigningError {
|
|
239
|
-
success: false;
|
|
240
|
-
requestId?: string;
|
|
241
|
-
error: {
|
|
242
|
-
code: SigningErrorCode;
|
|
243
|
-
message: string;
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
type SigningResult = SigningSuccess | SigningError;
|
|
247
|
-
interface CreateSigningRequestResponse {
|
|
248
|
-
requestId: string;
|
|
249
|
-
nonce: string;
|
|
250
|
-
signingUrl: string;
|
|
251
|
-
expiresAt: string;
|
|
252
|
-
}
|
|
253
|
-
interface SigningRequestStatus {
|
|
254
|
-
id: string;
|
|
255
|
-
status: "PENDING" | "COMPLETED" | "REJECTED" | "EXPIRED" | "FAILED";
|
|
256
|
-
signature?: WebAuthnSignature;
|
|
257
|
-
error?: {
|
|
258
|
-
code: SigningErrorCode;
|
|
259
|
-
message: string;
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* A call to execute on the target chain
|
|
264
|
-
*/
|
|
265
|
-
interface IntentCall {
|
|
266
|
-
/** Target contract address */
|
|
267
|
-
to: string;
|
|
268
|
-
/** Calldata to send */
|
|
269
|
-
data?: string;
|
|
270
|
-
/** Value in wei (as string for serialization) */
|
|
271
|
-
value?: string;
|
|
272
|
-
/** Optional label for the transaction review UI */
|
|
273
|
-
label?: string;
|
|
274
|
-
/** Optional sublabel for additional context */
|
|
275
|
-
sublabel?: string;
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Token request for the intent
|
|
279
|
-
*/
|
|
280
|
-
interface IntentTokenRequest {
|
|
281
|
-
/** Token contract address */
|
|
282
|
-
token: string;
|
|
283
|
-
/** Amount in base units (use parseUnits for decimals) */
|
|
284
|
-
amount: bigint;
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Options for sendIntent
|
|
288
|
-
*/
|
|
289
|
-
interface SendIntentOptions {
|
|
290
|
-
/** Username of the signer */
|
|
291
|
-
username?: string;
|
|
292
|
-
/** Account address of the signer (alternative to username) */
|
|
293
|
-
accountAddress?: string;
|
|
294
|
-
/** Target chain ID */
|
|
295
|
-
targetChain?: number;
|
|
296
|
-
/** Calls to execute on the target chain */
|
|
297
|
-
calls?: IntentCall[];
|
|
298
|
-
/** Optional token requests */
|
|
299
|
-
tokenRequests?: IntentTokenRequest[];
|
|
300
|
-
/**
|
|
301
|
-
* Constrain which tokens can be used as input/payment.
|
|
302
|
-
* If not specified, orchestrator picks from all available balances.
|
|
303
|
-
* Example: ['USDC'] or ['0x...'] to only use USDC as input.
|
|
304
|
-
*/
|
|
305
|
-
sourceAssets?: string[];
|
|
306
|
-
/**
|
|
307
|
-
* Source chain ID for the assets.
|
|
308
|
-
* When specified with sourceAssets containing addresses, tells orchestrator
|
|
309
|
-
* which chain to look for those tokens on.
|
|
310
|
-
*/
|
|
311
|
-
sourceChainId?: number;
|
|
312
|
-
/** When to close the dialog and return success. Defaults to "preconfirmed" */
|
|
313
|
-
closeOn?: CloseOnStatus;
|
|
314
|
-
/**
|
|
315
|
-
* Wait for a transaction hash before resolving.
|
|
316
|
-
* Defaults to false to preserve existing behavior.
|
|
317
|
-
*/
|
|
318
|
-
waitForHash?: boolean;
|
|
319
|
-
/** Maximum time to wait for a transaction hash in ms. */
|
|
320
|
-
hashTimeoutMs?: number;
|
|
321
|
-
/** Poll interval for transaction hash in ms. */
|
|
322
|
-
hashIntervalMs?: number;
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Quote from the Rhinestone orchestrator
|
|
326
|
-
*/
|
|
327
|
-
interface IntentQuote {
|
|
328
|
-
/** Total cost in input tokens */
|
|
329
|
-
cost: {
|
|
330
|
-
total: string;
|
|
331
|
-
breakdown?: {
|
|
332
|
-
gas?: string;
|
|
333
|
-
bridge?: string;
|
|
334
|
-
swap?: string;
|
|
335
|
-
};
|
|
336
|
-
};
|
|
337
|
-
/** Token requirements to fulfill the intent */
|
|
338
|
-
tokenRequirements: Array<{
|
|
339
|
-
token: string;
|
|
340
|
-
amount: string;
|
|
341
|
-
chainId: number;
|
|
342
|
-
}>;
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* Status of an intent (local states)
|
|
346
|
-
*/
|
|
347
|
-
type IntentStatus = "pending" | "quoted" | "signed" | "submitted" | "claimed" | "preconfirmed" | "filled" | "completed" | "failed" | "expired" | "unknown";
|
|
348
|
-
/**
|
|
349
|
-
* Orchestrator status (from Rhinestone)
|
|
350
|
-
* These are the statuses we can receive when polling
|
|
351
|
-
*/
|
|
352
|
-
type OrchestratorStatus = "PENDING" | "CLAIMED" | "PRECONFIRMED" | "FILLED" | "COMPLETED" | "FAILED" | "EXPIRED";
|
|
353
|
-
/**
|
|
354
|
-
* When to consider the transaction complete and close the dialog
|
|
355
|
-
* - "claimed" - Close when a solver has claimed the intent (fastest)
|
|
356
|
-
* - "preconfirmed" - Close on pre-confirmation (recommended)
|
|
357
|
-
* - "filled" - Close when the transaction is filled
|
|
358
|
-
* - "completed" - Wait for full completion (slowest, most certain)
|
|
359
|
-
*/
|
|
360
|
-
type CloseOnStatus = "claimed" | "preconfirmed" | "filled" | "completed";
|
|
361
|
-
/**
|
|
362
|
-
* Result of sendIntent
|
|
363
|
-
*/
|
|
364
|
-
interface SendIntentResult {
|
|
365
|
-
/** Whether the intent was successfully submitted */
|
|
366
|
-
success: boolean;
|
|
367
|
-
/** Intent ID for tracking */
|
|
368
|
-
intentId: string;
|
|
369
|
-
/** Current status */
|
|
370
|
-
status: IntentStatus;
|
|
371
|
-
/** Transaction hash if completed */
|
|
372
|
-
transactionHash?: string;
|
|
373
|
-
/** Operation ID from orchestrator */
|
|
374
|
-
operationId?: string;
|
|
375
|
-
/** Error details if failed */
|
|
376
|
-
error?: {
|
|
377
|
-
code: string;
|
|
378
|
-
message: string;
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* Prepare intent response from auth service
|
|
383
|
-
*/
|
|
384
|
-
interface PrepareIntentResponse {
|
|
385
|
-
quote: IntentQuote;
|
|
386
|
-
transaction: TransactionDetails;
|
|
387
|
-
challenge: string;
|
|
388
|
-
expiresAt: string;
|
|
389
|
-
/** Account address for the sign dialog to detect self-transfer vs external send */
|
|
390
|
-
accountAddress?: string;
|
|
391
|
-
/** Serialized PreparedTransactionData from orchestrator - needed for execute */
|
|
392
|
-
intentOp: string;
|
|
393
|
-
/** User ID for creating intent record on execute */
|
|
394
|
-
userId: string;
|
|
395
|
-
/** Target chain ID */
|
|
396
|
-
targetChain: number;
|
|
397
|
-
/** JSON stringified calls */
|
|
398
|
-
calls: string;
|
|
399
|
-
/** Origin message hashes for multi-source cross-chain intents */
|
|
400
|
-
originMessages?: Array<{
|
|
401
|
-
chainId: number;
|
|
402
|
-
messageHash: string;
|
|
403
|
-
}>;
|
|
404
|
-
/** Serialized DigestResult from module SDK (EIP-712 wrapped challenge + merkle proofs) */
|
|
405
|
-
digestResult?: string;
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Execute intent response from auth service
|
|
409
|
-
*/
|
|
410
|
-
interface ExecuteIntentResponse {
|
|
411
|
-
success: boolean;
|
|
412
|
-
intentId: string;
|
|
413
|
-
operationId?: string;
|
|
414
|
-
status: IntentStatus;
|
|
415
|
-
transactionHash?: string;
|
|
416
|
-
/** Transaction result data needed for waiting via POST /api/intent/wait */
|
|
417
|
-
transactionResult?: unknown;
|
|
418
|
-
error?: {
|
|
419
|
-
code: string;
|
|
420
|
-
message: string;
|
|
421
|
-
};
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* Options for sendSwap - high-level swap abstraction
|
|
425
|
-
*/
|
|
426
|
-
interface SendSwapOptions {
|
|
427
|
-
/** Username of the signer */
|
|
428
|
-
username: string;
|
|
429
|
-
/** Target chain ID where swap executes */
|
|
430
|
-
targetChain: number;
|
|
431
|
-
/** Token to swap from (address or supported symbol like 'ETH', 'USDC'). Omit to let the orchestrator pick. */
|
|
432
|
-
fromToken?: string;
|
|
433
|
-
/** Token to swap to (address or supported symbol) */
|
|
434
|
-
toToken: string;
|
|
435
|
-
/** Amount to swap in human-readable format (e.g., "0.1") */
|
|
436
|
-
amount: string;
|
|
437
|
-
/** Maximum slippage in basis points (1 bp = 0.01%). Default: 50 (0.5%) */
|
|
438
|
-
slippageBps?: number;
|
|
439
|
-
/**
|
|
440
|
-
* Override source assets for the swap. If not specified, defaults to [fromToken].
|
|
441
|
-
* This constrains which tokens the orchestrator can use as input.
|
|
442
|
-
*/
|
|
443
|
-
sourceAssets?: string[];
|
|
444
|
-
/**
|
|
445
|
-
* Source chain ID for the assets. When specified, the orchestrator will only
|
|
446
|
-
* look for source assets on this specific chain.
|
|
447
|
-
*/
|
|
448
|
-
sourceChainId?: number;
|
|
449
|
-
/** When to close the dialog. Defaults to "preconfirmed" */
|
|
450
|
-
closeOn?: CloseOnStatus;
|
|
451
|
-
/** Wait for a transaction hash before resolving. */
|
|
452
|
-
waitForHash?: boolean;
|
|
453
|
-
/** Maximum time to wait for a transaction hash in ms. */
|
|
454
|
-
hashTimeoutMs?: number;
|
|
455
|
-
/** Poll interval for transaction hash in ms. */
|
|
456
|
-
hashIntervalMs?: number;
|
|
457
|
-
}
|
|
458
|
-
/**
|
|
459
|
-
* Quote information from DEX aggregator
|
|
460
|
-
*/
|
|
461
|
-
interface SwapQuote {
|
|
462
|
-
/** Token being sold (undefined when orchestrator picks) */
|
|
463
|
-
fromToken?: string;
|
|
464
|
-
/** Token being bought */
|
|
465
|
-
toToken: string;
|
|
466
|
-
/** Amount of fromToken being sold */
|
|
467
|
-
amountIn: string;
|
|
468
|
-
/** Amount of toToken being received */
|
|
469
|
-
amountOut: string;
|
|
470
|
-
/** Exchange rate (amountOut / amountIn) */
|
|
471
|
-
rate: string;
|
|
472
|
-
/** Price impact percentage (if available) */
|
|
473
|
-
priceImpact?: string;
|
|
474
|
-
}
|
|
475
|
-
/**
|
|
476
|
-
* Result of sendSwap - extends SendIntentResult with swap-specific data
|
|
477
|
-
*/
|
|
478
|
-
interface SendSwapResult extends SendIntentResult {
|
|
479
|
-
/** The swap quote that was executed */
|
|
480
|
-
quote?: SwapQuote;
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* EIP-712 Domain parameters
|
|
484
|
-
*/
|
|
485
|
-
interface EIP712Domain {
|
|
486
|
-
/** Name of the signing domain (e.g., "Dai Stablecoin") */
|
|
487
|
-
name: string;
|
|
488
|
-
/** Version of the signing domain (e.g., "1") */
|
|
489
|
-
version: string;
|
|
490
|
-
/** Chain ID (optional) */
|
|
491
|
-
chainId?: number;
|
|
492
|
-
/** Verifying contract address (optional) */
|
|
493
|
-
verifyingContract?: `0x${string}`;
|
|
494
|
-
/** Salt for disambiguation (optional) */
|
|
495
|
-
salt?: `0x${string}`;
|
|
496
|
-
}
|
|
497
|
-
/**
|
|
498
|
-
* EIP-712 Type field definition
|
|
499
|
-
*/
|
|
500
|
-
interface EIP712TypeField {
|
|
501
|
-
/** Field name */
|
|
502
|
-
name: string;
|
|
503
|
-
/** Solidity type (e.g., "address", "uint256", "bytes32") */
|
|
504
|
-
type: string;
|
|
505
|
-
}
|
|
506
|
-
/**
|
|
507
|
-
* EIP-712 Types map - maps type names to their field definitions
|
|
508
|
-
*/
|
|
509
|
-
type EIP712Types = {
|
|
510
|
-
[typeName: string]: EIP712TypeField[];
|
|
511
|
-
};
|
|
512
|
-
/**
|
|
513
|
-
* Options for signTypedData
|
|
514
|
-
*/
|
|
515
|
-
interface SignTypedDataOptions {
|
|
516
|
-
/** Username of the signer (required if accountAddress is not provided) */
|
|
517
|
-
username?: string;
|
|
518
|
-
/** Account address of the signer (alternative to username) */
|
|
519
|
-
accountAddress?: string;
|
|
520
|
-
/** EIP-712 domain parameters */
|
|
521
|
-
domain: EIP712Domain;
|
|
522
|
-
/** Type definitions for all types used in the message */
|
|
523
|
-
types: EIP712Types;
|
|
524
|
-
/** Primary type being signed (must be a key in types) */
|
|
525
|
-
primaryType: string;
|
|
526
|
-
/** Message values matching the primaryType structure */
|
|
527
|
-
message: Record<string, unknown>;
|
|
528
|
-
/** Optional description shown in the dialog */
|
|
529
|
-
description?: string;
|
|
530
|
-
/** Theme configuration */
|
|
531
|
-
theme?: ThemeConfig;
|
|
532
|
-
}
|
|
533
|
-
/**
|
|
534
|
-
* Result of signTypedData
|
|
535
|
-
*/
|
|
536
|
-
interface SignTypedDataResult extends SigningResultBase {
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* Options for querying intent history
|
|
540
|
-
*/
|
|
541
|
-
interface IntentHistoryOptions {
|
|
542
|
-
/** Maximum number of intents to return (default: 50, max: 100) */
|
|
543
|
-
limit?: number;
|
|
544
|
-
/** Number of intents to skip for pagination */
|
|
545
|
-
offset?: number;
|
|
546
|
-
/** Filter by intent status */
|
|
547
|
-
status?: IntentStatus;
|
|
548
|
-
/** Filter by creation date (ISO string) - intents created on or after this date */
|
|
549
|
-
from?: string;
|
|
550
|
-
/** Filter by creation date (ISO string) - intents created on or before this date */
|
|
551
|
-
to?: string;
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* Single intent item in history response
|
|
555
|
-
*/
|
|
556
|
-
interface IntentHistoryItem {
|
|
557
|
-
/** Intent identifier (orchestrator's ID, used as primary key) */
|
|
558
|
-
intentId: string;
|
|
559
|
-
/** Current status of the intent */
|
|
560
|
-
status: IntentStatus;
|
|
561
|
-
/** Transaction hash (if completed) */
|
|
562
|
-
transactionHash?: string;
|
|
563
|
-
/** Target chain ID */
|
|
564
|
-
targetChain: number;
|
|
565
|
-
/** Calls that were executed */
|
|
566
|
-
calls: IntentCall[];
|
|
567
|
-
/** When the intent was created (ISO string) */
|
|
568
|
-
createdAt: string;
|
|
569
|
-
/** When the intent was last updated (ISO string) */
|
|
570
|
-
updatedAt: string;
|
|
571
|
-
}
|
|
572
|
-
/**
|
|
573
|
-
* Result of getIntentHistory
|
|
574
|
-
*/
|
|
575
|
-
interface IntentHistoryResult {
|
|
576
|
-
/** List of intents */
|
|
577
|
-
intents: IntentHistoryItem[];
|
|
578
|
-
/** Total count of matching intents */
|
|
579
|
-
total: number;
|
|
580
|
-
/** Whether there are more intents beyond this page */
|
|
581
|
-
hasMore: boolean;
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
|
-
* A single intent within a batch
|
|
585
|
-
*/
|
|
586
|
-
interface BatchIntentItem {
|
|
587
|
-
/** Target chain ID */
|
|
588
|
-
targetChain: number;
|
|
589
|
-
/** Calls to execute on the target chain */
|
|
590
|
-
calls?: IntentCall[];
|
|
591
|
-
/** Optional token requests */
|
|
592
|
-
tokenRequests?: IntentTokenRequest[];
|
|
593
|
-
/** Constrain which tokens can be used as input */
|
|
594
|
-
sourceAssets?: string[];
|
|
595
|
-
/** Source chain ID for the assets */
|
|
596
|
-
sourceChainId?: number;
|
|
597
|
-
/** Install an ERC-7579 module instead of executing calls */
|
|
598
|
-
moduleInstall?: {
|
|
599
|
-
moduleType: "validator" | "executor" | "fallback" | "hook";
|
|
600
|
-
moduleAddress: string;
|
|
601
|
-
initData?: string;
|
|
602
|
-
};
|
|
603
|
-
}
|
|
604
|
-
/**
|
|
605
|
-
* Options for sendBatchIntent
|
|
606
|
-
*/
|
|
607
|
-
interface SendBatchIntentOptions {
|
|
608
|
-
/** Username of the signer */
|
|
609
|
-
username?: string;
|
|
610
|
-
/** Account address of the signer (alternative to username) */
|
|
611
|
-
accountAddress?: string;
|
|
612
|
-
/** Array of intents to execute as a batch */
|
|
613
|
-
intents: BatchIntentItem[];
|
|
614
|
-
/** When to close the dialog for each intent. Defaults to "preconfirmed" */
|
|
615
|
-
closeOn?: CloseOnStatus;
|
|
616
|
-
}
|
|
617
|
-
/**
|
|
618
|
-
* Result for a single intent within a batch
|
|
619
|
-
*/
|
|
620
|
-
interface BatchIntentItemResult {
|
|
621
|
-
/** Index in the original batch */
|
|
622
|
-
index: number;
|
|
623
|
-
/** Whether this intent succeeded */
|
|
624
|
-
success: boolean;
|
|
625
|
-
/** Intent ID from orchestrator */
|
|
626
|
-
intentId: string;
|
|
627
|
-
/** Current status */
|
|
628
|
-
status: IntentStatus;
|
|
629
|
-
/** Error details if failed */
|
|
630
|
-
error?: {
|
|
631
|
-
code: string;
|
|
632
|
-
message: string;
|
|
633
|
-
};
|
|
634
|
-
}
|
|
635
|
-
/**
|
|
636
|
-
* Result of sendBatchIntent
|
|
637
|
-
*/
|
|
638
|
-
interface SendBatchIntentResult {
|
|
639
|
-
/** Whether ALL intents succeeded */
|
|
640
|
-
success: boolean;
|
|
641
|
-
/** Per-intent results */
|
|
642
|
-
results: BatchIntentItemResult[];
|
|
643
|
-
/** Count of successful intents */
|
|
644
|
-
successCount: number;
|
|
645
|
-
/** Count of failed intents */
|
|
646
|
-
failureCount: number;
|
|
647
|
-
/** Top-level error message when batch-prepare itself fails */
|
|
648
|
-
error?: string;
|
|
649
|
-
}
|
|
650
|
-
/**
|
|
651
|
-
* Prepared intent data within a batch response
|
|
652
|
-
*/
|
|
653
|
-
interface PreparedBatchIntent {
|
|
654
|
-
/** Index in the original batch */
|
|
655
|
-
index: number;
|
|
656
|
-
/** Quote from orchestrator */
|
|
657
|
-
quote: IntentQuote;
|
|
658
|
-
/** Decoded transaction details for UI */
|
|
659
|
-
transaction: TransactionDetails;
|
|
660
|
-
/** Serialized PreparedTransactionData from orchestrator */
|
|
661
|
-
intentOp: string;
|
|
662
|
-
/** Expiry for this specific intent */
|
|
663
|
-
expiresAt: string;
|
|
664
|
-
/** Target chain ID */
|
|
665
|
-
targetChain: number;
|
|
666
|
-
/** JSON stringified calls */
|
|
667
|
-
calls: string;
|
|
668
|
-
/** Origin message hashes for this intent */
|
|
669
|
-
originMessages: Array<{
|
|
670
|
-
chainId: number;
|
|
671
|
-
messageHash: string;
|
|
672
|
-
}>;
|
|
673
|
-
}
|
|
674
|
-
/**
|
|
675
|
-
* Prepare batch intent response from auth service
|
|
676
|
-
*/
|
|
677
|
-
interface PrepareBatchIntentResponse {
|
|
678
|
-
/** Per-intent prepared data (successful quotes only) */
|
|
679
|
-
intents: PreparedBatchIntent[];
|
|
680
|
-
/** Intents that failed to get quotes (unsupported chains, etc.) */
|
|
681
|
-
failedIntents?: Array<{
|
|
682
|
-
index: number;
|
|
683
|
-
targetChain: number;
|
|
684
|
-
error: string;
|
|
685
|
-
}>;
|
|
686
|
-
/** Shared challenge (merkle root of ALL origin hashes across ALL intents) */
|
|
687
|
-
challenge: string;
|
|
688
|
-
/** User ID */
|
|
689
|
-
userId: string;
|
|
690
|
-
/** Account address */
|
|
691
|
-
accountAddress?: string;
|
|
692
|
-
/** Global expiry (earliest of all intent expiries) */
|
|
693
|
-
expiresAt: string;
|
|
694
|
-
}
|
|
695
|
-
/** Fields available for consent sharing */
|
|
696
|
-
type ConsentField = "email" | "deviceNames";
|
|
697
|
-
/** Shared data returned from consent */
|
|
698
|
-
interface ConsentData {
|
|
699
|
-
email?: string;
|
|
700
|
-
deviceNames?: string[];
|
|
701
|
-
}
|
|
702
|
-
/** Options for checkConsent (read-only, no dialog) */
|
|
703
|
-
interface CheckConsentOptions {
|
|
704
|
-
/** Username of the account (required if accountAddress not provided) */
|
|
705
|
-
username?: string;
|
|
706
|
-
/** Account address (alternative to username) */
|
|
707
|
-
accountAddress?: string;
|
|
708
|
-
/** Fields to check */
|
|
709
|
-
fields: ConsentField[];
|
|
710
|
-
/** Override clientId from SDK config */
|
|
711
|
-
clientId?: string;
|
|
712
|
-
}
|
|
713
|
-
/** Result of checkConsent */
|
|
714
|
-
interface CheckConsentResult {
|
|
715
|
-
/** Whether consent has been granted for ALL requested fields */
|
|
716
|
-
hasConsent: boolean;
|
|
717
|
-
/** Shared data (present when hasConsent is true) */
|
|
718
|
-
data?: ConsentData;
|
|
719
|
-
/** When consent was granted (ISO timestamp) */
|
|
720
|
-
grantedAt?: string;
|
|
721
|
-
}
|
|
722
|
-
/** Options for requestConsent (opens dialog if needed) */
|
|
723
|
-
interface RequestConsentOptions {
|
|
724
|
-
/** Username of the account (required if accountAddress not provided) */
|
|
725
|
-
username?: string;
|
|
726
|
-
/** Account address (alternative to username) */
|
|
727
|
-
accountAddress?: string;
|
|
728
|
-
/** Fields to request access to */
|
|
729
|
-
fields: ConsentField[];
|
|
730
|
-
/** Override clientId from SDK config */
|
|
731
|
-
clientId?: string;
|
|
732
|
-
/** Theme configuration */
|
|
733
|
-
theme?: ThemeConfig;
|
|
734
|
-
}
|
|
735
|
-
/** Result of requestConsent */
|
|
736
|
-
interface RequestConsentResult {
|
|
737
|
-
success: boolean;
|
|
738
|
-
/** Shared data (present when success is true) */
|
|
739
|
-
data?: ConsentData;
|
|
740
|
-
/** When consent was granted (ISO timestamp) */
|
|
741
|
-
grantedAt?: string;
|
|
742
|
-
/** Whether data came from an existing grant (no dialog shown) */
|
|
743
|
-
cached?: boolean;
|
|
744
|
-
/** Error details */
|
|
745
|
-
error?: {
|
|
746
|
-
code: "USER_REJECTED" | "USER_CANCELLED" | "INVALID_REQUEST" | "NETWORK_ERROR" | "UNKNOWN";
|
|
747
|
-
message: string;
|
|
748
|
-
};
|
|
749
|
-
}
|
|
1
|
+
import { P as PasskeyProviderConfig, S as SponsorshipConfig, aa as ThemeConfig, a6 as GetAssetsOptions, a9 as AssetsResponse, v as AuthWithModalOptions, A as AuthResult, L as LoginWithModalOptions, w as CreateAccountWithModalOptions, y as ConnectResult, ad as CheckConsentOptions, ae as CheckConsentResult, af as RequestConsentOptions, ag as RequestConsentResult, ah as GrantPermissionsOptions, ai as GrantPermissionsResult, aj as ListSessionGrantsOptions, ak as ListSessionGrantsResult, z as AuthenticateOptions, B as AuthenticateResult, m as SigningRequestOptions, n as SigningResult, Y as SendIntentOptions, i as SendIntentResult, aq as SendBatchIntentOptions, ar as SendBatchIntentResult, a3 as IntentHistoryOptions, a5 as IntentHistoryResult, F as SignMessageOptions, G as SignMessageResult, J as SignTypedDataOptions, K as SignTypedDataResult, E as EmbedOptions, t as PasskeyCredential } from './types-U_dwxbtS.js';
|
|
750
2
|
|
|
751
3
|
declare class OneAuthClient {
|
|
752
4
|
private config;
|
|
753
5
|
private theme;
|
|
6
|
+
private sponsorship;
|
|
7
|
+
private eoaDialogState;
|
|
8
|
+
private prewarmState;
|
|
9
|
+
private eoaSerialQueue;
|
|
754
10
|
/**
|
|
755
11
|
* Create a new OneAuthClient.
|
|
756
12
|
*
|
|
@@ -763,6 +19,73 @@ declare class OneAuthClient {
|
|
|
763
19
|
* clientId, theme, and redirect settings.
|
|
764
20
|
*/
|
|
765
21
|
constructor(config: PasskeyProviderConfig);
|
|
22
|
+
/**
|
|
23
|
+
* Update the sponsorship configuration at runtime. Pass `undefined` to
|
|
24
|
+
* disable sponsorship.
|
|
25
|
+
*/
|
|
26
|
+
setSponsorship(sponsorship: SponsorshipConfig | undefined): void;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the caller opted into SDK telemetry propagation or callbacks.
|
|
29
|
+
*/
|
|
30
|
+
private shouldUseTelemetry;
|
|
31
|
+
/**
|
|
32
|
+
* Resolve the host app's current trace context. Callback failures are
|
|
33
|
+
* ignored because observability can never be allowed to break signing.
|
|
34
|
+
*/
|
|
35
|
+
private getTelemetryTraceContext;
|
|
36
|
+
/**
|
|
37
|
+
* Resolve host-provided SDK event attributes and remove undefined fields.
|
|
38
|
+
*/
|
|
39
|
+
private getTelemetryAttributes;
|
|
40
|
+
/**
|
|
41
|
+
* Create per-operation telemetry context shared by callbacks, HTTP headers,
|
|
42
|
+
* dialog URL params, and PASSKEY_INIT messages.
|
|
43
|
+
*/
|
|
44
|
+
private createTelemetryOperation;
|
|
45
|
+
/**
|
|
46
|
+
* Emit a telemetry event to the host app. The callback is intentionally
|
|
47
|
+
* fire-and-forget and exception-safe so app telemetry cannot affect users.
|
|
48
|
+
*/
|
|
49
|
+
private emitTelemetry;
|
|
50
|
+
/**
|
|
51
|
+
* Attach SDK correlation and optional W3C trace context to dialog URLs.
|
|
52
|
+
*/
|
|
53
|
+
private appendTelemetryParams;
|
|
54
|
+
/**
|
|
55
|
+
* Add SDK correlation headers to passkey API calls. These headers are also
|
|
56
|
+
* valid W3C trace propagation inputs when the host app supplies traceparent.
|
|
57
|
+
*/
|
|
58
|
+
private telemetryHeaders;
|
|
59
|
+
/**
|
|
60
|
+
* Embed telemetry context in PASSKEY_INIT payloads for dialog-side API calls.
|
|
61
|
+
*/
|
|
62
|
+
private telemetryPayload;
|
|
63
|
+
/**
|
|
64
|
+
* Determine whether this signing call should request invisible dialog mode.
|
|
65
|
+
* Resolution order: per-call option wins over the constructor config, which
|
|
66
|
+
* wins over the platform-wide {@link DEFAULT_BLIND_SIGNING}. This lets an app
|
|
67
|
+
* flip the global default for itself while still overriding individual
|
|
68
|
+
* high-risk calls — e.g. default-blind but force the review UI for a large
|
|
69
|
+
* transfer, or default-visible but blind-sign selected low-risk signatures.
|
|
70
|
+
*/
|
|
71
|
+
private shouldRequestBlindSigning;
|
|
72
|
+
/**
|
|
73
|
+
* Fetch the app's access token (JWT). Called up front, before
|
|
74
|
+
* `/api/intent/prepare`, so the passkey server can authenticate the
|
|
75
|
+
* orchestrator quote call with the app's JWT instead of a service-level
|
|
76
|
+
* API key.
|
|
77
|
+
*
|
|
78
|
+
* Does not depend on `intentOp` — can run in parallel with anything that
|
|
79
|
+
* also doesn't depend on the quote.
|
|
80
|
+
*/
|
|
81
|
+
private fetchAccessToken;
|
|
82
|
+
/**
|
|
83
|
+
* Fetch one extension token per intent, aligned with `sponsorFlags`.
|
|
84
|
+
* Returns an empty array when no intent is sponsored. Fired after
|
|
85
|
+
* `/prepare` so each token can be bound to its quote's `intentOp`, and
|
|
86
|
+
* overlaps the dialog / WebAuthn ceremony for no added serial latency.
|
|
87
|
+
*/
|
|
88
|
+
private fetchExtensionTokens;
|
|
766
89
|
/**
|
|
767
90
|
* Update the theme configuration at runtime
|
|
768
91
|
*/
|
|
@@ -813,6 +136,23 @@ declare class OneAuthClient {
|
|
|
813
136
|
* Get the configured client ID
|
|
814
137
|
*/
|
|
815
138
|
getClientId(): string | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* Whether this client operates on testnet chains only.
|
|
141
|
+
*/
|
|
142
|
+
getTestnets(): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Get a unified token portfolio for a 1auth account across mainnets and
|
|
145
|
+
* testnets.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const assets = await client.getAssets({
|
|
150
|
+
* accountAddress: "0x1111111111111111111111111111111111111111",
|
|
151
|
+
* });
|
|
152
|
+
* console.log(assets.mainnets.balances, assets.testnets.balances);
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
getAssets(options: GetAssetsOptions): Promise<AssetsResponse>;
|
|
816
156
|
/**
|
|
817
157
|
* Poll the intent status endpoint until a transaction hash appears or the
|
|
818
158
|
* intent reaches a terminal failure state.
|
|
@@ -842,6 +182,8 @@ declare class OneAuthClient {
|
|
|
842
182
|
* @param options.username - Pre-fill the username field
|
|
843
183
|
* @param options.theme - Override the theme for this modal invocation
|
|
844
184
|
* @param options.oauthEnabled - Set to false to hide OAuth sign-in buttons
|
|
185
|
+
* @param options.flow - Force the login or account-creation route instead
|
|
186
|
+
* of the default auto-detect entry route
|
|
845
187
|
* @returns {@link AuthResult} with user details and typed address
|
|
846
188
|
*
|
|
847
189
|
* @example
|
|
@@ -856,11 +198,52 @@ declare class OneAuthClient {
|
|
|
856
198
|
* }
|
|
857
199
|
* ```
|
|
858
200
|
*/
|
|
859
|
-
authWithModal(options?:
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
201
|
+
authWithModal(options?: AuthWithModalOptions): Promise<AuthResult>;
|
|
202
|
+
/**
|
|
203
|
+
* Open the sign-in modal directly.
|
|
204
|
+
*
|
|
205
|
+
* This bypasses the `/dialog/auth` auto-router and targets the dedicated
|
|
206
|
+
* returning-user flow. Use it when the embedding app already knows the user
|
|
207
|
+
* is creating a login session, for example after an app-level "Log in"
|
|
208
|
+
* button. The result intentionally matches {@link authWithModal}.
|
|
209
|
+
*
|
|
210
|
+
* @param options.username - Optional account hint for the sign-in ceremony
|
|
211
|
+
* @param options.theme - Override the theme for this modal invocation
|
|
212
|
+
* @returns {@link AuthResult} with user details and typed address
|
|
213
|
+
*/
|
|
214
|
+
loginWithModal(options?: LoginWithModalOptions): Promise<AuthResult>;
|
|
215
|
+
/**
|
|
216
|
+
* Open the account-creation modal directly.
|
|
217
|
+
*
|
|
218
|
+
* This bypasses the `/dialog/auth` auto-router and targets the dedicated
|
|
219
|
+
* sign-up flow. Account creation still happens server-side in the passkey
|
|
220
|
+
* service; the SDK only opens the dialog and receives the postMessage result.
|
|
221
|
+
*
|
|
222
|
+
* @param options.theme - Override the theme for this modal invocation
|
|
223
|
+
* @param options.oauthEnabled - Set to false to hide OAuth sign-in buttons
|
|
224
|
+
* @returns {@link AuthResult} with the newly authenticated account details
|
|
225
|
+
*/
|
|
226
|
+
createAccountWithModal(options?: CreateAccountWithModalOptions): Promise<AuthResult>;
|
|
227
|
+
/**
|
|
228
|
+
* Open one of the passkey authentication modal routes and wait for the
|
|
229
|
+
* login-result message.
|
|
230
|
+
*
|
|
231
|
+
* Keeping URL construction in one helper prevents the explicit login/signup
|
|
232
|
+
* methods from drifting away from the legacy `authWithModal` behavior.
|
|
233
|
+
*/
|
|
234
|
+
private openAuthModal;
|
|
235
|
+
/**
|
|
236
|
+
* Generate a per-dialog nonce used to correlate iframe close messages with
|
|
237
|
+
* the SDK modal that opened them. Chromium can report a different
|
|
238
|
+
* `MessageEvent.source` WindowProxy after the `/dialog/auth` redirect, so
|
|
239
|
+
* auth close handling needs a stable in-band identifier without accepting
|
|
240
|
+
* stale close messages from earlier dialogs.
|
|
241
|
+
*/
|
|
242
|
+
private createDialogRequestId;
|
|
243
|
+
/**
|
|
244
|
+
* Resolve the passkey app route for a requested auth flow.
|
|
245
|
+
*/
|
|
246
|
+
private getAuthDialogPath;
|
|
864
247
|
/**
|
|
865
248
|
* Open the connect dialog (lightweight connection without passkey auth).
|
|
866
249
|
*
|
|
@@ -886,6 +269,42 @@ declare class OneAuthClient {
|
|
|
886
269
|
connectWithModal(options?: {
|
|
887
270
|
theme?: ThemeConfig;
|
|
888
271
|
}): Promise<ConnectResult>;
|
|
272
|
+
/**
|
|
273
|
+
* High-level connect entry point — the method most integrators want.
|
|
274
|
+
*
|
|
275
|
+
* Tries the lightweight {@link connectWithModal} first (no passkey ceremony
|
|
276
|
+
* for returning users on the same browser), and transparently falls back to
|
|
277
|
+
* {@link authWithModal} when the connect dialog reports it has no stored
|
|
278
|
+
* credentials for this origin (`action: "switch"`). First-time visitors get
|
|
279
|
+
* one passkey ceremony to register; subsequent connects on the same browser
|
|
280
|
+
* resolve with no biometric prompt — and silently when the user has enabled
|
|
281
|
+
* "Connect automatically".
|
|
282
|
+
*
|
|
283
|
+
* The return shape is the same {@link ConnectResult} discriminated union as
|
|
284
|
+
* {@link connectWithModal}, so callers can treat both paths uniformly. When
|
|
285
|
+
* the auth-modal fallback runs, its successful result is normalized into a
|
|
286
|
+
* `ConnectResult` (no `id` field — the embedder origin must not see it).
|
|
287
|
+
*
|
|
288
|
+
* Cancellation: if the user cancels either dialog, the result is
|
|
289
|
+
* `{ success: false, action: "cancel", error: { code: "USER_CANCELLED", … } }`.
|
|
290
|
+
*
|
|
291
|
+
* @param options - Forwarded to whichever underlying modal is shown.
|
|
292
|
+
* `username` and `oauthEnabled` only apply to the auth-modal fallback path.
|
|
293
|
+
* @returns A {@link ConnectResult} discriminated union.
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```typescript
|
|
297
|
+
* const result = await client.connect();
|
|
298
|
+
* if (result.success) {
|
|
299
|
+
* console.log("Connected as", result.user?.username ?? result.user?.address);
|
|
300
|
+
* }
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
connect(options?: {
|
|
304
|
+
username?: string;
|
|
305
|
+
theme?: ThemeConfig;
|
|
306
|
+
oauthEnabled?: boolean;
|
|
307
|
+
}): Promise<ConnectResult>;
|
|
889
308
|
/**
|
|
890
309
|
* Open the account management dialog.
|
|
891
310
|
*
|
|
@@ -901,41 +320,58 @@ declare class OneAuthClient {
|
|
|
901
320
|
openAccountDialog(options?: {
|
|
902
321
|
theme?: ThemeConfig;
|
|
903
322
|
}): Promise<void>;
|
|
323
|
+
/**
|
|
324
|
+
* Open the account-recovery backup flow directly.
|
|
325
|
+
*
|
|
326
|
+
* Deep-links into the "Backup your account" flow inside the account dialog
|
|
327
|
+
* (rather than the account overview): the user verifies with their passkey,
|
|
328
|
+
* then saves a recovery passphrase and downloads an encrypted backup file.
|
|
329
|
+
* Use this to prompt users to secure their account after sign-up.
|
|
330
|
+
*
|
|
331
|
+
* Requires an authenticated user (call `authWithModal()` / `connect()`
|
|
332
|
+
* first) — the dialog reads the signed-in user from the passkey origin.
|
|
333
|
+
*
|
|
334
|
+
* Resolves `{ completed: true }` when the user finishes the backup, or
|
|
335
|
+
* `{ completed: false }` if they dismiss it — so callers can mark an
|
|
336
|
+
* onboarding step done or re-prompt later.
|
|
337
|
+
*/
|
|
338
|
+
setupRecovery(options?: {
|
|
339
|
+
theme?: ThemeConfig;
|
|
340
|
+
}): Promise<{
|
|
341
|
+
completed: boolean;
|
|
342
|
+
}>;
|
|
904
343
|
/**
|
|
905
344
|
* Check if a user has already granted consent for the requested fields.
|
|
906
|
-
* This is a read-only check — no dialog is shown.
|
|
907
345
|
*
|
|
908
|
-
* @
|
|
909
|
-
*
|
|
910
|
-
*
|
|
911
|
-
* username: "alice",
|
|
912
|
-
* fields: ["email"],
|
|
913
|
-
* });
|
|
914
|
-
* if (result.hasConsent) {
|
|
915
|
-
* console.log(result.data?.email);
|
|
916
|
-
* }
|
|
917
|
-
* ```
|
|
346
|
+
* @deprecated Data-sharing consent is disabled.
|
|
347
|
+
*
|
|
348
|
+
* Always returns `{ hasConsent: false }`.
|
|
918
349
|
*/
|
|
919
350
|
checkConsent(options: CheckConsentOptions): Promise<CheckConsentResult>;
|
|
920
351
|
/**
|
|
921
352
|
* Request consent from the user to share their data.
|
|
922
353
|
*
|
|
923
|
-
*
|
|
924
|
-
* If not, opens the consent dialog where the user can review and approve sharing.
|
|
354
|
+
* @deprecated Data-sharing consent is disabled.
|
|
925
355
|
*
|
|
926
|
-
*
|
|
927
|
-
* ```typescript
|
|
928
|
-
* const result = await client.requestConsent({
|
|
929
|
-
* username: "alice",
|
|
930
|
-
* fields: ["email", "deviceNames"],
|
|
931
|
-
* });
|
|
932
|
-
* if (result.success) {
|
|
933
|
-
* console.log(result.data?.email);
|
|
934
|
-
* console.log(result.cached); // true if no dialog was shown
|
|
935
|
-
* }
|
|
936
|
-
* ```
|
|
356
|
+
* Always returns an `INVALID_REQUEST` result.
|
|
937
357
|
*/
|
|
938
358
|
requestConsent(options: RequestConsentOptions): Promise<RequestConsentResult>;
|
|
359
|
+
/**
|
|
360
|
+
* Open the dedicated SmartSession permission grant dialog.
|
|
361
|
+
*
|
|
362
|
+
* The app owns the session key material and sends only the public
|
|
363
|
+
* `sessionKeyAddress`. 1auth renders the permission review, collects the
|
|
364
|
+
* owner's passkey authorization, submits the install/enable intent, and
|
|
365
|
+
* returns a persistable session handle.
|
|
366
|
+
*/
|
|
367
|
+
grantPermissions(options: GrantPermissionsOptions): Promise<GrantPermissionsResult>;
|
|
368
|
+
/**
|
|
369
|
+
* List SmartSession grants previously granted to the current browser origin.
|
|
370
|
+
*
|
|
371
|
+
* 1auth derives the app identity from the request Origin header. The SDK does
|
|
372
|
+
* not send `clientId` for this lookup because grants are origin-scoped.
|
|
373
|
+
*/
|
|
374
|
+
listSessionGrants(options: ListSessionGrantsOptions): Promise<ListSessionGrantsResult>;
|
|
939
375
|
/**
|
|
940
376
|
* Authenticate a user with an optional challenge to sign.
|
|
941
377
|
*
|
|
@@ -943,13 +379,13 @@ declare class OneAuthClient {
|
|
|
943
379
|
* challenge signing, enabling off-chain login without on-chain transactions.
|
|
944
380
|
*
|
|
945
381
|
* When a challenge is provided:
|
|
946
|
-
* 1. User authenticates (sign in or sign up)
|
|
947
|
-
* 2.
|
|
948
|
-
* 3.
|
|
949
|
-
* 4. Returns user info + signature for server-side verification
|
|
382
|
+
* 1. User authenticates (sign in or sign up) through the normal auth dialog
|
|
383
|
+
* 2. User signs the challenge through the normal signing dialog
|
|
384
|
+
* 3. Returns user info + signature for server-side verification
|
|
950
385
|
*
|
|
951
|
-
*
|
|
952
|
-
*
|
|
386
|
+
* This composes the same supported provider routes as calling
|
|
387
|
+
* `authWithModal()` followed by `signMessage()`, so challenge auth cannot
|
|
388
|
+
* drift onto a provider route that the passkey service does not expose.
|
|
953
389
|
*
|
|
954
390
|
* @example
|
|
955
391
|
* ```typescript
|
|
@@ -1119,6 +555,24 @@ declare class OneAuthClient {
|
|
|
1119
555
|
* @param cleanup - Idempotent teardown that closes and removes the dialog.
|
|
1120
556
|
*/
|
|
1121
557
|
private waitForDialogClose;
|
|
558
|
+
/**
|
|
559
|
+
* Hidden blind-signing iframes have no user-visible Done or Close button.
|
|
560
|
+
* Once the SDK has the result it needs, tear them down immediately instead
|
|
561
|
+
* of waiting for an iframe close event that can never be clicked.
|
|
562
|
+
*/
|
|
563
|
+
private waitForDialogCloseUnlessBlind;
|
|
564
|
+
/**
|
|
565
|
+
* After a prepare error has been surfaced in the dialog, wait for the user
|
|
566
|
+
* to either close the dialog (give up) or click "Try Again", which the
|
|
567
|
+
* dialog forwards as `PASSKEY_RETRY_PREPARE`.
|
|
568
|
+
*
|
|
569
|
+
* On `"closed"` the dialog has been cleaned up; on `"retry"` it stays open
|
|
570
|
+
* (showing its loading skeleton) while the caller re-runs prepare. Without
|
|
571
|
+
* this, "Try Again" after a prepare failure was a dead end: the dialog
|
|
572
|
+
* reset its local state but the SDK had already given up, so the quote
|
|
573
|
+
* never arrived and the Sign button stayed disabled forever.
|
|
574
|
+
*/
|
|
575
|
+
private waitForPrepareRetryOrClose;
|
|
1122
576
|
/**
|
|
1123
577
|
* Inject a `<link rel="preconnect">` tag for the given URL's origin.
|
|
1124
578
|
*
|
|
@@ -1133,6 +587,52 @@ declare class OneAuthClient {
|
|
|
1133
587
|
* @param url - Any URL whose origin should be preconnected to.
|
|
1134
588
|
*/
|
|
1135
589
|
private injectPreconnect;
|
|
590
|
+
/**
|
|
591
|
+
* Warm the dialog ahead of the first user interaction.
|
|
592
|
+
*
|
|
593
|
+
* `preconnect` (run in the constructor) only warms DNS/TLS. This goes
|
|
594
|
+
* further: it loads the dialog into a hidden, off-screen iframe so the
|
|
595
|
+
* browser downloads and parses the dialog HTML + JS bundle and the font, and
|
|
596
|
+
* keeps the cross-origin connection alive. When the user later opens a real
|
|
597
|
+
* auth/sign dialog, the fresh iframe serves those bytes from cache over the
|
|
598
|
+
* warm connection and paints far sooner — so the SDK preload overlay is shown
|
|
599
|
+
* only briefly (or imperceptibly) instead of covering a full cold load.
|
|
600
|
+
*
|
|
601
|
+
* It loads a dedicated `/dialog/warm` route, NOT a real flow route. That
|
|
602
|
+
* matters for two reasons:
|
|
603
|
+
* - **No side effects.** The real `/dialog/auth` route runs the signup
|
|
604
|
+
* flow on mount (identity probe → `POST /api/auth/register?step=start`),
|
|
605
|
+
* which writes an `AuthChallenge` row and counts against the register
|
|
606
|
+
* rate limiter. Warming must never create backend auth state for a user
|
|
607
|
+
* who hasn't acted, so the warm route renders nothing and runs no flow.
|
|
608
|
+
* - **No message cross-talk.** The warm route posts no `PASSKEY_READY` /
|
|
609
|
+
* `PASSKEY_RENDERED`, so a slow warm can never satisfy a visible modal's
|
|
610
|
+
* readiness listener and drive it to `PASSKEY_INIT` at the wrong moment.
|
|
611
|
+
* The warm route still pulls the shared Next.js framework + main + dialog
|
|
612
|
+
* layout chunks (the bulk of every flow's bundle), so the real open is fast.
|
|
613
|
+
*
|
|
614
|
+
* Best called on a *likely-intent* signal — `pointerenter`/`focus` of your
|
|
615
|
+
* "Sign in" / "Pay" button — rather than on page load, so visitors who never
|
|
616
|
+
* authenticate don't pay for a cross-origin iframe. Pass `prewarm: true` in
|
|
617
|
+
* the client config to have the SDK schedule this once on an idle callback.
|
|
618
|
+
*
|
|
619
|
+
* Idempotent: repeated calls return the same in-flight/settled promise.
|
|
620
|
+
* Resolves `true` once the hidden iframe's document has loaded, `false` on
|
|
621
|
+
* timeout or failure. Never throws and never blocks a real dialog open — a
|
|
622
|
+
* failed prewarm just means the next open does a normal (cold) load.
|
|
623
|
+
*
|
|
624
|
+
* @returns Whether the dialog became warm.
|
|
625
|
+
*/
|
|
626
|
+
prewarm(): Promise<boolean>;
|
|
627
|
+
/**
|
|
628
|
+
* Tear down the hidden prewarm iframe created by {@link prewarm}.
|
|
629
|
+
*
|
|
630
|
+
* The HTTP cache that prewarm populated survives teardown, so a subsequent
|
|
631
|
+
* open is still bundle-warm; this only releases the parked frame (and its
|
|
632
|
+
* keep-alive connection). Call it when auth is no longer likely on the
|
|
633
|
+
* current view. Safe to call when nothing is warmed.
|
|
634
|
+
*/
|
|
635
|
+
destroyPrewarm(): void;
|
|
1136
636
|
/**
|
|
1137
637
|
* Wait for the dialog iframe to signal ready, but defer sending `PASSKEY_INIT`
|
|
1138
638
|
* until the caller decides the time is right.
|
|
@@ -1171,7 +671,7 @@ declare class OneAuthClient {
|
|
|
1171
671
|
* @param requestBody - Serialized intent options (bigint amounts converted to
|
|
1172
672
|
* strings before this call).
|
|
1173
673
|
* @returns On success: `{ success: true, data: PrepareIntentResponse, tier }`.
|
|
1174
|
-
* On failure: `{ success: false, error: { code, message } }`.
|
|
674
|
+
* On failure: `{ success: false, error: { code, message, details? } }`.
|
|
1175
675
|
*/
|
|
1176
676
|
private prepareIntent;
|
|
1177
677
|
/**
|
|
@@ -1232,39 +732,37 @@ declare class OneAuthClient {
|
|
|
1232
732
|
*/
|
|
1233
733
|
getIntentHistory(options?: IntentHistoryOptions): Promise<IntentHistoryResult>;
|
|
1234
734
|
/**
|
|
1235
|
-
*
|
|
1236
|
-
*
|
|
1237
|
-
*
|
|
1238
|
-
*
|
|
1239
|
-
*
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
*
|
|
1259
|
-
*
|
|
1260
|
-
*
|
|
1261
|
-
*
|
|
1262
|
-
* toToken: 'USDC',
|
|
1263
|
-
* amount: '50', // Receive 50 USDC
|
|
1264
|
-
* });
|
|
1265
|
-
* ```
|
|
735
|
+
* Forward a raw EIP-1193 request to the iframe so the active EOA connector
|
|
736
|
+
* can handle it (wallet-connect session or injected wallet). Opens
|
|
737
|
+
* `/dialog/sign-eoa`, which looks up the wagmi connector and delegates to
|
|
738
|
+
* `connector.getProvider().request({ method, params })`. The wallet's own
|
|
739
|
+
* UI is the review screen; the dialog just transports the request.
|
|
740
|
+
*/
|
|
741
|
+
requestWithWallet(options: {
|
|
742
|
+
method: string;
|
|
743
|
+
params?: unknown[] | Record<string, unknown>;
|
|
744
|
+
expectedAddress?: `0x${string}`;
|
|
745
|
+
theme?: ThemeConfig;
|
|
746
|
+
}): Promise<{
|
|
747
|
+
success: true;
|
|
748
|
+
result: unknown;
|
|
749
|
+
} | {
|
|
750
|
+
success: false;
|
|
751
|
+
error: {
|
|
752
|
+
code: string;
|
|
753
|
+
message: string;
|
|
754
|
+
};
|
|
755
|
+
}>;
|
|
756
|
+
private doRequestWithWallet;
|
|
757
|
+
/**
|
|
758
|
+
* Lazily create the persistent `/dialog/sign-eoa` iframe and reveal it.
|
|
759
|
+
* Subsequent calls just re-open the existing `<dialog>` so the iframe's
|
|
760
|
+
* in-page state (notably the WalletConnect SignClient) is preserved
|
|
761
|
+
* between transactions.
|
|
1266
762
|
*/
|
|
1267
|
-
|
|
763
|
+
private ensureEoaDialog;
|
|
764
|
+
private waitForEoaIframeReady;
|
|
765
|
+
private waitForEoaResponse;
|
|
1268
766
|
/**
|
|
1269
767
|
* Sign an arbitrary message with the user's passkey
|
|
1270
768
|
*
|
|
@@ -1354,6 +852,22 @@ declare class OneAuthClient {
|
|
|
1354
852
|
* @returns The created `<iframe>` element (already appended to the container).
|
|
1355
853
|
*/
|
|
1356
854
|
private createEmbed;
|
|
855
|
+
/**
|
|
856
|
+
* Post `PASSKEY_VIEWPORT_INFO` with the parent's
|
|
857
|
+
* `window.innerHeight` to the iframe whenever it signals
|
|
858
|
+
* `PASSKEY_READY`, and re-post on `window.resize` (rAF-debounced)
|
|
859
|
+
* so the dialog's internal max-height cap follows the user's
|
|
860
|
+
* actual screen.
|
|
861
|
+
*
|
|
862
|
+
* Inside the iframe, `vh`/`dvh` units refer to the iframe's own
|
|
863
|
+
* height (recursive when the iframe auto-sizes), so the parent is
|
|
864
|
+
* the only reliable source of "what 75% of the user's screen is".
|
|
865
|
+
* The dialog stores the value in `dialog-context` and falls back
|
|
866
|
+
* to auto-grow when the value is absent — so it's safe to call
|
|
867
|
+
* this even for embedders that don't actually cap (modal mode
|
|
868
|
+
* uses `fullViewport` which has its own outer cap).
|
|
869
|
+
*/
|
|
870
|
+
private wireViewportInfo;
|
|
1357
871
|
/**
|
|
1358
872
|
* Listen for a signing result from an embedded (inline) signing iframe.
|
|
1359
873
|
*
|
|
@@ -1427,17 +941,17 @@ declare class OneAuthClient {
|
|
|
1427
941
|
/**
|
|
1428
942
|
* Create and open a full-viewport `<dialog>` containing a passkey iframe.
|
|
1429
943
|
*
|
|
1430
|
-
* The SDK owns
|
|
1431
|
-
*
|
|
1432
|
-
*
|
|
1433
|
-
*
|
|
944
|
+
* The SDK owns the browser `<dialog>` plus a minimal generic preload shell
|
|
945
|
+
* that appears immediately on click. The passkey iframe owns all branded and
|
|
946
|
+
* origin-specific UI (TitleBar, trust icon, action cards); the shell is
|
|
947
|
+
* removed as soon as the iframe reports that its centered card has painted.
|
|
1434
948
|
*
|
|
1435
949
|
* Lifecycle:
|
|
1436
|
-
* 1. A themed
|
|
1437
|
-
* iframe loads
|
|
1438
|
-
*
|
|
1439
|
-
* 2. When the iframe sends `PASSKEY_RENDERED`, the overlay
|
|
1440
|
-
* the iframe becomes fully visible.
|
|
950
|
+
* 1. A themed generic preload shell is injected and shown immediately
|
|
951
|
+
* while the iframe loads. It intentionally contains no TitleBar or
|
|
952
|
+
* origin chrome so that UI has a single implementation in apps/passkey.
|
|
953
|
+
* 2. When the iframe sends `PASSKEY_RENDERED`, the overlay is removed and
|
|
954
|
+
* the iframe becomes fully visible in the same frame.
|
|
1441
955
|
* 3. The returned `cleanup` function tears down all event listeners,
|
|
1442
956
|
* disconnects the MutationObserver, closes the `<dialog>`, and removes
|
|
1443
957
|
* it from the DOM. It is idempotent — safe to call multiple times.
|
|
@@ -1449,6 +963,8 @@ declare class OneAuthClient {
|
|
|
1449
963
|
* restores those as well.
|
|
1450
964
|
* - The iframe sandbox includes `allow-popups-to-escape-sandbox` so that
|
|
1451
965
|
* 1Password's popup UI can render outside the sandboxed context.
|
|
966
|
+
* - `allow-downloads` lets the passkey iframe trigger the recovery-key
|
|
967
|
+
* JSON fallback download without sending sensitive data to the parent.
|
|
1452
968
|
*
|
|
1453
969
|
* @param url - The full URL (including query params) to load in the iframe.
|
|
1454
970
|
* @returns References to the dialog, iframe, and a cleanup function.
|
|
@@ -1457,9 +973,15 @@ declare class OneAuthClient {
|
|
|
1457
973
|
/**
|
|
1458
974
|
* Listen for the auth result from the modal dialog.
|
|
1459
975
|
*
|
|
1460
|
-
*
|
|
1461
|
-
*
|
|
1462
|
-
*
|
|
976
|
+
* Each modal call generates a per-session nonce that the iframe must
|
|
977
|
+
* echo back in `PASSKEY_CLOSE` / `PASSKEY_LOGIN_RESULT` /
|
|
978
|
+
* `PASSKEY_RETRY_POPUP` messages. Without an echo, a queued CLOSE
|
|
979
|
+
* from the previous iframe could be dispatched to the new modal's
|
|
980
|
+
* listener (postMessage events tagged with `event.source` from a now-
|
|
981
|
+
* destroyed iframe still reach the parent's message handler) and
|
|
982
|
+
* silently cancel the fresh auth attempt. The nonce makes that race
|
|
983
|
+
* harmless: a stale message that doesn't carry the current modal's
|
|
984
|
+
* nonce is ignored.
|
|
1463
985
|
*
|
|
1464
986
|
* Also handles the `PASSKEY_RETRY_POPUP` message: sent by the dialog when a
|
|
1465
987
|
* password manager (e.g. Bitwarden) intercepts the WebAuthn call inside the
|
|
@@ -1478,21 +1000,6 @@ declare class OneAuthClient {
|
|
|
1478
1000
|
* Used when iframe mode fails (e.g., due to password manager interference).
|
|
1479
1001
|
*/
|
|
1480
1002
|
private waitForPopupAuthResponse;
|
|
1481
|
-
/**
|
|
1482
|
-
* Listen for the authenticate result from the modal dialog.
|
|
1483
|
-
*
|
|
1484
|
-
* The authenticate flow combines sign-in/sign-up with optional off-chain
|
|
1485
|
-
* challenge signing. The dialog sends `PASSKEY_AUTHENTICATE_RESULT` on
|
|
1486
|
-
* completion with both user details and, if a challenge was requested, the
|
|
1487
|
-
* WebAuthn signature and the hashed challenge value for server-side
|
|
1488
|
-
* verification.
|
|
1489
|
-
*
|
|
1490
|
-
* @param _dialog - Unused; kept for signature consistency.
|
|
1491
|
-
* @param _iframe - Unused; kept for signature consistency.
|
|
1492
|
-
* @param cleanup - Idempotent teardown for the modal dialog.
|
|
1493
|
-
* @returns An `AuthenticateResult` discriminated union.
|
|
1494
|
-
*/
|
|
1495
|
-
private waitForAuthenticateResponse;
|
|
1496
1003
|
/**
|
|
1497
1004
|
* Listen for the connect result from the connect dialog.
|
|
1498
1005
|
*
|
|
@@ -1511,23 +1018,19 @@ declare class OneAuthClient {
|
|
|
1511
1018
|
*/
|
|
1512
1019
|
private waitForConnectResponse;
|
|
1513
1020
|
/**
|
|
1514
|
-
* Listen for
|
|
1515
|
-
*
|
|
1516
|
-
* The consent dialog shows the user which data fields an app is requesting
|
|
1517
|
-
* access to and lets them approve or deny. On approval, `data` contains the
|
|
1518
|
-
* consented field values (e.g. email address, device names) and `grantedAt`
|
|
1519
|
-
* records when consent was given.
|
|
1021
|
+
* Listen for grant-permission results and bridge sponsorship token requests.
|
|
1520
1022
|
*
|
|
1521
|
-
*
|
|
1522
|
-
*
|
|
1523
|
-
*
|
|
1023
|
+
* The grant iframe owns the passkey ceremony and install intent submission.
|
|
1024
|
+
* Extension-token minting stays in the app origin, so the SDK exposes a
|
|
1025
|
+
* narrow postMessage round-trip that never gives the iframe app secrets.
|
|
1524
1026
|
*
|
|
1525
1027
|
* @param _dialog - Unused; kept for signature consistency.
|
|
1526
|
-
* @param
|
|
1028
|
+
* @param iframe - The grant iframe that receives extension-token responses.
|
|
1527
1029
|
* @param cleanup - Idempotent teardown for the modal dialog.
|
|
1528
|
-
* @
|
|
1030
|
+
* @param sponsor - Whether this grant flow should request an extension token.
|
|
1031
|
+
* @returns A `GrantPermissionsResult` discriminated union.
|
|
1529
1032
|
*/
|
|
1530
|
-
private
|
|
1033
|
+
private waitForGrantPermissionResponse;
|
|
1531
1034
|
/**
|
|
1532
1035
|
* Listen for a signing result from a server-request-based modal dialog.
|
|
1533
1036
|
*
|
|
@@ -1573,4 +1076,4 @@ declare class OneAuthClient {
|
|
|
1573
1076
|
private fetchSigningResult;
|
|
1574
1077
|
}
|
|
1575
1078
|
|
|
1576
|
-
export {
|
|
1079
|
+
export { OneAuthClient as O };
|