@rhinestone/1auth 0.6.8 → 0.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +171 -12
  2. package/dist/chunk-IHBVEU33.mjs +20 -0
  3. package/dist/chunk-IHBVEU33.mjs.map +1 -0
  4. package/dist/chunk-IIACVHR3.mjs +28 -0
  5. package/dist/chunk-IIACVHR3.mjs.map +1 -0
  6. package/dist/chunk-N6KE5CII.mjs +72 -0
  7. package/dist/chunk-N6KE5CII.mjs.map +1 -0
  8. package/dist/{chunk-SXISYG2P.mjs → chunk-VZYHCFEH.mjs} +195 -140
  9. package/dist/chunk-VZYHCFEH.mjs.map +1 -0
  10. package/dist/{client-BrMrhetG.d.mts → client-BNluVe4_.d.ts} +305 -849
  11. package/dist/{client-BrMrhetG.d.ts → client-CLCdahyj.d.mts} +305 -849
  12. package/dist/headless.d.mts +90 -0
  13. package/dist/headless.d.ts +90 -0
  14. package/dist/headless.js +327 -0
  15. package/dist/headless.js.map +1 -0
  16. package/dist/headless.mjs +280 -0
  17. package/dist/headless.mjs.map +1 -0
  18. package/dist/index.d.mts +96 -144
  19. package/dist/index.d.ts +96 -144
  20. package/dist/index.js +2984 -718
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +2740 -627
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/{provider-CDl9wYEc.d.mts → provider-BgD9PeDX.d.ts} +6 -5
  25. package/dist/{provider-Dgv533YQ.d.ts → provider-hxHGb6SX.d.mts} +6 -5
  26. package/dist/react.d.mts +42 -2
  27. package/dist/react.d.ts +42 -2
  28. package/dist/react.js +92 -2
  29. package/dist/react.js.map +1 -1
  30. package/dist/react.mjs +66 -1
  31. package/dist/react.mjs.map +1 -1
  32. package/dist/server.d.mts +118 -0
  33. package/dist/server.d.ts +118 -0
  34. package/dist/server.js +356 -0
  35. package/dist/server.js.map +1 -0
  36. package/dist/server.mjs +282 -0
  37. package/dist/server.mjs.map +1 -0
  38. package/dist/types-1BMD1PSH.d.mts +1425 -0
  39. package/dist/types-1BMD1PSH.d.ts +1425 -0
  40. package/dist/verify-CZe-m_Vf.d.ts +150 -0
  41. package/dist/verify-D3FaLeAi.d.mts +150 -0
  42. package/dist/wagmi.d.mts +5 -2
  43. package/dist/wagmi.d.ts +5 -2
  44. package/dist/wagmi.js +138 -43
  45. package/dist/wagmi.js.map +1 -1
  46. package/dist/wagmi.mjs +2 -1
  47. package/dist/wagmi.mjs.map +1 -1
  48. package/package.json +15 -2
  49. package/dist/chunk-SXISYG2P.mjs.map +0 -1
@@ -1,756 +1,11 @@
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-1BMD1PSH.js';
750
2
 
751
3
  declare class OneAuthClient {
752
4
  private config;
753
5
  private theme;
6
+ private sponsorship;
7
+ private eoaDialogState;
8
+ private eoaSerialQueue;
754
9
  /**
755
10
  * Create a new OneAuthClient.
756
11
  *
@@ -763,6 +18,73 @@ declare class OneAuthClient {
763
18
  * clientId, theme, and redirect settings.
764
19
  */
765
20
  constructor(config: PasskeyProviderConfig);
21
+ /**
22
+ * Update the sponsorship configuration at runtime. Pass `undefined` to
23
+ * disable sponsorship.
24
+ */
25
+ setSponsorship(sponsorship: SponsorshipConfig | undefined): void;
26
+ /**
27
+ * Whether the caller opted into SDK telemetry propagation or callbacks.
28
+ */
29
+ private shouldUseTelemetry;
30
+ /**
31
+ * Resolve the host app's current trace context. Callback failures are
32
+ * ignored because observability can never be allowed to break signing.
33
+ */
34
+ private getTelemetryTraceContext;
35
+ /**
36
+ * Resolve host-provided SDK event attributes and remove undefined fields.
37
+ */
38
+ private getTelemetryAttributes;
39
+ /**
40
+ * Create per-operation telemetry context shared by callbacks, HTTP headers,
41
+ * dialog URL params, and PASSKEY_INIT messages.
42
+ */
43
+ private createTelemetryOperation;
44
+ /**
45
+ * Emit a telemetry event to the host app. The callback is intentionally
46
+ * fire-and-forget and exception-safe so app telemetry cannot affect users.
47
+ */
48
+ private emitTelemetry;
49
+ /**
50
+ * Attach SDK correlation and optional W3C trace context to dialog URLs.
51
+ */
52
+ private appendTelemetryParams;
53
+ /**
54
+ * Add SDK correlation headers to passkey API calls. These headers are also
55
+ * valid W3C trace propagation inputs when the host app supplies traceparent.
56
+ */
57
+ private telemetryHeaders;
58
+ /**
59
+ * Embed telemetry context in PASSKEY_INIT payloads for dialog-side API calls.
60
+ */
61
+ private telemetryPayload;
62
+ /**
63
+ * Determine whether this signing call should request invisible dialog mode.
64
+ * Resolution order: per-call option wins over the constructor config, which
65
+ * wins over the platform-wide {@link DEFAULT_BLIND_SIGNING}. This lets an app
66
+ * flip the global default for itself while still overriding individual
67
+ * high-risk calls — e.g. default-blind but force the review UI for a large
68
+ * transfer, or default-visible but blind-sign selected low-risk signatures.
69
+ */
70
+ private shouldRequestBlindSigning;
71
+ /**
72
+ * Fetch the app's access token (JWT). Called up front, before
73
+ * `/api/intent/prepare`, so the passkey server can authenticate the
74
+ * orchestrator quote call with the app's JWT instead of a service-level
75
+ * API key.
76
+ *
77
+ * Does not depend on `intentOp` — can run in parallel with anything that
78
+ * also doesn't depend on the quote.
79
+ */
80
+ private fetchAccessToken;
81
+ /**
82
+ * Fetch one extension token per intent, aligned with `sponsorFlags`.
83
+ * Returns an empty array when no intent is sponsored. Fired after
84
+ * `/prepare` so each token can be bound to its quote's `intentOp`, and
85
+ * overlaps the dialog / WebAuthn ceremony for no added serial latency.
86
+ */
87
+ private fetchExtensionTokens;
766
88
  /**
767
89
  * Update the theme configuration at runtime
768
90
  */
@@ -813,6 +135,23 @@ declare class OneAuthClient {
813
135
  * Get the configured client ID
814
136
  */
815
137
  getClientId(): string | undefined;
138
+ /**
139
+ * Whether this client operates on testnet chains only.
140
+ */
141
+ getTestnets(): boolean;
142
+ /**
143
+ * Get a unified token portfolio for a 1auth account across mainnets and
144
+ * testnets.
145
+ *
146
+ * @example
147
+ * ```typescript
148
+ * const assets = await client.getAssets({
149
+ * accountAddress: "0x1111111111111111111111111111111111111111",
150
+ * });
151
+ * console.log(assets.mainnets.balances, assets.testnets.balances);
152
+ * ```
153
+ */
154
+ getAssets(options: GetAssetsOptions): Promise<AssetsResponse>;
816
155
  /**
817
156
  * Poll the intent status endpoint until a transaction hash appears or the
818
157
  * intent reaches a terminal failure state.
@@ -842,6 +181,8 @@ declare class OneAuthClient {
842
181
  * @param options.username - Pre-fill the username field
843
182
  * @param options.theme - Override the theme for this modal invocation
844
183
  * @param options.oauthEnabled - Set to false to hide OAuth sign-in buttons
184
+ * @param options.flow - Force the login or account-creation route instead
185
+ * of the default auto-detect entry route
845
186
  * @returns {@link AuthResult} with user details and typed address
846
187
  *
847
188
  * @example
@@ -856,11 +197,52 @@ declare class OneAuthClient {
856
197
  * }
857
198
  * ```
858
199
  */
859
- authWithModal(options?: {
860
- username?: string;
861
- theme?: ThemeConfig;
862
- oauthEnabled?: boolean;
863
- }): Promise<AuthResult>;
200
+ authWithModal(options?: AuthWithModalOptions): Promise<AuthResult>;
201
+ /**
202
+ * Open the sign-in modal directly.
203
+ *
204
+ * This bypasses the `/dialog/auth` auto-router and targets the dedicated
205
+ * returning-user flow. Use it when the embedding app already knows the user
206
+ * is creating a login session, for example after an app-level "Log in"
207
+ * button. The result intentionally matches {@link authWithModal}.
208
+ *
209
+ * @param options.username - Optional account hint for the sign-in ceremony
210
+ * @param options.theme - Override the theme for this modal invocation
211
+ * @returns {@link AuthResult} with user details and typed address
212
+ */
213
+ loginWithModal(options?: LoginWithModalOptions): Promise<AuthResult>;
214
+ /**
215
+ * Open the account-creation modal directly.
216
+ *
217
+ * This bypasses the `/dialog/auth` auto-router and targets the dedicated
218
+ * sign-up flow. Account creation still happens server-side in the passkey
219
+ * service; the SDK only opens the dialog and receives the postMessage result.
220
+ *
221
+ * @param options.theme - Override the theme for this modal invocation
222
+ * @param options.oauthEnabled - Set to false to hide OAuth sign-in buttons
223
+ * @returns {@link AuthResult} with the newly authenticated account details
224
+ */
225
+ createAccountWithModal(options?: CreateAccountWithModalOptions): Promise<AuthResult>;
226
+ /**
227
+ * Open one of the passkey authentication modal routes and wait for the
228
+ * login-result message.
229
+ *
230
+ * Keeping URL construction in one helper prevents the explicit login/signup
231
+ * methods from drifting away from the legacy `authWithModal` behavior.
232
+ */
233
+ private openAuthModal;
234
+ /**
235
+ * Generate a per-dialog nonce used to correlate iframe close messages with
236
+ * the SDK modal that opened them. Chromium can report a different
237
+ * `MessageEvent.source` WindowProxy after the `/dialog/auth` redirect, so
238
+ * auth close handling needs a stable in-band identifier without accepting
239
+ * stale close messages from earlier dialogs.
240
+ */
241
+ private createDialogRequestId;
242
+ /**
243
+ * Resolve the passkey app route for a requested auth flow.
244
+ */
245
+ private getAuthDialogPath;
864
246
  /**
865
247
  * Open the connect dialog (lightweight connection without passkey auth).
866
248
  *
@@ -886,6 +268,42 @@ declare class OneAuthClient {
886
268
  connectWithModal(options?: {
887
269
  theme?: ThemeConfig;
888
270
  }): Promise<ConnectResult>;
271
+ /**
272
+ * High-level connect entry point — the method most integrators want.
273
+ *
274
+ * Tries the lightweight {@link connectWithModal} first (no passkey ceremony
275
+ * for returning users on the same browser), and transparently falls back to
276
+ * {@link authWithModal} when the connect dialog reports it has no stored
277
+ * credentials for this origin (`action: "switch"`). First-time visitors get
278
+ * one passkey ceremony to register; subsequent connects on the same browser
279
+ * resolve with no biometric prompt — and silently when the user has enabled
280
+ * "Connect automatically".
281
+ *
282
+ * The return shape is the same {@link ConnectResult} discriminated union as
283
+ * {@link connectWithModal}, so callers can treat both paths uniformly. When
284
+ * the auth-modal fallback runs, its successful result is normalized into a
285
+ * `ConnectResult` (no `id` field — the embedder origin must not see it).
286
+ *
287
+ * Cancellation: if the user cancels either dialog, the result is
288
+ * `{ success: false, action: "cancel", error: { code: "USER_CANCELLED", … } }`.
289
+ *
290
+ * @param options - Forwarded to whichever underlying modal is shown.
291
+ * `username` and `oauthEnabled` only apply to the auth-modal fallback path.
292
+ * @returns A {@link ConnectResult} discriminated union.
293
+ *
294
+ * @example
295
+ * ```typescript
296
+ * const result = await client.connect();
297
+ * if (result.success) {
298
+ * console.log("Connected as", result.user?.username ?? result.user?.address);
299
+ * }
300
+ * ```
301
+ */
302
+ connect(options?: {
303
+ username?: string;
304
+ theme?: ThemeConfig;
305
+ oauthEnabled?: boolean;
306
+ }): Promise<ConnectResult>;
889
307
  /**
890
308
  * Open the account management dialog.
891
309
  *
@@ -901,41 +319,58 @@ declare class OneAuthClient {
901
319
  openAccountDialog(options?: {
902
320
  theme?: ThemeConfig;
903
321
  }): Promise<void>;
322
+ /**
323
+ * Open the account-recovery backup flow directly.
324
+ *
325
+ * Deep-links into the "Backup your account" flow inside the account dialog
326
+ * (rather than the account overview): the user verifies with their passkey,
327
+ * then saves a recovery passphrase and downloads an encrypted backup file.
328
+ * Use this to prompt users to secure their account after sign-up.
329
+ *
330
+ * Requires an authenticated user (call `authWithModal()` / `connect()`
331
+ * first) — the dialog reads the signed-in user from the passkey origin.
332
+ *
333
+ * Resolves `{ completed: true }` when the user finishes the backup, or
334
+ * `{ completed: false }` if they dismiss it — so callers can mark an
335
+ * onboarding step done or re-prompt later.
336
+ */
337
+ setupRecovery(options?: {
338
+ theme?: ThemeConfig;
339
+ }): Promise<{
340
+ completed: boolean;
341
+ }>;
904
342
  /**
905
343
  * Check if a user has already granted consent for the requested fields.
906
- * This is a read-only check — no dialog is shown.
907
344
  *
908
- * @example
909
- * ```typescript
910
- * const result = await client.checkConsent({
911
- * username: "alice",
912
- * fields: ["email"],
913
- * });
914
- * if (result.hasConsent) {
915
- * console.log(result.data?.email);
916
- * }
917
- * ```
345
+ * @deprecated Data-sharing consent is disabled.
346
+ *
347
+ * Always returns `{ hasConsent: false }`.
918
348
  */
919
349
  checkConsent(options: CheckConsentOptions): Promise<CheckConsentResult>;
920
350
  /**
921
351
  * Request consent from the user to share their data.
922
352
  *
923
- * First checks if consent was already granted (returns cached data immediately).
924
- * If not, opens the consent dialog where the user can review and approve sharing.
353
+ * @deprecated Data-sharing consent is disabled.
925
354
  *
926
- * @example
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
- * ```
355
+ * Always returns an `INVALID_REQUEST` result.
937
356
  */
938
357
  requestConsent(options: RequestConsentOptions): Promise<RequestConsentResult>;
358
+ /**
359
+ * Open the dedicated SmartSession permission grant dialog.
360
+ *
361
+ * The app owns the session key material and sends only the public
362
+ * `sessionKeyAddress`. 1auth renders the permission review, collects the
363
+ * owner's passkey authorization, submits the install/enable intent, and
364
+ * returns a persistable session handle.
365
+ */
366
+ grantPermissions(options: GrantPermissionsOptions): Promise<GrantPermissionsResult>;
367
+ /**
368
+ * List SmartSession grants previously granted to the current browser origin.
369
+ *
370
+ * 1auth derives the app identity from the request Origin header. The SDK does
371
+ * not send `clientId` for this lookup because grants are origin-scoped.
372
+ */
373
+ listSessionGrants(options: ListSessionGrantsOptions): Promise<ListSessionGrantsResult>;
939
374
  /**
940
375
  * Authenticate a user with an optional challenge to sign.
941
376
  *
@@ -943,13 +378,13 @@ declare class OneAuthClient {
943
378
  * challenge signing, enabling off-chain login without on-chain transactions.
944
379
  *
945
380
  * When a challenge is provided:
946
- * 1. User authenticates (sign in or sign up)
947
- * 2. The challenge is hashed with a domain separator
948
- * 3. User signs the hash with their passkey
949
- * 4. Returns user info + signature for server-side verification
381
+ * 1. User authenticates (sign in or sign up) through the normal auth dialog
382
+ * 2. User signs the challenge through the normal signing dialog
383
+ * 3. Returns user info + signature for server-side verification
950
384
  *
951
- * The domain separator ("\x19Passkey Signed Message:\n") ensures the signature
952
- * cannot be reused for transaction signing, preventing phishing attacks.
385
+ * This composes the same supported provider routes as calling
386
+ * `authWithModal()` followed by `signMessage()`, so challenge auth cannot
387
+ * drift onto a provider route that the passkey service does not expose.
953
388
  *
954
389
  * @example
955
390
  * ```typescript
@@ -1119,6 +554,24 @@ declare class OneAuthClient {
1119
554
  * @param cleanup - Idempotent teardown that closes and removes the dialog.
1120
555
  */
1121
556
  private waitForDialogClose;
557
+ /**
558
+ * Hidden blind-signing iframes have no user-visible Done or Close button.
559
+ * Once the SDK has the result it needs, tear them down immediately instead
560
+ * of waiting for an iframe close event that can never be clicked.
561
+ */
562
+ private waitForDialogCloseUnlessBlind;
563
+ /**
564
+ * After a prepare error has been surfaced in the dialog, wait for the user
565
+ * to either close the dialog (give up) or click "Try Again", which the
566
+ * dialog forwards as `PASSKEY_RETRY_PREPARE`.
567
+ *
568
+ * On `"closed"` the dialog has been cleaned up; on `"retry"` it stays open
569
+ * (showing its loading skeleton) while the caller re-runs prepare. Without
570
+ * this, "Try Again" after a prepare failure was a dead end: the dialog
571
+ * reset its local state but the SDK had already given up, so the quote
572
+ * never arrived and the Sign button stayed disabled forever.
573
+ */
574
+ private waitForPrepareRetryOrClose;
1122
575
  /**
1123
576
  * Inject a `<link rel="preconnect">` tag for the given URL's origin.
1124
577
  *
@@ -1171,7 +624,7 @@ declare class OneAuthClient {
1171
624
  * @param requestBody - Serialized intent options (bigint amounts converted to
1172
625
  * strings before this call).
1173
626
  * @returns On success: `{ success: true, data: PrepareIntentResponse, tier }`.
1174
- * On failure: `{ success: false, error: { code, message } }`.
627
+ * On failure: `{ success: false, error: { code, message, details? } }`.
1175
628
  */
1176
629
  private prepareIntent;
1177
630
  /**
@@ -1232,39 +685,37 @@ declare class OneAuthClient {
1232
685
  */
1233
686
  getIntentHistory(options?: IntentHistoryOptions): Promise<IntentHistoryResult>;
1234
687
  /**
1235
- * Send a swap intent through the Rhinestone orchestrator
1236
- *
1237
- * This is a high-level abstraction for token swaps (including cross-chain):
1238
- * 1. Resolves token symbols to addresses
1239
- * 2. Builds the swap intent with tokenRequests (output-first model)
1240
- * 3. The orchestrator's solver network finds the best route
1241
- * 4. Executes via the standard intent flow
1242
- *
1243
- * NOTE: The `amount` parameter specifies the OUTPUT amount (what the user wants to receive),
1244
- * not the input amount. The orchestrator will calculate the required input from sourceAssets.
1245
- *
1246
- * @example
1247
- * ```typescript
1248
- * // Buy 100 USDC using ETH on Base
1249
- * const result = await client.sendSwap({
1250
- * username: 'alice',
1251
- * targetChain: 8453,
1252
- * fromToken: 'ETH',
1253
- * toToken: 'USDC',
1254
- * amount: '100', // Receive 100 USDC
1255
- * });
1256
- *
1257
- * // Cross-chain: Buy 50 USDC on Base, paying with ETH from any chain
1258
- * const result = await client.sendSwap({
1259
- * username: 'alice',
1260
- * targetChain: 8453, // Base
1261
- * fromToken: 'ETH',
1262
- * toToken: 'USDC',
1263
- * amount: '50', // Receive 50 USDC
1264
- * });
1265
- * ```
688
+ * Forward a raw EIP-1193 request to the iframe so the active EOA connector
689
+ * can handle it (wallet-connect session or injected wallet). Opens
690
+ * `/dialog/sign-eoa`, which looks up the wagmi connector and delegates to
691
+ * `connector.getProvider().request({ method, params })`. The wallet's own
692
+ * UI is the review screen; the dialog just transports the request.
693
+ */
694
+ requestWithWallet(options: {
695
+ method: string;
696
+ params?: unknown[] | Record<string, unknown>;
697
+ expectedAddress?: `0x${string}`;
698
+ theme?: ThemeConfig;
699
+ }): Promise<{
700
+ success: true;
701
+ result: unknown;
702
+ } | {
703
+ success: false;
704
+ error: {
705
+ code: string;
706
+ message: string;
707
+ };
708
+ }>;
709
+ private doRequestWithWallet;
710
+ /**
711
+ * Lazily create the persistent `/dialog/sign-eoa` iframe and reveal it.
712
+ * Subsequent calls just re-open the existing `<dialog>` so the iframe's
713
+ * in-page state (notably the WalletConnect SignClient) is preserved
714
+ * between transactions.
1266
715
  */
1267
- sendSwap(options: SendSwapOptions): Promise<SendSwapResult>;
716
+ private ensureEoaDialog;
717
+ private waitForEoaIframeReady;
718
+ private waitForEoaResponse;
1268
719
  /**
1269
720
  * Sign an arbitrary message with the user's passkey
1270
721
  *
@@ -1354,6 +805,22 @@ declare class OneAuthClient {
1354
805
  * @returns The created `<iframe>` element (already appended to the container).
1355
806
  */
1356
807
  private createEmbed;
808
+ /**
809
+ * Post `PASSKEY_VIEWPORT_INFO` with the parent's
810
+ * `window.innerHeight` to the iframe whenever it signals
811
+ * `PASSKEY_READY`, and re-post on `window.resize` (rAF-debounced)
812
+ * so the dialog's internal max-height cap follows the user's
813
+ * actual screen.
814
+ *
815
+ * Inside the iframe, `vh`/`dvh` units refer to the iframe's own
816
+ * height (recursive when the iframe auto-sizes), so the parent is
817
+ * the only reliable source of "what 75% of the user's screen is".
818
+ * The dialog stores the value in `dialog-context` and falls back
819
+ * to auto-grow when the value is absent — so it's safe to call
820
+ * this even for embedders that don't actually cap (modal mode
821
+ * uses `fullViewport` which has its own outer cap).
822
+ */
823
+ private wireViewportInfo;
1357
824
  /**
1358
825
  * Listen for a signing result from an embedded (inline) signing iframe.
1359
826
  *
@@ -1427,7 +894,7 @@ declare class OneAuthClient {
1427
894
  /**
1428
895
  * Create and open a full-viewport `<dialog>` containing a passkey iframe.
1429
896
  *
1430
- * The SDK owns only the transparent outer shell; all visible UI (backdrop,
897
+ * The SDK owns only the hidden outer shell; all visible UI (backdrop,
1431
898
  * card, animations, close button) is rendered by the passkey app inside the
1432
899
  * iframe. This approach means design changes can be shipped server-side
1433
900
  * without updating SDK consumers.
@@ -1449,6 +916,8 @@ declare class OneAuthClient {
1449
916
  * restores those as well.
1450
917
  * - The iframe sandbox includes `allow-popups-to-escape-sandbox` so that
1451
918
  * 1Password's popup UI can render outside the sandboxed context.
919
+ * - `allow-downloads` lets the passkey iframe trigger the recovery-key
920
+ * JSON fallback download without sending sensitive data to the parent.
1452
921
  *
1453
922
  * @param url - The full URL (including query params) to load in the iframe.
1454
923
  * @returns References to the dialog, iframe, and a cleanup function.
@@ -1457,9 +926,15 @@ declare class OneAuthClient {
1457
926
  /**
1458
927
  * Listen for the auth result from the modal dialog.
1459
928
  *
1460
- * Waits for `PASSKEY_READY` before processing any other messages to avoid
1461
- * acting on stale `PASSKEY_CLOSE` events that may still be in the event queue
1462
- * from a previously closed dialog.
929
+ * Each modal call generates a per-session nonce that the iframe must
930
+ * echo back in `PASSKEY_CLOSE` / `PASSKEY_LOGIN_RESULT` /
931
+ * `PASSKEY_RETRY_POPUP` messages. Without an echo, a queued CLOSE
932
+ * from the previous iframe could be dispatched to the new modal's
933
+ * listener (postMessage events tagged with `event.source` from a now-
934
+ * destroyed iframe still reach the parent's message handler) and
935
+ * silently cancel the fresh auth attempt. The nonce makes that race
936
+ * harmless: a stale message that doesn't carry the current modal's
937
+ * nonce is ignored.
1463
938
  *
1464
939
  * Also handles the `PASSKEY_RETRY_POPUP` message: sent by the dialog when a
1465
940
  * password manager (e.g. Bitwarden) intercepts the WebAuthn call inside the
@@ -1478,21 +953,6 @@ declare class OneAuthClient {
1478
953
  * Used when iframe mode fails (e.g., due to password manager interference).
1479
954
  */
1480
955
  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
956
  /**
1497
957
  * Listen for the connect result from the connect dialog.
1498
958
  *
@@ -1511,23 +971,19 @@ declare class OneAuthClient {
1511
971
  */
1512
972
  private waitForConnectResponse;
1513
973
  /**
1514
- * Listen for the consent result from the consent dialog.
974
+ * Listen for grant-permission results and bridge sponsorship token requests.
1515
975
  *
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.
1520
- *
1521
- * A `PASSKEY_CLOSE` without a prior `PASSKEY_CONSENT_RESULT` is treated as an
1522
- * explicit user cancellation (distinct from denial, though both yield
1523
- * `success: false`).
976
+ * The grant iframe owns the passkey ceremony and install intent submission.
977
+ * Extension-token minting stays in the app origin, so the SDK exposes a
978
+ * narrow postMessage round-trip that never gives the iframe app secrets.
1524
979
  *
1525
980
  * @param _dialog - Unused; kept for signature consistency.
1526
- * @param _iframe - Unused; kept for signature consistency.
981
+ * @param iframe - The grant iframe that receives extension-token responses.
1527
982
  * @param cleanup - Idempotent teardown for the modal dialog.
1528
- * @returns A `RequestConsentResult` discriminated union.
983
+ * @param sponsor - Whether this grant flow should request an extension token.
984
+ * @returns A `GrantPermissionsResult` discriminated union.
1529
985
  */
1530
- private waitForConsentResponse;
986
+ private waitForGrantPermissionResponse;
1531
987
  /**
1532
988
  * Listen for a signing result from a server-request-based modal dialog.
1533
989
  *
@@ -1573,4 +1029,4 @@ declare class OneAuthClient {
1573
1029
  private fetchSigningResult;
1574
1030
  }
1575
1031
 
1576
- export { type SendBatchIntentOptions as $, type AuthResult as A, type BalanceRequirement as B, type CreateSigningRequestResponse as C, type PrepareIntentResponse as D, type EmbedOptions as E, type ExecuteIntentResponse as F, type IntentHistoryOptions as G, type IntentHistoryItem as H, type IntentCall as I, type IntentHistoryResult as J, type SendSwapOptions as K, type SendSwapResult as L, type SwapQuote as M, type ThemeConfig as N, OneAuthClient as O, type PasskeyProviderConfig as P, type ConsentField as Q, type ConsentData as R, type SendIntentResult as S, type TransactionAction as T, type UserPasskeysResponse as U, type CheckConsentOptions as V, type WebAuthnSignature as W, type CheckConsentResult as X, type RequestConsentOptions as Y, type RequestConsentResult as Z, type BatchIntentItem as _, type SigningRequestOptions as a, type SendBatchIntentResult as a0, type BatchIntentItemResult as a1, type PreparedBatchIntent as a2, type PrepareBatchIntentResponse as a3, type SigningResult as b, type SigningSuccess as c, type SigningError as d, type SigningErrorCode as e, type SigningRequestStatus as f, type PasskeyCredential as g, type ConnectResult as h, type AuthenticateOptions as i, type AuthenticateResult as j, type SigningResultBase as k, type SignMessageOptions as l, type SignMessageResult as m, type SignTypedDataOptions as n, type SignTypedDataResult as o, type EIP712Domain as p, type EIP712Types as q, type EIP712TypeField as r, type TransactionFees as s, type TransactionDetails as t, type IntentTokenRequest as u, type SendIntentOptions as v, type IntentQuote as w, type IntentStatus as x, type OrchestratorStatus as y, type CloseOnStatus as z };
1032
+ export { OneAuthClient as O };