@rhinestone/1auth 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1202,7 +1202,10 @@ declare class OneAuthClient {
1202
1202
  */
1203
1203
  private waitForDialogReady;
1204
1204
  /**
1205
- * Create a modal dialog with an iframe inside.
1205
+ * Create a modal dialog with a full-viewport iframe inside.
1206
+ * All visual chrome (backdrop, positioning, animations) is rendered
1207
+ * by the passkey app inside the iframe — the SDK just provides
1208
+ * a transparent full-screen container.
1206
1209
  */
1207
1210
  private createModalDialog;
1208
1211
  private waitForModalAuthResponse;
@@ -1202,7 +1202,10 @@ declare class OneAuthClient {
1202
1202
  */
1203
1203
  private waitForDialogReady;
1204
1204
  /**
1205
- * Create a modal dialog with an iframe inside.
1205
+ * Create a modal dialog with a full-viewport iframe inside.
1206
+ * All visual chrome (backdrop, positioning, animations) is rendered
1207
+ * by the passkey app inside the iframe — the SDK just provides
1208
+ * a transparent full-screen container.
1206
1209
  */
1207
1210
  private createModalDialog;
1208
1211
  private waitForModalAuthResponse;
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { O as OneAuthClient, I as IntentSigner, W as WebAuthnSignature, a as IntentCall, S as SendIntentResult } from './client-Di8SBnPO.mjs';
2
- export { A as AuthResult, j as AuthenticateOptions, k as AuthenticateResult, B as BalanceRequirement, a0 as BatchIntentItem, a3 as BatchIntentItemResult, Y as CheckConsentOptions, Z as CheckConsentResult, F as CloseOnStatus, i as ConnectResult, X as ConsentData, V as ConsentField, C as CreateSigningRequestResponse, D as DeveloperSignedIntent, q as EIP712Domain, s as EIP712TypeField, r as EIP712Types, E as EmbedOptions, H as ExecuteIntentResponse, K as IntentHistoryItem, J as IntentHistoryOptions, L as IntentHistoryResult, x as IntentQuote, y as IntentStatus, v as IntentTokenRequest, z as OrchestratorStatus, h as PasskeyCredential, P as PasskeyProviderConfig, a5 as PrepareBatchIntentResponse, G as PrepareIntentResponse, a4 as PreparedBatchIntent, _ as RequestConsentOptions, $ as RequestConsentResult, a1 as SendBatchIntentOptions, a2 as SendBatchIntentResult, w as SendIntentOptions, M as SendSwapOptions, N as SendSwapResult, m as SignMessageOptions, n as SignMessageResult, o as SignTypedDataOptions, p as SignTypedDataResult, e as SigningError, f as SigningErrorCode, b as SigningRequestOptions, g as SigningRequestStatus, c as SigningResult, l as SigningResultBase, d as SigningSuccess, Q as SwapQuote, R as ThemeConfig, T as TransactionAction, u as TransactionDetails, t as TransactionFees, U as UserPasskeysResponse } from './client-Di8SBnPO.mjs';
3
- export { O as OneAuthProvider, a as OneAuthProviderOptions, c as createOneAuthProvider } from './provider-8anOtc87.mjs';
1
+ import { O as OneAuthClient, I as IntentSigner, W as WebAuthnSignature, a as IntentCall, S as SendIntentResult } from './client-CHCVV9H3.mjs';
2
+ export { A as AuthResult, j as AuthenticateOptions, k as AuthenticateResult, B as BalanceRequirement, a0 as BatchIntentItem, a3 as BatchIntentItemResult, Y as CheckConsentOptions, Z as CheckConsentResult, F as CloseOnStatus, i as ConnectResult, X as ConsentData, V as ConsentField, C as CreateSigningRequestResponse, D as DeveloperSignedIntent, q as EIP712Domain, s as EIP712TypeField, r as EIP712Types, E as EmbedOptions, H as ExecuteIntentResponse, K as IntentHistoryItem, J as IntentHistoryOptions, L as IntentHistoryResult, x as IntentQuote, y as IntentStatus, v as IntentTokenRequest, z as OrchestratorStatus, h as PasskeyCredential, P as PasskeyProviderConfig, a5 as PrepareBatchIntentResponse, G as PrepareIntentResponse, a4 as PreparedBatchIntent, _ as RequestConsentOptions, $ as RequestConsentResult, a1 as SendBatchIntentOptions, a2 as SendBatchIntentResult, w as SendIntentOptions, M as SendSwapOptions, N as SendSwapResult, m as SignMessageOptions, n as SignMessageResult, o as SignTypedDataOptions, p as SignTypedDataResult, e as SigningError, f as SigningErrorCode, b as SigningRequestOptions, g as SigningRequestStatus, c as SigningResult, l as SigningResultBase, d as SigningSuccess, Q as SwapQuote, R as ThemeConfig, T as TransactionAction, u as TransactionDetails, t as TransactionFees, U as UserPasskeysResponse } from './client-CHCVV9H3.mjs';
3
+ export { O as OneAuthProvider, a as OneAuthProviderOptions, c as createOneAuthProvider } from './provider-B5pLvKo_.mjs';
4
4
  import { Address, LocalAccount, Chain, Transport, Hex, WalletClient, Hash } from 'viem';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import * as React from 'react';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { O as OneAuthClient, I as IntentSigner, W as WebAuthnSignature, a as IntentCall, S as SendIntentResult } from './client-Di8SBnPO.js';
2
- export { A as AuthResult, j as AuthenticateOptions, k as AuthenticateResult, B as BalanceRequirement, a0 as BatchIntentItem, a3 as BatchIntentItemResult, Y as CheckConsentOptions, Z as CheckConsentResult, F as CloseOnStatus, i as ConnectResult, X as ConsentData, V as ConsentField, C as CreateSigningRequestResponse, D as DeveloperSignedIntent, q as EIP712Domain, s as EIP712TypeField, r as EIP712Types, E as EmbedOptions, H as ExecuteIntentResponse, K as IntentHistoryItem, J as IntentHistoryOptions, L as IntentHistoryResult, x as IntentQuote, y as IntentStatus, v as IntentTokenRequest, z as OrchestratorStatus, h as PasskeyCredential, P as PasskeyProviderConfig, a5 as PrepareBatchIntentResponse, G as PrepareIntentResponse, a4 as PreparedBatchIntent, _ as RequestConsentOptions, $ as RequestConsentResult, a1 as SendBatchIntentOptions, a2 as SendBatchIntentResult, w as SendIntentOptions, M as SendSwapOptions, N as SendSwapResult, m as SignMessageOptions, n as SignMessageResult, o as SignTypedDataOptions, p as SignTypedDataResult, e as SigningError, f as SigningErrorCode, b as SigningRequestOptions, g as SigningRequestStatus, c as SigningResult, l as SigningResultBase, d as SigningSuccess, Q as SwapQuote, R as ThemeConfig, T as TransactionAction, u as TransactionDetails, t as TransactionFees, U as UserPasskeysResponse } from './client-Di8SBnPO.js';
3
- export { O as OneAuthProvider, a as OneAuthProviderOptions, c as createOneAuthProvider } from './provider-CFnLQt5m.js';
1
+ import { O as OneAuthClient, I as IntentSigner, W as WebAuthnSignature, a as IntentCall, S as SendIntentResult } from './client-CHCVV9H3.js';
2
+ export { A as AuthResult, j as AuthenticateOptions, k as AuthenticateResult, B as BalanceRequirement, a0 as BatchIntentItem, a3 as BatchIntentItemResult, Y as CheckConsentOptions, Z as CheckConsentResult, F as CloseOnStatus, i as ConnectResult, X as ConsentData, V as ConsentField, C as CreateSigningRequestResponse, D as DeveloperSignedIntent, q as EIP712Domain, s as EIP712TypeField, r as EIP712Types, E as EmbedOptions, H as ExecuteIntentResponse, K as IntentHistoryItem, J as IntentHistoryOptions, L as IntentHistoryResult, x as IntentQuote, y as IntentStatus, v as IntentTokenRequest, z as OrchestratorStatus, h as PasskeyCredential, P as PasskeyProviderConfig, a5 as PrepareBatchIntentResponse, G as PrepareIntentResponse, a4 as PreparedBatchIntent, _ as RequestConsentOptions, $ as RequestConsentResult, a1 as SendBatchIntentOptions, a2 as SendBatchIntentResult, w as SendIntentOptions, M as SendSwapOptions, N as SendSwapResult, m as SignMessageOptions, n as SignMessageResult, o as SignTypedDataOptions, p as SignTypedDataResult, e as SigningError, f as SigningErrorCode, b as SigningRequestOptions, g as SigningRequestStatus, c as SigningResult, l as SigningResultBase, d as SigningSuccess, Q as SwapQuote, R as ThemeConfig, T as TransactionAction, u as TransactionDetails, t as TransactionFees, U as UserPasskeysResponse } from './client-CHCVV9H3.js';
3
+ export { O as OneAuthProvider, a as OneAuthProviderOptions, c as createOneAuthProvider } from './provider-DzxXGyV8.js';
4
4
  import { Address, LocalAccount, Chain, Transport, Hex, WalletClient, Hash } from 'viem';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import * as React from 'react';
package/dist/index.js CHANGED
@@ -197,7 +197,6 @@ var POPUP_WIDTH = 450;
197
197
  var POPUP_HEIGHT = 600;
198
198
  var DEFAULT_EMBED_WIDTH = "400px";
199
199
  var DEFAULT_EMBED_HEIGHT = "500px";
200
- var MODAL_WIDTH = 340;
201
200
  var DEFAULT_PROVIDER_URL = "https://passkey.1auth.box";
202
201
  var OneAuthClient = class {
203
202
  constructor(config) {
@@ -726,7 +725,7 @@ var OneAuthClient = class {
726
725
  if (event.origin !== dialogOrigin) return;
727
726
  if (event.data?.type === "PASSKEY_READY") {
728
727
  iframe.contentWindow?.postMessage(
729
- { type: "PASSKEY_INIT", ...initPayload },
728
+ { type: "PASSKEY_INIT", ...initPayload, fullViewport: true },
730
729
  dialogOrigin
731
730
  );
732
731
  }
@@ -1065,7 +1064,7 @@ var OneAuthClient = class {
1065
1064
  if (event.origin !== dialogOrigin) return;
1066
1065
  if (event.data?.type === "PASSKEY_READY") {
1067
1066
  iframe.contentWindow?.postMessage(
1068
- { type: "PASSKEY_INIT", ...batchInitPayload },
1067
+ { type: "PASSKEY_INIT", ...batchInitPayload, fullViewport: true },
1069
1068
  dialogOrigin
1070
1069
  );
1071
1070
  }
@@ -1398,7 +1397,7 @@ var OneAuthClient = class {
1398
1397
  ready: true,
1399
1398
  sendInit: (initMessage) => {
1400
1399
  iframe.contentWindow?.postMessage(
1401
- { type: "PASSKEY_INIT", ...initMessage },
1400
+ { type: "PASSKEY_INIT", ...initMessage, fullViewport: true },
1402
1401
  dialogOrigin
1403
1402
  );
1404
1403
  }
@@ -2132,7 +2131,8 @@ var OneAuthClient = class {
2132
2131
  teardown();
2133
2132
  iframe.contentWindow?.postMessage({
2134
2133
  type: "PASSKEY_INIT",
2135
- ...initMessage
2134
+ ...initMessage,
2135
+ fullViewport: true
2136
2136
  }, dialogOrigin);
2137
2137
  resolve(true);
2138
2138
  } else if (event.data?.type === "PASSKEY_CLOSE") {
@@ -2155,121 +2155,88 @@ var OneAuthClient = class {
2155
2155
  });
2156
2156
  }
2157
2157
  /**
2158
- * Create a modal dialog with an iframe inside.
2158
+ * Create a modal dialog with a full-viewport iframe inside.
2159
+ * All visual chrome (backdrop, positioning, animations) is rendered
2160
+ * by the passkey app inside the iframe — the SDK just provides
2161
+ * a transparent full-screen container.
2159
2162
  */
2160
2163
  createModalDialog(url) {
2161
2164
  const dialogUrl = this.getDialogUrl();
2162
2165
  const hostUrl = new URL(dialogUrl);
2163
2166
  const dialog = document.createElement("dialog");
2164
2167
  dialog.dataset.passkey = "";
2168
+ dialog.style.opacity = "0";
2169
+ dialog.style.background = "transparent";
2165
2170
  document.body.appendChild(dialog);
2166
2171
  const style = document.createElement("style");
2167
2172
  style.textContent = `
2168
2173
  dialog[data-passkey] {
2169
- padding: 0;
2170
- border: none;
2171
- background: transparent;
2174
+ position: fixed;
2175
+ top: 0;
2176
+ left: 0;
2177
+ width: 100vw;
2178
+ height: 100vh;
2179
+ height: 100dvh;
2172
2180
  max-width: none;
2173
2181
  max-height: none;
2174
2182
  margin: 0;
2175
- position: fixed;
2176
- top: 50px;
2177
- left: 50%;
2178
- transform: translateX(-50%);
2183
+ padding: 0;
2184
+ border: none;
2185
+ background: transparent;
2179
2186
  outline: none;
2187
+ overflow: hidden;
2188
+ pointer-events: auto;
2180
2189
  }
2181
-
2182
2190
  dialog[data-passkey]::backdrop {
2183
- background-color: rgba(0, 0, 0, 0.4);
2184
- backdrop-filter: blur(8px);
2185
- -webkit-backdrop-filter: blur(8px);
2191
+ background: transparent !important;
2186
2192
  }
2187
-
2188
2193
  dialog[data-passkey] iframe {
2194
+ position: fixed;
2195
+ top: 0;
2196
+ left: 0;
2197
+ width: 100%;
2198
+ height: 100%;
2199
+ border: 0;
2189
2200
  background-color: transparent;
2190
- border-radius: 14px;
2191
- border: none;
2192
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
2193
- transition: height 0.15s ease-out;
2194
- max-height: calc(100vh - 100px);
2195
- max-height: calc(100dvh - 100px);
2196
- }
2197
-
2198
- @media (min-width: 769px) {
2199
- dialog[data-passkey] iframe {
2200
- animation: passkey_zoomIn 0.2s cubic-bezier(0.32, 0.72, 0, 1);
2201
- }
2202
- }
2203
-
2204
- @media (max-width: 768px) {
2205
- dialog[data-passkey] {
2206
- width: 100vw !important;
2207
- height: auto !important;
2208
- max-height: 90vh !important;
2209
- max-height: 90dvh !important;
2210
- top: auto !important;
2211
- bottom: 0 !important;
2212
- left: 0 !important;
2213
- right: 0 !important;
2214
- transform: none !important;
2215
- margin: 0 !important;
2216
- }
2217
-
2218
- dialog[data-passkey] iframe {
2219
- animation: passkey_slideFromBottom 0.3s cubic-bezier(0.32, 0.72, 0, 1);
2220
- border-bottom-left-radius: 0 !important;
2221
- border-bottom-right-radius: 0 !important;
2222
- width: 100% !important;
2223
- max-height: 90vh !important;
2224
- max-height: 90dvh !important;
2225
- box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.15) !important;
2226
- }
2227
- }
2228
-
2229
- @keyframes passkey_zoomIn {
2230
- from {
2231
- opacity: 0;
2232
- transform: scale(0.96) translateY(8px);
2233
- }
2234
- to {
2235
- opacity: 1;
2236
- transform: scale(1) translateY(0);
2237
- }
2238
- }
2239
-
2240
- @keyframes passkey_slideFromBottom {
2241
- from { transform: translate3d(0, 100%, 0); }
2242
- to { transform: translate3d(0, 0, 0); }
2243
- }
2244
-
2245
- @keyframes passkey_shake {
2246
- 0%, 100% { transform: translateX(0); }
2247
- 20% { transform: translateX(-4px); }
2248
- 40% { transform: translateX(4px); }
2249
- 60% { transform: translateX(-4px); }
2250
- 80% { transform: translateX(4px); }
2201
+ pointer-events: auto;
2251
2202
  }
2252
2203
  `;
2253
2204
  dialog.appendChild(style);
2254
2205
  const iframe = document.createElement("iframe");
2255
2206
  iframe.setAttribute(
2256
2207
  "allow",
2257
- "publickey-credentials-get *; publickey-credentials-create *; clipboard-write; identity-credentials-get"
2208
+ [
2209
+ `publickey-credentials-get ${hostUrl.origin}`,
2210
+ `publickey-credentials-create ${hostUrl.origin}`,
2211
+ "clipboard-write",
2212
+ "identity-credentials-get"
2213
+ ].join("; ")
2258
2214
  );
2259
2215
  iframe.setAttribute("aria-label", "Passkey Authentication");
2260
2216
  iframe.setAttribute("tabindex", "0");
2217
+ iframe.setAttribute(
2218
+ "sandbox",
2219
+ "allow-forms allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox"
2220
+ );
2261
2221
  iframe.setAttribute("src", url);
2262
2222
  iframe.setAttribute("title", "Passkey");
2263
- iframe.style.border = "none";
2264
- iframe.style.height = "400px";
2265
- iframe.style.width = `${MODAL_WIDTH}px`;
2223
+ iframe.style.opacity = "0";
2266
2224
  dialog.appendChild(iframe);
2225
+ const inertObserver = new MutationObserver((mutations) => {
2226
+ for (const mutation of mutations) {
2227
+ if (mutation.attributeName === "inert") {
2228
+ dialog.removeAttribute("inert");
2229
+ }
2230
+ }
2231
+ });
2232
+ inertObserver.observe(dialog, { attributes: true });
2267
2233
  const handleMessage = (event) => {
2268
2234
  if (event.origin !== hostUrl.origin) return;
2269
- if (event.data?.type === "PASSKEY_RESIZE") {
2270
- const maxHeight = window.innerHeight - 100;
2271
- iframe.style.height = `${Math.min(event.data.height, maxHeight)}px`;
2272
- } else if (event.data?.type === "PASSKEY_DISCONNECT") {
2235
+ if (event.data?.type === "PASSKEY_RENDERED") {
2236
+ dialog.style.opacity = "1";
2237
+ iframe.style.opacity = "1";
2238
+ }
2239
+ if (event.data?.type === "PASSKEY_DISCONNECT") {
2273
2240
  localStorage.removeItem("1auth-user");
2274
2241
  }
2275
2242
  };
@@ -2280,19 +2247,22 @@ var OneAuthClient = class {
2280
2247
  }
2281
2248
  };
2282
2249
  document.addEventListener("keydown", handleEscape);
2283
- dialog.addEventListener("click", (event) => {
2284
- if (event.target === dialog) {
2285
- cleanup();
2286
- }
2287
- });
2288
2250
  dialog.showModal();
2289
2251
  let cleanedUp = false;
2290
2252
  const cleanup = () => {
2291
2253
  if (cleanedUp) return;
2292
2254
  cleanedUp = true;
2255
+ inertObserver.disconnect();
2293
2256
  window.removeEventListener("message", handleMessage);
2294
2257
  document.removeEventListener("keydown", handleEscape);
2295
2258
  dialog.close();
2259
+ if (dialog.parentNode) {
2260
+ for (const sibling of Array.from(dialog.parentNode.children)) {
2261
+ if (sibling !== dialog && sibling instanceof HTMLElement && sibling.hasAttribute("inert")) {
2262
+ sibling.removeAttribute("inert");
2263
+ }
2264
+ }
2265
+ }
2296
2266
  dialog.remove();
2297
2267
  };
2298
2268
  return { dialog, iframe, cleanup };
@@ -2308,7 +2278,8 @@ var OneAuthClient = class {
2308
2278
  dialogReady = true;
2309
2279
  iframe.contentWindow?.postMessage({
2310
2280
  type: "PASSKEY_INIT",
2311
- mode: "iframe"
2281
+ mode: "iframe",
2282
+ fullViewport: true
2312
2283
  }, dialogOrigin);
2313
2284
  return;
2314
2285
  }