@rhinestone/1auth 0.7.1 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { O as OneAuthClient } from './client-B_CzDa_I.js';
2
- import { Abi, Address, LocalAccount, WalletClient, Hash, Chain } from 'viem';
1
+ import { O as OneAuthClient } from './client-CuASptX3.js';
2
+ import { Abi, Address, LocalAccount, WalletClient, Hash } from 'viem';
3
3
  import { Permission } from '@rhinestone/sdk';
4
4
  export { Permission } from '@rhinestone/sdk';
5
- import { h as IntentCall, i as SendIntentResult } from './types-U_dwxbtS.js';
6
- export { a7 as AssetBalance, a8 as AssetBalanceBucket, a9 as AssetsResponse, u as AuthFlow, A as AuthResult, v as AuthWithModalOptions, z as AuthenticateOptions, B as AuthenticateResult, R as BalanceRequirement, ap as BatchIntentItem, as as BatchIntentItemResult, ad as CheckConsentOptions, ae as CheckConsentResult, a0 as CloseOnStatus, y as ConnectResult, ac as ConsentData, ab as ConsentField, w as CreateAccountWithModalOptions, C as CreateCrossChainPermissionInput, r as CreateSigningRequestResponse, k as CrossChainPermit, l as CrossChainSettlementLayer, M as EIP712Domain, O as EIP712TypeField, N as EIP712Types, E as EmbedOptions, a2 as ExecuteIntentResponse, a6 as GetAssetsOptions, an as GrantPermissionContractMetadata, ah as GrantPermissionsOptions, ai as GrantPermissionsResult, a4 as IntentHistoryItem, a3 as IntentHistoryOptions, a5 as IntentHistoryResult, Z as IntentQuote, _ as IntentStatus, X as IntentTokenRequest, aj as ListSessionGrantsOptions, ak as ListSessionGrantsResult, L as LoginWithModalOptions, ax as OneAuthTelemetryAttributeValue, ay as OneAuthTelemetryAttributes, az as OneAuthTelemetryConfig, aA as OneAuthTelemetryEvent, aB as OneAuthTelemetryEventName, aC as OneAuthTelemetryFlow, aD as OneAuthTelemetryTraceContext, $ as OrchestratorStatus, t as PasskeyCredential, P as PasskeyProviderConfig, au as PrepareBatchIntentResponse, a1 as PrepareIntentResponse, at as PreparedBatchIntent, af as RequestConsentOptions, ag as RequestConsentResult, aq as SendBatchIntentOptions, ar as SendBatchIntentResult, Y as SendIntentOptions, am as SessionGrantChain, al as SessionGrantRecord, F as SignMessageOptions, G as SignMessageResult, J as SignTypedDataOptions, K as SignTypedDataResult, x as SignerType, p as SigningError, q as SigningErrorCode, m as SigningRequestOptions, s as SigningRequestStatus, n as SigningResult, D as SigningResultBase, o as SigningSuccess, ao as SmartSessionPolicy, av as SponsorshipCallbackConfig, S as SponsorshipConfig, aw as SponsorshipUrlConfig, aa as ThemeConfig, T as TransactionAction, V as TransactionDetails, Q as TransactionFees, U as UserPasskeysResponse, W as WebAuthnSignature, j as createCrossChainPermission } from './types-U_dwxbtS.js';
7
- export { O as OneAuthProvider, a as OneAuthProviderOptions, c as createOneAuthProvider } from './provider-Cd7Ip5L-.js';
8
- import { P as PasskeyWalletClientConfig, S as SendCallsParams } from './verify-BLgZzwmJ.js';
9
- export { E as ETHEREUM_MESSAGE_PREFIX, T as TransactionCall, e as encodeWebAuthnSignature, h as hashCalls, a as hashMessage, v as verifyMessageHash } from './verify-BLgZzwmJ.js';
5
+ import { h as IntentCall, i as SendIntentResult } from './types-C0jKNT_t.js';
6
+ export { a7 as AssetBalance, a8 as AssetBalanceBucket, a9 as AssetsResponse, u as AuthFlow, A as AuthResult, v as AuthWithModalOptions, z as AuthenticateOptions, B as AuthenticateResult, R as BalanceRequirement, ap as BatchIntentItem, as as BatchIntentItemResult, ad as CheckConsentOptions, ae as CheckConsentResult, a0 as CloseOnStatus, y as ConnectResult, ac as ConsentData, ab as ConsentField, w as CreateAccountWithModalOptions, C as CreateCrossChainPermissionInput, r as CreateSigningRequestResponse, k as CrossChainPermit, l as CrossChainSettlementLayer, M as EIP712Domain, O as EIP712TypeField, N as EIP712Types, E as EmbedOptions, a2 as ExecuteIntentResponse, a6 as GetAssetsOptions, an as GrantPermissionContractMetadata, ah as GrantPermissionsOptions, ai as GrantPermissionsResult, a4 as IntentHistoryItem, a3 as IntentHistoryOptions, a5 as IntentHistoryResult, Z as IntentQuote, _ as IntentStatus, X as IntentTokenRequest, aj as ListSessionGrantsOptions, ak as ListSessionGrantsResult, L as LoginWithModalOptions, ax as OneAuthTelemetryAttributeValue, ay as OneAuthTelemetryAttributes, az as OneAuthTelemetryConfig, aA as OneAuthTelemetryEvent, aB as OneAuthTelemetryEventName, aC as OneAuthTelemetryFlow, aD as OneAuthTelemetryTraceContext, $ as OrchestratorStatus, t as PasskeyCredential, P as PasskeyProviderConfig, au as PrepareBatchIntentResponse, a1 as PrepareIntentResponse, at as PreparedBatchIntent, af as RequestConsentOptions, ag as RequestConsentResult, aq as SendBatchIntentOptions, ar as SendBatchIntentResult, Y as SendIntentOptions, am as SessionGrantChain, al as SessionGrantRecord, F as SignMessageOptions, G as SignMessageResult, J as SignTypedDataOptions, K as SignTypedDataResult, x as SignerType, p as SigningError, q as SigningErrorCode, m as SigningRequestOptions, s as SigningRequestStatus, n as SigningResult, D as SigningResultBase, o as SigningSuccess, ao as SmartSessionPolicy, av as SponsorshipCallbackConfig, S as SponsorshipConfig, aw as SponsorshipUrlConfig, aa as ThemeConfig, T as TransactionAction, V as TransactionDetails, Q as TransactionFees, U as UserPasskeysResponse, W as WebAuthnSignature, j as createCrossChainPermission } from './types-C0jKNT_t.js';
7
+ export { O as OneAuthProvider, a as OneAuthProviderOptions, c as createOneAuthProvider } from './provider-6JoziYDq.js';
8
+ import { P as PasskeyWalletClientConfig, S as SendCallsParams } from './verify-CnOwPq78.js';
9
+ export { C as ChainFilterOptions, E as ETHEREUM_MESSAGE_PREFIX, p as TokenConfig, T as TransactionCall, e as encodeWebAuthnSignature, b as getAllSupportedChainsAndTokens, f as getChainById, i as getChainExplorerUrl, j as getChainRpcUrl, g as getSupportedChainIds, a as getSupportedChains, d as getSupportedTokenSymbols, c as getSupportedTokens, l as getTokenAddress, n as getTokenDecimals, m as getTokenSymbol, h as hashCalls, q as hashMessage, k as isTestnet, o as isTokenAddressSupported, r as resolveTokenAddress, v as verifyMessageHash } from './verify-CnOwPq78.js';
10
10
  import * as react_jsx_runtime from 'react/jsx-runtime';
11
11
  import * as React from 'react';
12
12
 
@@ -160,7 +160,7 @@ type PasskeyWalletClient = WalletClient & {
160
160
  * const walletClient = createPasskeyWalletClient({
161
161
  * accountAddress: '0x...',
162
162
  * username: 'alice',
163
- * providerUrl: 'https://passkey.1auth.box',
163
+ * providerUrl: 'https://passkey.1auth.app',
164
164
  * clientId: 'my-dapp',
165
165
  * chain: baseSepolia,
166
166
  * transport: http(),
@@ -289,45 +289,4 @@ interface BatchQueueWidgetProps {
289
289
  */
290
290
  declare function BatchQueueWidget({ onSignAll }: BatchQueueWidgetProps): react_jsx_runtime.JSX.Element | null;
291
291
 
292
- /**
293
- * @file Chain and token registry for the 1auth SDK.
294
- *
295
- * Wraps `@rhinestone/shared-configs` chain/token data and combines it with
296
- * viem's chain definitions to expose a filtered, testnet-aware registry.
297
- * Consumers can look up supported chains and tokens, resolve token addresses
298
- * by symbol, and retrieve chain metadata such as explorer URLs and default RPC
299
- * endpoints.
300
- *
301
- * Testnet inclusion is controlled by the `includeTestnets` option on each
302
- * function or, as a project-wide default, by the environment variables
303
- * `NEXT_PUBLIC_ORCHESTRATOR_USE_TESTNETS` or `ORCHESTRATOR_USE_TESTNETS`.
304
- */
305
-
306
- type TokenConfig = {
307
- symbol: string;
308
- address: Address;
309
- decimals: number;
310
- };
311
- type ChainFilterOptions = {
312
- includeTestnets?: boolean;
313
- chainIds?: number[];
314
- };
315
- declare function getSupportedChainIds(options?: ChainFilterOptions): number[];
316
- declare function getSupportedChains(options?: ChainFilterOptions): Chain[];
317
- declare function getAllSupportedChainsAndTokens(options?: ChainFilterOptions): Array<{
318
- chainId: number;
319
- tokens: TokenConfig[];
320
- }>;
321
- declare function getChainById(chainId: number): Chain;
322
- declare function getChainExplorerUrl(chainId: number): string | undefined;
323
- declare function getChainRpcUrl(chainId: number): string | undefined;
324
- declare function getSupportedTokens(chainId: number): TokenConfig[];
325
- declare function getSupportedTokenSymbols(chainId: number): string[];
326
- declare function getTokenAddress(symbolOrAddress: string, chainId: number): Address;
327
- declare function getTokenDecimals(symbolOrAddress: string, chainId: number): number;
328
- declare function resolveTokenAddress(token: string, chainId: number): Address;
329
- declare function isTestnet(chainId: number): boolean;
330
- declare function getTokenSymbol(tokenAddress: Address, chainId: number): string;
331
- declare function isTokenAddressSupported(tokenAddress: Address, chainId: number): boolean;
332
-
333
- export { type BatchQueueContextValue, type BatchQueueIdentity, BatchQueueProvider, type BatchQueueProviderProps, BatchQueueWidget, type BatchQueueWidgetProps, type BatchedCall, type ChainFilterOptions, type DefinePermissionsConfig, type DefinedPermissions, IntentCall, OneAuthClient, type PasskeyAccount, type PasskeyWalletClient, PasskeyWalletClientConfig, SendCallsParams, SendIntentResult, type TokenConfig, createPasskeyAccount, createPasskeyWalletClient, definePermissions, getAllSupportedChainsAndTokens, getChainById, getChainExplorerUrl, getChainName, getChainRpcUrl, getSupportedChainIds, getSupportedChains, getSupportedTokenSymbols, getSupportedTokens, getTokenAddress, getTokenDecimals, getTokenSymbol, isTestnet, isTokenAddressSupported, resolveTokenAddress, useBatchQueue };
292
+ export { type BatchQueueContextValue, type BatchQueueIdentity, BatchQueueProvider, type BatchQueueProviderProps, BatchQueueWidget, type BatchQueueWidgetProps, type BatchedCall, type DefinePermissionsConfig, type DefinedPermissions, IntentCall, OneAuthClient, type PasskeyAccount, type PasskeyWalletClient, PasskeyWalletClientConfig, SendCallsParams, SendIntentResult, createPasskeyAccount, createPasskeyWalletClient, definePermissions, getChainName, useBatchQueue };
package/dist/index.js CHANGED
@@ -378,7 +378,7 @@ var POPUP_WIDTH = LOADING_MODAL_WIDTH;
378
378
  var POPUP_HEIGHT = 600;
379
379
  var DEFAULT_EMBED_WIDTH = `${LOADING_MODAL_WIDTH}px`;
380
380
  var DEFAULT_EMBED_HEIGHT = "500px";
381
- var DEFAULT_PROVIDER_URL = "https://passkey.1auth.box";
381
+ var DEFAULT_PROVIDER_URL = "https://passkey.1auth.app";
382
382
  function currentWindowOrigin() {
383
383
  if (typeof window === "undefined") return null;
384
384
  const origin = window.location?.origin;
@@ -834,7 +834,7 @@ var OneAuthClient = class {
834
834
  * Falls back to the raw dialog URL string if URL parsing fails (e.g. during
835
835
  * unit tests with non-standard URL formats).
836
836
  *
837
- * @returns The scheme + host + optional port of the dialog app (e.g. `"https://passkey.1auth.box"`).
837
+ * @returns The scheme + host + optional port of the dialog app (e.g. `"https://passkey.1auth.app"`).
838
838
  */
839
839
  getDialogOrigin() {
840
840
  const dialogUrl = this.getDialogUrl();
@@ -1885,7 +1885,7 @@ var OneAuthClient = class {
1885
1885
  };
1886
1886
  const handleMessage = (event) => {
1887
1887
  if (event.origin !== dialogOrigin) return;
1888
- if (event.data?.type === "PASSKEY_CLOSE") {
1888
+ if (event.data?.type === "PASSKEY_CLOSE" && event.source === iframe.contentWindow) {
1889
1889
  resolveClosed(iframeReadyObserved);
1890
1890
  }
1891
1891
  };
@@ -2584,7 +2584,7 @@ var OneAuthClient = class {
2584
2584
  const dialogOrigin2 = this.getDialogOrigin();
2585
2585
  const earlyCloseHandler = (event) => {
2586
2586
  if (event.origin !== dialogOrigin2) return;
2587
- if (event.data?.type === "PASSKEY_CLOSE") {
2587
+ if (event.data?.type === "PASSKEY_CLOSE" && event.source === iframe.contentWindow) {
2588
2588
  userClosedEarly = true;
2589
2589
  cleanup();
2590
2590
  }
@@ -3199,7 +3199,7 @@ var OneAuthClient = class {
3199
3199
  * @param cleanup - Idempotent teardown function that closes and removes the dialog.
3200
3200
  * @returns A `SigningResult` discriminated union.
3201
3201
  */
3202
- waitForIntentSigningResponse(requestId, dialog, _iframe, cleanup) {
3202
+ waitForIntentSigningResponse(requestId, dialog, iframe, cleanup) {
3203
3203
  const dialogOrigin = this.getDialogOrigin();
3204
3204
  return new Promise((resolve) => {
3205
3205
  const handleMessage = (event) => {
@@ -3225,7 +3225,7 @@ var OneAuthClient = class {
3225
3225
  }
3226
3226
  });
3227
3227
  }
3228
- } else if (message?.type === "PASSKEY_CLOSE") {
3228
+ } else if (message?.type === "PASSKEY_CLOSE" && event.source === iframe.contentWindow) {
3229
3229
  window.removeEventListener("message", handleMessage);
3230
3230
  cleanup();
3231
3231
  resolve({
@@ -3256,12 +3256,13 @@ var OneAuthClient = class {
3256
3256
  * forward to the execute endpoint.
3257
3257
  *
3258
3258
  * @param dialog - The `<dialog>` element wrapping the signing iframe.
3259
- * @param _iframe - Unused; kept for signature consistency with other wait helpers.
3259
+ * @param iframe - The signing iframe; used to authenticate the source of
3260
+ * `PASSKEY_CLOSE` so a sibling same-origin dialog can't forge a rejection.
3260
3261
  * @param cleanup - Idempotent teardown that closes and removes the dialog.
3261
3262
  * @returns A `SigningResult` extended with an optional `signedHash` field
3262
3263
  * populated when the dialog performs message signing.
3263
3264
  */
3264
- waitForSigningResponse(dialog, _iframe, cleanup) {
3265
+ waitForSigningResponse(dialog, iframe, cleanup) {
3265
3266
  const dialogOrigin = this.getDialogOrigin();
3266
3267
  return new Promise((resolve) => {
3267
3268
  const handleMessage = (event) => {
@@ -3292,7 +3293,7 @@ var OneAuthClient = class {
3292
3293
  }
3293
3294
  });
3294
3295
  }
3295
- } else if (message?.type === "PASSKEY_CLOSE") {
3296
+ } else if (message?.type === "PASSKEY_CLOSE" && event.source === iframe.contentWindow) {
3296
3297
  window.removeEventListener("message", handleMessage);
3297
3298
  cleanup();
3298
3299
  resolve({
@@ -3375,7 +3376,7 @@ var OneAuthClient = class {
3375
3376
  }
3376
3377
  });
3377
3378
  }
3378
- } else if (message?.type === "PASSKEY_CLOSE") {
3379
+ } else if (message?.type === "PASSKEY_CLOSE" && event.source === iframe.contentWindow) {
3379
3380
  window.removeEventListener("message", handleMessage);
3380
3381
  cleanup();
3381
3382
  resolve({
@@ -3625,7 +3626,7 @@ var OneAuthClient = class {
3625
3626
  );
3626
3627
  }
3627
3628
  });
3628
- } else if (event.data?.type === "PASSKEY_CLOSE") {
3629
+ } else if (event.data?.type === "PASSKEY_CLOSE" && event.source === iframe.contentWindow) {
3629
3630
  teardown();
3630
3631
  cleanup();
3631
3632
  resolve({ ready: false });
@@ -4648,7 +4649,7 @@ var OneAuthClient = class {
4648
4649
  blindSigning
4649
4650
  }, dialogOrigin);
4650
4651
  resolve(true);
4651
- } else if (event.data?.type === "PASSKEY_CLOSE") {
4652
+ } else if (event.data?.type === "PASSKEY_CLOSE" && event.source === iframe.contentWindow) {
4652
4653
  teardown();
4653
4654
  cleanup();
4654
4655
  resolve(false);
@@ -5291,7 +5292,7 @@ var OneAuthClient = class {
5291
5292
  message: "Permission grant failed"
5292
5293
  }
5293
5294
  });
5294
- } else if (data?.type === "PASSKEY_CLOSE") {
5295
+ } else if (data?.type === "PASSKEY_CLOSE" && event.source === iframe.contentWindow) {
5295
5296
  teardown();
5296
5297
  cleanup();
5297
5298
  resolve({