@rhinestone/1auth 0.5.0 → 0.6.1
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/{client-Di8SBnPO.d.mts → client-CHCVV9H3.d.mts} +4 -1
- package/dist/{client-Di8SBnPO.d.ts → client-CHCVV9H3.d.ts} +4 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +141 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +141 -83
- package/dist/index.mjs.map +1 -1
- package/dist/{provider-8anOtc87.d.mts → provider-B5pLvKo_.d.mts} +1 -1
- package/dist/{provider-CFnLQt5m.d.ts → provider-DzxXGyV8.d.ts} +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/wagmi.d.mts +2 -2
- package/dist/wagmi.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1202,7 +1202,10 @@ declare class OneAuthClient {
|
|
|
1202
1202
|
*/
|
|
1203
1203
|
private waitForDialogReady;
|
|
1204
1204
|
/**
|
|
1205
|
-
* Create a modal dialog with
|
|
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
|
|
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-
|
|
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-
|
|
3
|
-
export { O as OneAuthProvider, a as OneAuthProviderOptions, c as createOneAuthProvider } from './provider-
|
|
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-
|
|
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-
|
|
3
|
-
export { O as OneAuthProvider, a as OneAuthProviderOptions, c as createOneAuthProvider } from './provider-
|
|
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,175 @@ var OneAuthClient = class {
|
|
|
2155
2155
|
});
|
|
2156
2156
|
}
|
|
2157
2157
|
/**
|
|
2158
|
-
* Create a modal dialog with
|
|
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);
|
|
2166
|
+
const urlParams = new URL(url, window.location.href).searchParams;
|
|
2167
|
+
const themeMode = urlParams.get("theme") || "light";
|
|
2168
|
+
const accentColor = urlParams.get("accent") || "#0090ff";
|
|
2169
|
+
const isDark = themeMode === "dark" || themeMode !== "light" && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
2170
|
+
const bgPrimary = isDark ? "#191919" : "#fcfcfc";
|
|
2171
|
+
const bgSecondary = isDark ? "#222222" : "#f9f9f9";
|
|
2172
|
+
const borderColor = isDark ? "#2a2a2a" : "#e0e0e0";
|
|
2173
|
+
const textPrimary = isDark ? "#eeeeee" : "#202020";
|
|
2174
|
+
const textSecondary = isDark ? "#7b7b7b" : "#838383";
|
|
2175
|
+
const bgSurface = isDark ? "#222222" : "#f0f0f0";
|
|
2176
|
+
const ah = accentColor.replace("#", "");
|
|
2177
|
+
const accentRgb = `${parseInt(ah.slice(0, 2), 16)},${parseInt(ah.slice(2, 4), 16)},${parseInt(ah.slice(4, 6), 16)}`;
|
|
2178
|
+
const accentTint = isDark ? `rgba(${accentRgb},0.15)` : `rgba(${accentRgb},0.1)`;
|
|
2179
|
+
const hostname = window.location.hostname;
|
|
2163
2180
|
const dialog = document.createElement("dialog");
|
|
2164
2181
|
dialog.dataset.passkey = "";
|
|
2182
|
+
dialog.style.opacity = "1";
|
|
2183
|
+
dialog.style.background = "transparent";
|
|
2165
2184
|
document.body.appendChild(dialog);
|
|
2166
2185
|
const style = document.createElement("style");
|
|
2167
2186
|
style.textContent = `
|
|
2168
2187
|
dialog[data-passkey] {
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2188
|
+
position: fixed;
|
|
2189
|
+
top: 0;
|
|
2190
|
+
left: 0;
|
|
2191
|
+
width: 100vw;
|
|
2192
|
+
height: 100vh;
|
|
2193
|
+
height: 100dvh;
|
|
2172
2194
|
max-width: none;
|
|
2173
2195
|
max-height: none;
|
|
2174
2196
|
margin: 0;
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2197
|
+
padding: 0;
|
|
2198
|
+
border: none;
|
|
2199
|
+
background: transparent;
|
|
2200
|
+
color-scheme: normal;
|
|
2179
2201
|
outline: none;
|
|
2202
|
+
overflow: hidden;
|
|
2203
|
+
pointer-events: auto;
|
|
2180
2204
|
}
|
|
2181
|
-
|
|
2182
2205
|
dialog[data-passkey]::backdrop {
|
|
2183
|
-
background
|
|
2184
|
-
backdrop-filter: blur(8px);
|
|
2185
|
-
-webkit-backdrop-filter: blur(8px);
|
|
2206
|
+
background: transparent !important;
|
|
2186
2207
|
}
|
|
2187
|
-
|
|
2188
2208
|
dialog[data-passkey] iframe {
|
|
2209
|
+
position: fixed;
|
|
2210
|
+
top: 0;
|
|
2211
|
+
left: 0;
|
|
2212
|
+
width: 100%;
|
|
2213
|
+
height: 100%;
|
|
2214
|
+
border: 0;
|
|
2189
2215
|
background-color: transparent;
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
max-height: calc(100vh - 100px);
|
|
2195
|
-
max-height: calc(100dvh - 100px);
|
|
2216
|
+
color-scheme: normal;
|
|
2217
|
+
pointer-events: auto;
|
|
2218
|
+
backdrop-filter: blur(8px);
|
|
2219
|
+
-webkit-backdrop-filter: blur(8px);
|
|
2196
2220
|
}
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2221
|
+
dialog[data-passkey] [data-passkey-overlay] {
|
|
2222
|
+
position: fixed;
|
|
2223
|
+
top: 0;
|
|
2224
|
+
left: 0;
|
|
2225
|
+
width: 100%;
|
|
2226
|
+
height: 100%;
|
|
2227
|
+
display: flex;
|
|
2228
|
+
align-items: flex-start;
|
|
2229
|
+
justify-content: center;
|
|
2230
|
+
padding-top: 50px;
|
|
2231
|
+
background: rgba(0, 0, 0, 0.4);
|
|
2232
|
+
backdrop-filter: blur(8px);
|
|
2233
|
+
-webkit-backdrop-filter: blur(8px);
|
|
2234
|
+
z-index: 1;
|
|
2235
|
+
animation: _1auth-backdrop-in 0.2s ease-out;
|
|
2202
2236
|
}
|
|
2203
|
-
|
|
2204
2237
|
@media (max-width: 768px) {
|
|
2205
|
-
dialog[data-passkey] {
|
|
2206
|
-
|
|
2207
|
-
|
|
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;
|
|
2238
|
+
dialog[data-passkey] [data-passkey-overlay] {
|
|
2239
|
+
align-items: flex-end;
|
|
2240
|
+
padding-top: 0;
|
|
2226
2241
|
}
|
|
2227
2242
|
}
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2243
|
+
dialog[data-passkey] [data-passkey-card] {
|
|
2244
|
+
width: 340px;
|
|
2245
|
+
overflow: hidden;
|
|
2246
|
+
border-radius: 14px;
|
|
2247
|
+
box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
|
|
2248
|
+
animation: _1auth-card-in 0.2s cubic-bezier(0.32, 0.72, 0, 1);
|
|
2249
|
+
max-height: calc(100dvh - 100px);
|
|
2250
|
+
}
|
|
2251
|
+
@media (max-width: 768px) {
|
|
2252
|
+
dialog[data-passkey] [data-passkey-card] {
|
|
2253
|
+
width: 100%;
|
|
2254
|
+
border-bottom-left-radius: 0;
|
|
2255
|
+
border-bottom-right-radius: 0;
|
|
2256
|
+
animation: _1auth-card-slide 0.3s cubic-bezier(0.32, 0.72, 0, 1);
|
|
2237
2257
|
}
|
|
2238
2258
|
}
|
|
2239
|
-
|
|
2240
|
-
|
|
2259
|
+
@keyframes _1auth-backdrop-in {
|
|
2260
|
+
from { opacity: 0; } to { opacity: 1; }
|
|
2261
|
+
}
|
|
2262
|
+
@keyframes _1auth-card-in {
|
|
2263
|
+
from { opacity: 0; transform: scale(0.96) translateY(8px); }
|
|
2264
|
+
to { opacity: 1; transform: scale(1) translateY(0); }
|
|
2265
|
+
}
|
|
2266
|
+
@keyframes _1auth-card-slide {
|
|
2241
2267
|
from { transform: translate3d(0, 100%, 0); }
|
|
2242
2268
|
to { transform: translate3d(0, 0, 0); }
|
|
2243
2269
|
}
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
20% { transform: translateX(-4px); }
|
|
2248
|
-
40% { transform: translateX(4px); }
|
|
2249
|
-
60% { transform: translateX(-4px); }
|
|
2250
|
-
80% { transform: translateX(4px); }
|
|
2270
|
+
@keyframes _1auth-spin {
|
|
2271
|
+
from { transform: rotate(0deg); }
|
|
2272
|
+
to { transform: rotate(360deg); }
|
|
2251
2273
|
}
|
|
2252
2274
|
`;
|
|
2253
2275
|
dialog.appendChild(style);
|
|
2276
|
+
const overlay = document.createElement("div");
|
|
2277
|
+
overlay.dataset.passkeyOverlay = "";
|
|
2278
|
+
const _sp = '<path d="M10 0.5C8.02219 0.5 6.08879 1.08649 4.4443 2.1853C2.79981 3.28412 1.51809 4.8459 0.761209 6.67316C0.00433288 8.50043 -0.1937 10.5111 0.192152 12.4509C0.578004 14.3907 1.53041 16.1725 2.92894 17.5711C4.32746 18.9696 6.10929 19.922 8.0491 20.3078C9.98891 20.6937 11.9996 20.4957 13.8268 19.7388C15.6541 18.9819 17.2159 17.7002 18.3147 16.0557C19.4135 14.4112 20 12.4778 20 10.5C20 7.84783 18.9464 5.3043 17.0711 3.42893C15.1957 1.55357 12.6522 0.5 10 0.5ZM10 17.7727C8.56159 17.7727 7.15549 17.3462 5.95949 16.547C4.7635 15.7479 3.83134 14.6121 3.28088 13.2831C2.73042 11.9542 2.5864 10.4919 2.86702 9.08116C3.14764 7.67039 3.8403 6.37451 4.85741 5.3574C5.87452 4.3403 7.17039 3.64764 8.58116 3.36702C9.99193 3.0864 11.4542 3.23042 12.7832 3.78088C14.1121 4.33133 15.2479 5.26349 16.0471 6.45949C16.8462 7.65548 17.2727 9.06159 17.2727 10.5C17.2727 12.4288 16.5065 14.2787 15.1426 15.6426C13.7787 17.0065 11.9288 17.7727 10 17.7727Z" fill="currentColor" opacity="0.3"/><path d="M10 3.22767C11.7423 3.22846 13.4276 3.8412 14.7556 4.95667C16.0837 6.07214 16.9681 7.61784 17.2512 9.31825C17.3012 9.64364 17.4662 9.94096 17.7169 10.1573C17.9677 10.3737 18.2878 10.4951 18.6205 10.5C18.8211 10.5001 19.0193 10.457 19.2012 10.3735C19.3832 10.2901 19.5445 10.1684 19.674 10.017C19.8036 9.86549 19.8981 9.68789 19.9511 9.49656C20.004 9.30523 20.0141 9.10478 19.9807 8.90918C19.5986 6.56305 18.3843 4.42821 16.5554 2.88726C14.7265 1.34631 12.4025 0.5 10 0.5C7.59751 0.5 5.27354 1.34631 3.44461 2.88726C1.61569 4.42821 0.401366 6.56305 0.0192815 8.90918C-0.0141442 9.10478 -0.00402016 9.30523 0.0489472 9.49656C0.101914 9.68789 0.196449 9.86549 0.325956 10.017C0.455463 10.1684 0.616823 10.2901 0.798778 10.3735C0.980732 10.457 1.1789 10.5001 1.37945 10.5C1.71216 10.4951 2.03235 10.3737 2.28307 10.1573C2.5338 9.94096 2.69883 9.64364 2.74882 9.31825C3.03193 7.61784 3.91633 6.07214 5.24436 4.95667C6.57239 3.8412 8.25775 3.22846 10 3.22767Z" fill="currentColor"/>';
|
|
2279
|
+
overlay.innerHTML = `<div data-passkey-card style="background:${bgPrimary};border:1px solid ${borderColor};font-family:ui-sans-serif,system-ui,sans-serif,'Apple Color Emoji','Segoe UI Emoji'"><div style="height:36px;display:flex;align-items:center;justify-content:space-between;padding:0 12px;background:${bgSecondary};border-bottom:1px solid ${borderColor}"><div style="display:flex;align-items:center;gap:8px"><div style="display:flex;width:20px;height:20px;align-items:center;justify-content:center;border-radius:4px;background:${bgSurface}"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="${textPrimary}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12V7H5a2 2 0 0 1 0-4h14v4"/><path d="M3 5v14a2 2 0 0 0 2 2h16v-5"/><path d="M18 12a2 2 0 0 0 0 4h4v-4Z"/></svg></div><span style="font-size:13px;font-weight:500;color:${textPrimary};max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">${hostname}</span><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="${textSecondary}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/></svg></div><div style="display:flex;align-items:center;gap:4px"><div style="display:flex;width:24px;height:24px;align-items:center;justify-content:center;border-radius:6px;color:${textSecondary}"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg></div><button data-passkey-close style="display:flex;width:24px;height:24px;align-items:center;justify-content:center;border-radius:6px;color:${textSecondary};border:none;background:none;cursor:pointer;padding:0"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg></button></div></div><div style="padding:12px"><div style="display:flex;align-items:center;gap:8px"><div style="display:flex;width:32px;height:32px;min-width:32px;align-items:center;justify-content:center;border-radius:50%;background:${accentTint};padding:6px"><svg style="width:100%;height:100%;animation:_1auth-spin 0.8s linear infinite;color:${accentColor}" fill="none" viewBox="0 0 20 21" xmlns="http://www.w3.org/2000/svg">${_sp}</svg></div><div style="font-weight:500;font-size:18px;color:${textPrimary}">Loading...</div></div><div style="margin-top:8px"><div style="font-size:15px;line-height:20px;color:${textPrimary}">This will only take a few moments.</div><div style="font-size:15px;line-height:20px;color:${textSecondary}">Please do not close the window.</div></div></div></div>`;
|
|
2280
|
+
overlay.addEventListener("click", (e) => {
|
|
2281
|
+
if (e.target === overlay) cleanup();
|
|
2282
|
+
});
|
|
2283
|
+
const overlayCloseBtn = overlay.querySelector("[data-passkey-close]");
|
|
2284
|
+
if (overlayCloseBtn) overlayCloseBtn.addEventListener("click", () => cleanup());
|
|
2285
|
+
dialog.appendChild(overlay);
|
|
2254
2286
|
const iframe = document.createElement("iframe");
|
|
2255
2287
|
iframe.setAttribute(
|
|
2256
2288
|
"allow",
|
|
2257
|
-
|
|
2289
|
+
[
|
|
2290
|
+
`publickey-credentials-get ${hostUrl.origin}`,
|
|
2291
|
+
`publickey-credentials-create ${hostUrl.origin}`,
|
|
2292
|
+
"clipboard-write",
|
|
2293
|
+
"identity-credentials-get"
|
|
2294
|
+
].join("; ")
|
|
2258
2295
|
);
|
|
2259
2296
|
iframe.setAttribute("aria-label", "Passkey Authentication");
|
|
2260
2297
|
iframe.setAttribute("tabindex", "0");
|
|
2298
|
+
iframe.setAttribute(
|
|
2299
|
+
"sandbox",
|
|
2300
|
+
"allow-forms allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox"
|
|
2301
|
+
);
|
|
2261
2302
|
iframe.setAttribute("src", url);
|
|
2262
2303
|
iframe.setAttribute("title", "Passkey");
|
|
2263
|
-
iframe.style.
|
|
2264
|
-
iframe.style.height = "400px";
|
|
2265
|
-
iframe.style.width = `${MODAL_WIDTH}px`;
|
|
2304
|
+
iframe.style.opacity = "0";
|
|
2266
2305
|
dialog.appendChild(iframe);
|
|
2306
|
+
const inertObserver = new MutationObserver((mutations) => {
|
|
2307
|
+
for (const mutation of mutations) {
|
|
2308
|
+
if (mutation.attributeName === "inert") {
|
|
2309
|
+
dialog.removeAttribute("inert");
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
});
|
|
2313
|
+
inertObserver.observe(dialog, { attributes: true });
|
|
2314
|
+
let overlayHidden = false;
|
|
2315
|
+
const hideOverlay = () => {
|
|
2316
|
+
if (overlayHidden) return;
|
|
2317
|
+
overlayHidden = true;
|
|
2318
|
+
overlay.style.display = "none";
|
|
2319
|
+
iframe.style.opacity = "1";
|
|
2320
|
+
};
|
|
2267
2321
|
const handleMessage = (event) => {
|
|
2268
2322
|
if (event.origin !== hostUrl.origin) return;
|
|
2269
|
-
if (event.data?.type === "
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2323
|
+
if (event.data?.type === "PASSKEY_RENDERED") {
|
|
2324
|
+
hideOverlay();
|
|
2325
|
+
}
|
|
2326
|
+
if (event.data?.type === "PASSKEY_DISCONNECT") {
|
|
2273
2327
|
localStorage.removeItem("1auth-user");
|
|
2274
2328
|
}
|
|
2275
2329
|
};
|
|
@@ -2280,19 +2334,22 @@ var OneAuthClient = class {
|
|
|
2280
2334
|
}
|
|
2281
2335
|
};
|
|
2282
2336
|
document.addEventListener("keydown", handleEscape);
|
|
2283
|
-
dialog.addEventListener("click", (event) => {
|
|
2284
|
-
if (event.target === dialog) {
|
|
2285
|
-
cleanup();
|
|
2286
|
-
}
|
|
2287
|
-
});
|
|
2288
2337
|
dialog.showModal();
|
|
2289
2338
|
let cleanedUp = false;
|
|
2290
2339
|
const cleanup = () => {
|
|
2291
2340
|
if (cleanedUp) return;
|
|
2292
2341
|
cleanedUp = true;
|
|
2342
|
+
inertObserver.disconnect();
|
|
2293
2343
|
window.removeEventListener("message", handleMessage);
|
|
2294
2344
|
document.removeEventListener("keydown", handleEscape);
|
|
2295
2345
|
dialog.close();
|
|
2346
|
+
if (dialog.parentNode) {
|
|
2347
|
+
for (const sibling of Array.from(dialog.parentNode.children)) {
|
|
2348
|
+
if (sibling !== dialog && sibling instanceof HTMLElement && sibling.hasAttribute("inert")) {
|
|
2349
|
+
sibling.removeAttribute("inert");
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2296
2353
|
dialog.remove();
|
|
2297
2354
|
};
|
|
2298
2355
|
return { dialog, iframe, cleanup };
|
|
@@ -2308,7 +2365,8 @@ var OneAuthClient = class {
|
|
|
2308
2365
|
dialogReady = true;
|
|
2309
2366
|
iframe.contentWindow?.postMessage({
|
|
2310
2367
|
type: "PASSKEY_INIT",
|
|
2311
|
-
mode: "iframe"
|
|
2368
|
+
mode: "iframe",
|
|
2369
|
+
fullViewport: true
|
|
2312
2370
|
}, dialogOrigin);
|
|
2313
2371
|
return;
|
|
2314
2372
|
}
|