@thru/passkey 0.2.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/README.md +165 -0
- package/dist/index.cjs +892 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +187 -0
- package/dist/index.d.ts +187 -0
- package/dist/index.js +850 -0
- package/dist/index.js.map +1 -0
- package/package.json +27 -0
- package/src/capabilities.ts +254 -0
- package/src/index.ts +86 -0
- package/src/popup-service.ts +168 -0
- package/src/popup.ts +192 -0
- package/src/register.ts +228 -0
- package/src/sign.ts +280 -0
- package/src/types.ts +149 -0
- package/tsconfig.json +9 -0
- package/tsup.config.ts +11 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,892 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
P256_HALF_N: () => import_passkey_manager4.P256_HALF_N,
|
|
24
|
+
P256_N: () => import_passkey_manager4.P256_N,
|
|
25
|
+
PASSKEY_POPUP_CHANNEL: () => PASSKEY_POPUP_CHANNEL,
|
|
26
|
+
PASSKEY_POPUP_PATH: () => PASSKEY_POPUP_PATH,
|
|
27
|
+
PASSKEY_POPUP_READY_EVENT: () => PASSKEY_POPUP_READY_EVENT,
|
|
28
|
+
PASSKEY_POPUP_REQUEST_EVENT: () => PASSKEY_POPUP_REQUEST_EVENT,
|
|
29
|
+
PASSKEY_POPUP_RESPONSE_EVENT: () => PASSKEY_POPUP_RESPONSE_EVENT,
|
|
30
|
+
arrayBufferToBase64Url: () => import_passkey_manager5.arrayBufferToBase64Url,
|
|
31
|
+
base64UrlToArrayBuffer: () => import_passkey_manager5.base64UrlToArrayBuffer,
|
|
32
|
+
base64UrlToBytes: () => import_passkey_manager5.base64UrlToBytes,
|
|
33
|
+
bigIntToBytesBE: () => import_passkey_manager4.bigIntToBytesBE,
|
|
34
|
+
buildStoredPasskeyResult: () => buildStoredPasskeyResult,
|
|
35
|
+
buildSuccessResponse: () => buildSuccessResponse,
|
|
36
|
+
bytesEqual: () => import_passkey_manager5.bytesEqual,
|
|
37
|
+
bytesToBase64Url: () => import_passkey_manager5.bytesToBase64Url,
|
|
38
|
+
bytesToBigIntBE: () => import_passkey_manager4.bytesToBigIntBE,
|
|
39
|
+
bytesToHex: () => import_passkey_manager5.bytesToHex,
|
|
40
|
+
closePopup: () => closePopup,
|
|
41
|
+
compareBytes: () => import_passkey_manager5.compareBytes,
|
|
42
|
+
decodeChallenge: () => decodeChallenge,
|
|
43
|
+
getCachedPasskeyClientCapabilities: () => getCachedPasskeyClientCapabilities,
|
|
44
|
+
getPasskeyClientCapabilities: () => getPasskeyClientCapabilities,
|
|
45
|
+
getPopupDisplayInfo: () => getPopupDisplayInfo,
|
|
46
|
+
getResponseError: () => getResponseError,
|
|
47
|
+
hexToBytes: () => import_passkey_manager5.hexToBytes,
|
|
48
|
+
isInIframe: () => isInIframe,
|
|
49
|
+
isWebAuthnSupported: () => isWebAuthnSupported,
|
|
50
|
+
normalizeLowS: () => import_passkey_manager4.normalizeLowS,
|
|
51
|
+
normalizeSignatureComponent: () => import_passkey_manager4.normalizeSignatureComponent,
|
|
52
|
+
openPasskeyPopupWindow: () => openPasskeyPopupWindow,
|
|
53
|
+
parseDerSignature: () => import_passkey_manager4.parseDerSignature,
|
|
54
|
+
preloadPasskeyClientCapabilities: () => preloadPasskeyClientCapabilities,
|
|
55
|
+
registerPasskey: () => registerPasskey,
|
|
56
|
+
requestPasskeyPopup: () => requestPasskeyPopup,
|
|
57
|
+
shouldUsePasskeyPopup: () => shouldUsePasskeyPopup,
|
|
58
|
+
signWithDiscoverablePasskey: () => signWithDiscoverablePasskey,
|
|
59
|
+
signWithPasskey: () => signWithPasskey,
|
|
60
|
+
signWithPreferredPasskey: () => signWithPreferredPasskey,
|
|
61
|
+
signWithStoredPasskey: () => signWithStoredPasskey,
|
|
62
|
+
toPopupSigningResult: () => toPopupSigningResult,
|
|
63
|
+
uniqueAccounts: () => import_passkey_manager5.uniqueAccounts
|
|
64
|
+
});
|
|
65
|
+
module.exports = __toCommonJS(src_exports);
|
|
66
|
+
|
|
67
|
+
// src/register.ts
|
|
68
|
+
var import_passkey_manager = require("@thru/passkey-manager");
|
|
69
|
+
|
|
70
|
+
// src/capabilities.ts
|
|
71
|
+
var DEBUG = typeof process !== "undefined" && process.env?.NEXT_PUBLIC_PASSKEY_DEBUG === "1";
|
|
72
|
+
var cachedClientCapabilities;
|
|
73
|
+
var clientCapabilitiesPromise = null;
|
|
74
|
+
function isWebAuthnSupported() {
|
|
75
|
+
const supported = typeof window !== "undefined" && typeof window.PublicKeyCredential !== "undefined" && typeof navigator.credentials !== "undefined";
|
|
76
|
+
if (DEBUG) {
|
|
77
|
+
console.log("[Passkey] WebAuthn support check:", {
|
|
78
|
+
window: typeof window !== "undefined",
|
|
79
|
+
PublicKeyCredential: typeof window !== "undefined" && typeof window.PublicKeyCredential !== "undefined",
|
|
80
|
+
credentials: typeof window !== "undefined" && typeof navigator !== "undefined" && typeof navigator.credentials !== "undefined",
|
|
81
|
+
supported
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return supported;
|
|
85
|
+
}
|
|
86
|
+
async function fetchPasskeyClientCapabilities() {
|
|
87
|
+
if (typeof window === "undefined" || typeof window.PublicKeyCredential === "undefined") {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const getClientCapabilities = window.PublicKeyCredential.getClientCapabilities;
|
|
91
|
+
if (typeof getClientCapabilities !== "function") {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
const capabilities = await getClientCapabilities.call(window.PublicKeyCredential);
|
|
96
|
+
if (DEBUG) {
|
|
97
|
+
console.log("[Passkey] WebAuthn client capabilities:", capabilities);
|
|
98
|
+
}
|
|
99
|
+
return capabilities ?? null;
|
|
100
|
+
} catch (error) {
|
|
101
|
+
if (DEBUG) {
|
|
102
|
+
console.warn("[Passkey] Failed to read client capabilities:", error);
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function preloadPasskeyClientCapabilities() {
|
|
108
|
+
if (cachedClientCapabilities !== void 0 || clientCapabilitiesPromise) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
clientCapabilitiesPromise = fetchPasskeyClientCapabilities().then((capabilities) => {
|
|
112
|
+
cachedClientCapabilities = capabilities;
|
|
113
|
+
return capabilities;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
async function getPasskeyClientCapabilities() {
|
|
117
|
+
if (cachedClientCapabilities !== void 0) {
|
|
118
|
+
return cachedClientCapabilities;
|
|
119
|
+
}
|
|
120
|
+
if (!clientCapabilitiesPromise) {
|
|
121
|
+
preloadPasskeyClientCapabilities();
|
|
122
|
+
}
|
|
123
|
+
if (!clientCapabilitiesPromise) {
|
|
124
|
+
cachedClientCapabilities = null;
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
const capabilities = await clientCapabilitiesPromise;
|
|
128
|
+
cachedClientCapabilities = capabilities;
|
|
129
|
+
return capabilities;
|
|
130
|
+
}
|
|
131
|
+
function getCachedPasskeyClientCapabilities() {
|
|
132
|
+
return cachedClientCapabilities;
|
|
133
|
+
}
|
|
134
|
+
function isInIframe() {
|
|
135
|
+
if (typeof window === "undefined") {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
return window.self !== window.top;
|
|
140
|
+
} catch {
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
async function shouldUsePasskeyPopup(action) {
|
|
145
|
+
if (!isInIframe()) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
const mode = await getPasskeyPromptMode(action);
|
|
149
|
+
return mode === "popup";
|
|
150
|
+
}
|
|
151
|
+
function getPermissionsPolicyAllowsFeature(feature) {
|
|
152
|
+
if (typeof document === "undefined") {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
const policy = document.permissionsPolicy;
|
|
156
|
+
const featurePolicy = document.featurePolicy;
|
|
157
|
+
const allowsFeature = policy?.allowsFeature || featurePolicy?.allowsFeature;
|
|
158
|
+
if (typeof allowsFeature !== "function") {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
return allowsFeature(feature);
|
|
163
|
+
} catch {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function getCachedPromptMode(action) {
|
|
168
|
+
if (!isInIframe()) {
|
|
169
|
+
return "inline";
|
|
170
|
+
}
|
|
171
|
+
if (cachedClientCapabilities === void 0 && !clientCapabilitiesPromise) {
|
|
172
|
+
preloadPasskeyClientCapabilities();
|
|
173
|
+
}
|
|
174
|
+
const feature = action === "create" ? "publickey-credentials-create" : "publickey-credentials-get";
|
|
175
|
+
const policyAllows = getPermissionsPolicyAllowsFeature(feature);
|
|
176
|
+
const capabilities = getCachedPasskeyClientCapabilities();
|
|
177
|
+
const supportsInline = capabilities?.passkeyPlatformAuthenticator === true || capabilities?.userVerifyingPlatformAuthenticator === true;
|
|
178
|
+
if (policyAllows === false) {
|
|
179
|
+
return "popup";
|
|
180
|
+
}
|
|
181
|
+
if (capabilities === void 0) {
|
|
182
|
+
return "unknown";
|
|
183
|
+
}
|
|
184
|
+
if (!supportsInline) {
|
|
185
|
+
return "popup";
|
|
186
|
+
}
|
|
187
|
+
return "inline";
|
|
188
|
+
}
|
|
189
|
+
async function getPasskeyPromptMode(action) {
|
|
190
|
+
if (!isInIframe()) {
|
|
191
|
+
return "inline";
|
|
192
|
+
}
|
|
193
|
+
const feature = action === "create" ? "publickey-credentials-create" : "publickey-credentials-get";
|
|
194
|
+
const policyAllows = getPermissionsPolicyAllowsFeature(feature);
|
|
195
|
+
const capabilities = await getPasskeyClientCapabilities();
|
|
196
|
+
const supportsInline = capabilities?.passkeyPlatformAuthenticator === true || capabilities?.userVerifyingPlatformAuthenticator === true;
|
|
197
|
+
if (DEBUG) {
|
|
198
|
+
console.log("[Passkey] Prompt mode check:", {
|
|
199
|
+
action,
|
|
200
|
+
policyAllows,
|
|
201
|
+
supportsInline,
|
|
202
|
+
capabilities
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
if (!supportsInline) {
|
|
206
|
+
return "popup";
|
|
207
|
+
}
|
|
208
|
+
if (policyAllows === false) {
|
|
209
|
+
return "popup";
|
|
210
|
+
}
|
|
211
|
+
return "inline";
|
|
212
|
+
}
|
|
213
|
+
function maybePreopenPopup(action, openPopupFn) {
|
|
214
|
+
const cachedMode = getCachedPromptMode(action);
|
|
215
|
+
if (cachedMode !== "popup") {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
try {
|
|
219
|
+
return openPopupFn();
|
|
220
|
+
} catch {
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function shouldFallbackToPopup(error) {
|
|
225
|
+
if (!isInIframe()) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
const name = error && typeof error === "object" && "name" in error ? String(error.name) : "";
|
|
229
|
+
const message = error && typeof error === "object" && "message" in error ? String(error.message) : "";
|
|
230
|
+
const normalized = `${name} ${message}`.toLowerCase();
|
|
231
|
+
if (normalized.includes("cancel") || normalized.includes("canceled") || normalized.includes("cancelled") || normalized.includes("user canceled") || normalized.includes("user cancelled") || normalized.includes("aborted")) {
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
if (normalized.includes("securityerror")) {
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
if (normalized.includes("notallowederror")) {
|
|
238
|
+
if (normalized.includes("permission") || normalized.includes("policy") || normalized.includes("iframe") || normalized.includes("frame")) {
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// src/popup.ts
|
|
246
|
+
var PASSKEY_POPUP_PATH = "/passkey/popup";
|
|
247
|
+
var PASSKEY_POPUP_READY_EVENT = "thru:passkey-popup-ready";
|
|
248
|
+
var PASSKEY_POPUP_REQUEST_EVENT = "thru:passkey-popup-request";
|
|
249
|
+
var PASSKEY_POPUP_RESPONSE_EVENT = "thru:passkey-popup-response";
|
|
250
|
+
var PASSKEY_POPUP_CHANNEL = "thru:passkey-popup-channel";
|
|
251
|
+
var PASSKEY_POPUP_TIMEOUT_MS = 6e4;
|
|
252
|
+
function closePopup(popup) {
|
|
253
|
+
if (popup && !popup.closed) {
|
|
254
|
+
popup.close();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function openPasskeyPopupWindow() {
|
|
258
|
+
const popupUrl = new URL(PASSKEY_POPUP_PATH, window.location.origin).toString();
|
|
259
|
+
const popup = window.open(
|
|
260
|
+
popupUrl,
|
|
261
|
+
"thru_passkey_popup",
|
|
262
|
+
"popup=yes,width=440,height=640"
|
|
263
|
+
);
|
|
264
|
+
if (!popup) {
|
|
265
|
+
throw new Error("Passkey popup was blocked");
|
|
266
|
+
}
|
|
267
|
+
return popup;
|
|
268
|
+
}
|
|
269
|
+
function createPopupRequestId() {
|
|
270
|
+
const rand = Math.random().toString(36).slice(2, 10);
|
|
271
|
+
return `passkey_${Date.now()}_${rand}`;
|
|
272
|
+
}
|
|
273
|
+
async function requestPasskeyPopup(action, payload, preopenedPopup) {
|
|
274
|
+
if (typeof window === "undefined") {
|
|
275
|
+
throw new Error("Passkey popup is only available in the browser");
|
|
276
|
+
}
|
|
277
|
+
const requestId = createPopupRequestId();
|
|
278
|
+
const targetOrigin = window.location.origin;
|
|
279
|
+
let popup = preopenedPopup ?? null;
|
|
280
|
+
const channel = typeof BroadcastChannel !== "undefined" ? new BroadcastChannel(PASSKEY_POPUP_CHANNEL) : null;
|
|
281
|
+
return new Promise((resolve, reject) => {
|
|
282
|
+
let timeout = null;
|
|
283
|
+
let closePoll = null;
|
|
284
|
+
let requestSent = false;
|
|
285
|
+
const cleanup = () => {
|
|
286
|
+
if (timeout) {
|
|
287
|
+
clearTimeout(timeout);
|
|
288
|
+
timeout = null;
|
|
289
|
+
}
|
|
290
|
+
if (closePoll) {
|
|
291
|
+
clearInterval(closePoll);
|
|
292
|
+
closePoll = null;
|
|
293
|
+
}
|
|
294
|
+
window.removeEventListener("message", handleMessage);
|
|
295
|
+
if (channel) {
|
|
296
|
+
channel.removeEventListener("message", handleChannelMessage);
|
|
297
|
+
channel.close();
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
const sendRequest = (viaChannel) => {
|
|
301
|
+
if (requestSent) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
requestSent = true;
|
|
305
|
+
const request = {
|
|
306
|
+
type: PASSKEY_POPUP_REQUEST_EVENT,
|
|
307
|
+
requestId,
|
|
308
|
+
action,
|
|
309
|
+
payload
|
|
310
|
+
};
|
|
311
|
+
if (viaChannel) {
|
|
312
|
+
channel?.postMessage(request);
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
popup?.postMessage(request, targetOrigin);
|
|
316
|
+
};
|
|
317
|
+
const handleResponse = (data) => {
|
|
318
|
+
if (data.requestId !== requestId) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
cleanup();
|
|
322
|
+
if (popup && !popup.closed) {
|
|
323
|
+
popup.close();
|
|
324
|
+
}
|
|
325
|
+
if (data.success) {
|
|
326
|
+
resolve(data.result);
|
|
327
|
+
} else {
|
|
328
|
+
const err = new Error(data.error?.message || "Passkey popup failed");
|
|
329
|
+
if (data.error?.name) {
|
|
330
|
+
err.name = data.error.name;
|
|
331
|
+
}
|
|
332
|
+
reject(err);
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
const handleMessage = (event) => {
|
|
336
|
+
if (event.origin !== targetOrigin) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
const data = event.data;
|
|
340
|
+
if (!data || typeof data !== "object") {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
if (data.type === PASSKEY_POPUP_READY_EVENT) {
|
|
344
|
+
if (popup && event.source !== popup) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
sendRequest(false);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
if (data.type === PASSKEY_POPUP_RESPONSE_EVENT && "requestId" in data) {
|
|
351
|
+
handleResponse(data);
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
window.addEventListener("message", handleMessage);
|
|
355
|
+
const handleChannelMessage = (event) => {
|
|
356
|
+
const data = event.data;
|
|
357
|
+
if (!data || typeof data !== "object") {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (data.type === PASSKEY_POPUP_READY_EVENT) {
|
|
361
|
+
sendRequest(true);
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
if (data.type === PASSKEY_POPUP_RESPONSE_EVENT && "requestId" in data) {
|
|
365
|
+
handleResponse(data);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
if (channel) {
|
|
369
|
+
channel.addEventListener("message", handleChannelMessage);
|
|
370
|
+
}
|
|
371
|
+
if (!popup) {
|
|
372
|
+
try {
|
|
373
|
+
popup = openPasskeyPopupWindow();
|
|
374
|
+
} catch (error) {
|
|
375
|
+
cleanup();
|
|
376
|
+
reject(error);
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
timeout = setTimeout(() => {
|
|
381
|
+
cleanup();
|
|
382
|
+
try {
|
|
383
|
+
popup?.close();
|
|
384
|
+
} catch {
|
|
385
|
+
}
|
|
386
|
+
reject(new Error("Passkey popup timed out"));
|
|
387
|
+
}, PASSKEY_POPUP_TIMEOUT_MS);
|
|
388
|
+
closePoll = setInterval(() => {
|
|
389
|
+
if (popup && popup.closed) {
|
|
390
|
+
cleanup();
|
|
391
|
+
reject(new Error("Passkey popup was closed"));
|
|
392
|
+
}
|
|
393
|
+
}, 250);
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// src/register.ts
|
|
398
|
+
async function registerPasskey(alias, userId, rpId) {
|
|
399
|
+
if (!isWebAuthnSupported()) {
|
|
400
|
+
throw new Error("WebAuthn is not supported in this browser");
|
|
401
|
+
}
|
|
402
|
+
return runWithPromptMode(
|
|
403
|
+
"create",
|
|
404
|
+
() => registerPasskeyInline(alias, userId, rpId),
|
|
405
|
+
(preopenedPopup) => registerPasskeyViaPopup(alias, userId, rpId, preopenedPopup)
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
async function runWithPromptMode(action, inlineFn, popupFn) {
|
|
409
|
+
const preopenedPopup = maybePreopenPopup(action, openPasskeyPopupWindow);
|
|
410
|
+
const promptMode = await getPasskeyPromptMode(action);
|
|
411
|
+
if (promptMode === "popup") {
|
|
412
|
+
return popupFn(preopenedPopup);
|
|
413
|
+
}
|
|
414
|
+
closePopup(preopenedPopup);
|
|
415
|
+
try {
|
|
416
|
+
return await inlineFn();
|
|
417
|
+
} catch (error) {
|
|
418
|
+
if (shouldFallbackToPopup(error)) {
|
|
419
|
+
return popupFn();
|
|
420
|
+
}
|
|
421
|
+
throw error;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
async function registerPasskeyInline(alias, userId, rpId) {
|
|
425
|
+
const rpName = "Thru Wallet";
|
|
426
|
+
const userIdBytes = new TextEncoder().encode(userId);
|
|
427
|
+
const userIdBuffer = userIdBytes.slice(0, 64);
|
|
428
|
+
const challenge = crypto.getRandomValues(new Uint8Array(32));
|
|
429
|
+
const createOptions = {
|
|
430
|
+
challenge,
|
|
431
|
+
rp: {
|
|
432
|
+
id: rpId,
|
|
433
|
+
name: rpName
|
|
434
|
+
},
|
|
435
|
+
user: {
|
|
436
|
+
id: userIdBuffer,
|
|
437
|
+
name: alias,
|
|
438
|
+
displayName: alias
|
|
439
|
+
},
|
|
440
|
+
pubKeyCredParams: [
|
|
441
|
+
{ type: "public-key", alg: -7 }
|
|
442
|
+
],
|
|
443
|
+
authenticatorSelection: {
|
|
444
|
+
authenticatorAttachment: "platform",
|
|
445
|
+
userVerification: "required",
|
|
446
|
+
residentKey: "required",
|
|
447
|
+
requireResidentKey: true
|
|
448
|
+
},
|
|
449
|
+
attestation: "none",
|
|
450
|
+
timeout: 6e4
|
|
451
|
+
};
|
|
452
|
+
const credential = await navigator.credentials.create({
|
|
453
|
+
publicKey: createOptions
|
|
454
|
+
});
|
|
455
|
+
if (!credential) {
|
|
456
|
+
throw new Error("Passkey registration was cancelled");
|
|
457
|
+
}
|
|
458
|
+
const response = credential.response;
|
|
459
|
+
const { x, y } = extractP256PublicKey(response);
|
|
460
|
+
return {
|
|
461
|
+
credentialId: (0, import_passkey_manager.arrayBufferToBase64Url)(credential.rawId),
|
|
462
|
+
publicKeyX: (0, import_passkey_manager.bytesToHex)(x),
|
|
463
|
+
publicKeyY: (0, import_passkey_manager.bytesToHex)(y),
|
|
464
|
+
rpId
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
async function registerPasskeyViaPopup(alias, userId, rpId, preopenedPopup) {
|
|
468
|
+
const result = await requestPasskeyPopup(
|
|
469
|
+
"create",
|
|
470
|
+
{ alias, userId, rpId },
|
|
471
|
+
preopenedPopup
|
|
472
|
+
);
|
|
473
|
+
return result;
|
|
474
|
+
}
|
|
475
|
+
function extractP256PublicKey(response) {
|
|
476
|
+
if (typeof response.getPublicKey === "function") {
|
|
477
|
+
const spkiKey = response.getPublicKey();
|
|
478
|
+
if (spkiKey) {
|
|
479
|
+
return extractFromSpki(new Uint8Array(spkiKey));
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
if (typeof response.getAuthenticatorData === "function") {
|
|
483
|
+
const authData = new Uint8Array(response.getAuthenticatorData());
|
|
484
|
+
return extractFromAuthenticatorData(authData);
|
|
485
|
+
}
|
|
486
|
+
throw new Error("Unable to extract public key: browser does not support required WebAuthn methods");
|
|
487
|
+
}
|
|
488
|
+
function extractFromSpki(spki) {
|
|
489
|
+
const pointStart = spki.length - 65;
|
|
490
|
+
if (spki[pointStart] !== 4) {
|
|
491
|
+
throw new Error("Invalid SPKI format: expected uncompressed point");
|
|
492
|
+
}
|
|
493
|
+
const x = spki.slice(pointStart + 1, pointStart + 33);
|
|
494
|
+
const y = spki.slice(pointStart + 33, pointStart + 65);
|
|
495
|
+
if (x.length !== 32 || y.length !== 32) {
|
|
496
|
+
throw new Error("Invalid SPKI format: incorrect coordinate length");
|
|
497
|
+
}
|
|
498
|
+
return { x, y };
|
|
499
|
+
}
|
|
500
|
+
function extractFromAuthenticatorData(authData) {
|
|
501
|
+
const rpIdHashLength = 32;
|
|
502
|
+
const flagsLength = 1;
|
|
503
|
+
const counterLength = 4;
|
|
504
|
+
const offset = rpIdHashLength + flagsLength + counterLength;
|
|
505
|
+
const aaguidLength = 16;
|
|
506
|
+
const credIdLenOffset = offset + aaguidLength;
|
|
507
|
+
const credIdLength = authData[credIdLenOffset] << 8 | authData[credIdLenOffset + 1];
|
|
508
|
+
const coseKeyOffset = credIdLenOffset + 2 + credIdLength;
|
|
509
|
+
const coseKey = authData.slice(coseKeyOffset);
|
|
510
|
+
return extractFromCoseKey(coseKey);
|
|
511
|
+
}
|
|
512
|
+
function extractFromCoseKey(coseKey) {
|
|
513
|
+
const mapStart = coseKey[0];
|
|
514
|
+
if (mapStart !== 165 && mapStart !== 164) {
|
|
515
|
+
throw new Error("Invalid COSE key format");
|
|
516
|
+
}
|
|
517
|
+
let offset = 1;
|
|
518
|
+
let x = null;
|
|
519
|
+
let y = null;
|
|
520
|
+
while (offset < coseKey.length) {
|
|
521
|
+
const key = coseKey[offset++];
|
|
522
|
+
const valueType = coseKey[offset++];
|
|
523
|
+
if (key === 33) {
|
|
524
|
+
const length = valueType & 31;
|
|
525
|
+
x = coseKey.slice(offset, offset + length);
|
|
526
|
+
offset += length;
|
|
527
|
+
continue;
|
|
528
|
+
}
|
|
529
|
+
if (key === 34) {
|
|
530
|
+
const length = valueType & 31;
|
|
531
|
+
y = coseKey.slice(offset, offset + length);
|
|
532
|
+
offset += length;
|
|
533
|
+
continue;
|
|
534
|
+
}
|
|
535
|
+
if (valueType >= 64 && valueType <= 95) {
|
|
536
|
+
const length = valueType & 31;
|
|
537
|
+
offset += length;
|
|
538
|
+
continue;
|
|
539
|
+
}
|
|
540
|
+
if (valueType === 1 || valueType === 2 || valueType === 3) {
|
|
541
|
+
continue;
|
|
542
|
+
}
|
|
543
|
+
if (valueType >= 24 && valueType <= 27) {
|
|
544
|
+
const size = 1 << valueType - 24;
|
|
545
|
+
offset += size;
|
|
546
|
+
continue;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
if (!x || !y) {
|
|
550
|
+
throw new Error("Failed to extract P-256 public key from COSE data");
|
|
551
|
+
}
|
|
552
|
+
if (x.length !== 32 || y.length !== 32) {
|
|
553
|
+
throw new Error("Invalid COSE key: incorrect coordinate length");
|
|
554
|
+
}
|
|
555
|
+
return { x, y };
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
// src/sign.ts
|
|
559
|
+
var import_passkey_manager2 = require("@thru/passkey-manager");
|
|
560
|
+
async function signWithPasskey(credentialId, challenge, rpId) {
|
|
561
|
+
if (!isWebAuthnSupported()) {
|
|
562
|
+
throw new Error("WebAuthn is not supported in this browser");
|
|
563
|
+
}
|
|
564
|
+
return runWithPromptMode2(
|
|
565
|
+
"get",
|
|
566
|
+
() => signWithPasskeyInline(credentialId, challenge, rpId),
|
|
567
|
+
(preopenedPopup) => signWithPasskeyViaPopup(credentialId, challenge, rpId, preopenedPopup)
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
async function signWithStoredPasskey(challenge, rpId, preferredPasskey, allPasskeys, context) {
|
|
571
|
+
if (!isWebAuthnSupported()) {
|
|
572
|
+
throw new Error("WebAuthn is not supported in this browser");
|
|
573
|
+
}
|
|
574
|
+
const preopenedPopup = maybePreopenPopup("get", openPasskeyPopupWindow);
|
|
575
|
+
const promptMode = await getPasskeyPromptMode("get");
|
|
576
|
+
const storedPasskey = preferredPasskey;
|
|
577
|
+
const canUsePopup = isInIframe();
|
|
578
|
+
if (promptMode === "popup" || canUsePopup && !storedPasskey) {
|
|
579
|
+
return requestStoredPasskeyPopup(challenge, preopenedPopup, context);
|
|
580
|
+
}
|
|
581
|
+
closePopup(preopenedPopup);
|
|
582
|
+
try {
|
|
583
|
+
if (storedPasskey) {
|
|
584
|
+
const result = await signWithPasskeyInline(
|
|
585
|
+
storedPasskey.credentialId,
|
|
586
|
+
challenge,
|
|
587
|
+
storedPasskey.rpId
|
|
588
|
+
);
|
|
589
|
+
return {
|
|
590
|
+
...result,
|
|
591
|
+
passkey: storedPasskey
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
const discoverable = await signWithDiscoverablePasskey(challenge, rpId);
|
|
595
|
+
const matchingPasskey = allPasskeys.find((p) => p.credentialId === discoverable.credentialId) ?? null;
|
|
596
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
597
|
+
const passkey = matchingPasskey ?? {
|
|
598
|
+
credentialId: discoverable.credentialId,
|
|
599
|
+
publicKeyX: "",
|
|
600
|
+
publicKeyY: "",
|
|
601
|
+
rpId: discoverable.rpId,
|
|
602
|
+
createdAt: now,
|
|
603
|
+
lastUsedAt: now
|
|
604
|
+
};
|
|
605
|
+
return {
|
|
606
|
+
signature: discoverable.signature,
|
|
607
|
+
authenticatorData: discoverable.authenticatorData,
|
|
608
|
+
clientDataJSON: discoverable.clientDataJSON,
|
|
609
|
+
signatureR: discoverable.signatureR,
|
|
610
|
+
signatureS: discoverable.signatureS,
|
|
611
|
+
passkey
|
|
612
|
+
};
|
|
613
|
+
} catch (error) {
|
|
614
|
+
if (canUsePopup && shouldFallbackToPopup(error)) {
|
|
615
|
+
return requestStoredPasskeyPopup(challenge, void 0, context);
|
|
616
|
+
}
|
|
617
|
+
throw error;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
async function signWithDiscoverablePasskey(challenge, rpId) {
|
|
621
|
+
if (!isWebAuthnSupported()) {
|
|
622
|
+
throw new Error("WebAuthn is not supported in this browser");
|
|
623
|
+
}
|
|
624
|
+
const resolvedRpId = rpId;
|
|
625
|
+
const result = await signWithPasskeyAssertion(challenge, resolvedRpId);
|
|
626
|
+
return {
|
|
627
|
+
signature: result.signature,
|
|
628
|
+
authenticatorData: result.authenticatorData,
|
|
629
|
+
clientDataJSON: result.clientDataJSON,
|
|
630
|
+
signatureR: result.signatureR,
|
|
631
|
+
signatureS: result.signatureS,
|
|
632
|
+
credentialId: result.credentialId,
|
|
633
|
+
rpId: resolvedRpId
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
async function runWithPromptMode2(action, inlineFn, popupFn) {
|
|
637
|
+
const preopenedPopup = maybePreopenPopup(action, openPasskeyPopupWindow);
|
|
638
|
+
const promptMode = await getPasskeyPromptMode(action);
|
|
639
|
+
if (promptMode === "popup") {
|
|
640
|
+
return popupFn(preopenedPopup);
|
|
641
|
+
}
|
|
642
|
+
closePopup(preopenedPopup);
|
|
643
|
+
try {
|
|
644
|
+
return await inlineFn();
|
|
645
|
+
} catch (error) {
|
|
646
|
+
if (shouldFallbackToPopup(error)) {
|
|
647
|
+
return popupFn();
|
|
648
|
+
}
|
|
649
|
+
throw error;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
async function signWithPasskeyInline(credentialId, challenge, rpId) {
|
|
653
|
+
const result = await signWithPasskeyAssertion(challenge, rpId, credentialId);
|
|
654
|
+
return {
|
|
655
|
+
signature: result.signature,
|
|
656
|
+
authenticatorData: result.authenticatorData,
|
|
657
|
+
clientDataJSON: result.clientDataJSON,
|
|
658
|
+
signatureR: result.signatureR,
|
|
659
|
+
signatureS: result.signatureS
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
async function signWithPasskeyAssertion(challenge, rpId, credentialId) {
|
|
663
|
+
const challengeBytes = new Uint8Array(challenge);
|
|
664
|
+
const getOptions = {
|
|
665
|
+
challenge: challengeBytes,
|
|
666
|
+
rpId,
|
|
667
|
+
userVerification: "required",
|
|
668
|
+
timeout: 6e4
|
|
669
|
+
};
|
|
670
|
+
if (credentialId) {
|
|
671
|
+
const credentialIdBuffer = (0, import_passkey_manager2.base64UrlToArrayBuffer)(credentialId);
|
|
672
|
+
getOptions.allowCredentials = [
|
|
673
|
+
{
|
|
674
|
+
type: "public-key",
|
|
675
|
+
id: credentialIdBuffer,
|
|
676
|
+
transports: ["internal", "hybrid", "usb", "ble", "nfc"]
|
|
677
|
+
}
|
|
678
|
+
];
|
|
679
|
+
}
|
|
680
|
+
const assertion = await navigator.credentials.get({
|
|
681
|
+
publicKey: getOptions
|
|
682
|
+
});
|
|
683
|
+
if (!assertion) {
|
|
684
|
+
throw new Error("Passkey authentication was cancelled");
|
|
685
|
+
}
|
|
686
|
+
const response = assertion.response;
|
|
687
|
+
const signature = new Uint8Array(response.signature);
|
|
688
|
+
let { r, s } = (0, import_passkey_manager2.parseDerSignature)(signature);
|
|
689
|
+
s = (0, import_passkey_manager2.normalizeLowS)(s);
|
|
690
|
+
return {
|
|
691
|
+
signature: new Uint8Array([...r, ...s]),
|
|
692
|
+
authenticatorData: new Uint8Array(response.authenticatorData),
|
|
693
|
+
clientDataJSON: new Uint8Array(response.clientDataJSON),
|
|
694
|
+
signatureR: r,
|
|
695
|
+
signatureS: s,
|
|
696
|
+
credentialId: (0, import_passkey_manager2.arrayBufferToBase64Url)(assertion.rawId)
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
async function signWithPasskeyViaPopup(credentialId, challenge, rpId, preopenedPopup) {
|
|
700
|
+
const result = await requestPasskeyPopup(
|
|
701
|
+
"get",
|
|
702
|
+
{
|
|
703
|
+
credentialId,
|
|
704
|
+
challengeBase64Url: (0, import_passkey_manager2.bytesToBase64Url)(challenge),
|
|
705
|
+
rpId
|
|
706
|
+
},
|
|
707
|
+
preopenedPopup
|
|
708
|
+
);
|
|
709
|
+
return decodePopupSigningResult(result);
|
|
710
|
+
}
|
|
711
|
+
async function requestStoredPasskeyPopup(challenge, preopenedPopup, context) {
|
|
712
|
+
const result = await requestPasskeyPopup(
|
|
713
|
+
"getStored",
|
|
714
|
+
{
|
|
715
|
+
challengeBase64Url: (0, import_passkey_manager2.bytesToBase64Url)(challenge),
|
|
716
|
+
context
|
|
717
|
+
},
|
|
718
|
+
preopenedPopup
|
|
719
|
+
);
|
|
720
|
+
return decodePopupStoredSigningResult(result);
|
|
721
|
+
}
|
|
722
|
+
function decodePopupSigningResult(result) {
|
|
723
|
+
return {
|
|
724
|
+
signature: (0, import_passkey_manager2.base64UrlToBytes)(result.signatureBase64Url),
|
|
725
|
+
authenticatorData: (0, import_passkey_manager2.base64UrlToBytes)(result.authenticatorDataBase64Url),
|
|
726
|
+
clientDataJSON: (0, import_passkey_manager2.base64UrlToBytes)(result.clientDataJSONBase64Url),
|
|
727
|
+
signatureR: (0, import_passkey_manager2.base64UrlToBytes)(result.signatureRBase64Url),
|
|
728
|
+
signatureS: (0, import_passkey_manager2.base64UrlToBytes)(result.signatureSBase64Url)
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
function decodePopupStoredSigningResult(result) {
|
|
732
|
+
return {
|
|
733
|
+
...decodePopupSigningResult(result),
|
|
734
|
+
passkey: result.passkey,
|
|
735
|
+
accounts: result.accounts
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
// src/index.ts
|
|
740
|
+
var import_passkey_manager4 = require("@thru/passkey-manager");
|
|
741
|
+
var import_passkey_manager5 = require("@thru/passkey-manager");
|
|
742
|
+
|
|
743
|
+
// src/popup-service.ts
|
|
744
|
+
var import_passkey_manager3 = require("@thru/passkey-manager");
|
|
745
|
+
function toPopupSigningResult(result) {
|
|
746
|
+
return {
|
|
747
|
+
signatureBase64Url: (0, import_passkey_manager3.bytesToBase64Url)(result.signature),
|
|
748
|
+
authenticatorDataBase64Url: (0, import_passkey_manager3.bytesToBase64Url)(result.authenticatorData),
|
|
749
|
+
clientDataJSONBase64Url: (0, import_passkey_manager3.bytesToBase64Url)(result.clientDataJSON),
|
|
750
|
+
signatureRBase64Url: (0, import_passkey_manager3.bytesToBase64Url)(result.signatureR),
|
|
751
|
+
signatureSBase64Url: (0, import_passkey_manager3.bytesToBase64Url)(result.signatureS)
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
function buildSuccessResponse(requestId, action, result) {
|
|
755
|
+
return {
|
|
756
|
+
type: PASSKEY_POPUP_RESPONSE_EVENT,
|
|
757
|
+
requestId,
|
|
758
|
+
action,
|
|
759
|
+
success: true,
|
|
760
|
+
result
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
function decodeChallenge(base64Url) {
|
|
764
|
+
return (0, import_passkey_manager3.base64UrlToBytes)(base64Url);
|
|
765
|
+
}
|
|
766
|
+
function getPopupDisplayInfo(context) {
|
|
767
|
+
const name = context?.appName || context?.origin || "A dApp";
|
|
768
|
+
const url = context?.appUrl || context?.origin;
|
|
769
|
+
const logoText = name.charAt(0).toUpperCase() || "A";
|
|
770
|
+
return {
|
|
771
|
+
name,
|
|
772
|
+
url,
|
|
773
|
+
imageUrl: context?.imageUrl,
|
|
774
|
+
logoText
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
function getResponseError(action, error) {
|
|
778
|
+
const { name, message } = normalizeError(error);
|
|
779
|
+
const actionLabel = `Popup ${action}`;
|
|
780
|
+
const messageText = message || "Passkey popup failed";
|
|
781
|
+
const detailedMessage = messageText.includes("Popup") ? messageText : `${actionLabel}: ${messageText}`;
|
|
782
|
+
return {
|
|
783
|
+
name,
|
|
784
|
+
message: detailedMessage
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
async function signWithPreferredPasskey(preferredPasskey, challenge, log) {
|
|
788
|
+
const resolvedRpId = preferredPasskey?.rpId ?? window.location.hostname;
|
|
789
|
+
if (preferredPasskey?.credentialId && preferredPasskey.rpId) {
|
|
790
|
+
try {
|
|
791
|
+
const storedResult = await signWithPasskey(
|
|
792
|
+
preferredPasskey.credentialId,
|
|
793
|
+
challenge,
|
|
794
|
+
preferredPasskey.rpId
|
|
795
|
+
);
|
|
796
|
+
return {
|
|
797
|
+
result: storedResult,
|
|
798
|
+
credentialId: preferredPasskey.credentialId,
|
|
799
|
+
rpId: preferredPasskey.rpId
|
|
800
|
+
};
|
|
801
|
+
} catch (error) {
|
|
802
|
+
if (!shouldFallbackToDiscoverable(error)) {
|
|
803
|
+
throw error;
|
|
804
|
+
}
|
|
805
|
+
if (log) {
|
|
806
|
+
log("stored passkey failed; falling back to discoverable prompt");
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
const discovered = await signWithDiscoverablePasskey(challenge, resolvedRpId);
|
|
811
|
+
return {
|
|
812
|
+
result: discovered,
|
|
813
|
+
credentialId: discovered.credentialId,
|
|
814
|
+
rpId: resolvedRpId
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
function buildStoredPasskeyResult(signed, preferredPasskey, profiles, accounts) {
|
|
818
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
819
|
+
const matchingPasskey = profiles.find((profile) => profile.passkey?.credentialId === signed.credentialId)?.passkey ?? null;
|
|
820
|
+
const passkey = matchingPasskey ?? {
|
|
821
|
+
credentialId: signed.credentialId,
|
|
822
|
+
publicKeyX: "",
|
|
823
|
+
publicKeyY: "",
|
|
824
|
+
rpId: signed.rpId,
|
|
825
|
+
label: preferredPasskey?.label,
|
|
826
|
+
createdAt: now,
|
|
827
|
+
lastUsedAt: now
|
|
828
|
+
};
|
|
829
|
+
return {
|
|
830
|
+
...toPopupSigningResult(signed.result),
|
|
831
|
+
passkey: matchingPasskey ? { ...passkey, lastUsedAt: now } : passkey,
|
|
832
|
+
accounts
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
function normalizeError(error) {
|
|
836
|
+
const name = error && typeof error === "object" && "name" in error ? String(error.name) : "";
|
|
837
|
+
const message = error && typeof error === "object" && "message" in error ? String(error.message) : "";
|
|
838
|
+
return {
|
|
839
|
+
name,
|
|
840
|
+
message,
|
|
841
|
+
normalized: `${name} ${message}`.toLowerCase()
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
function shouldFallbackToDiscoverable(error) {
|
|
845
|
+
const normalized = normalizeError(error).normalized;
|
|
846
|
+
return normalized.includes("notfounderror") || normalized.includes("notallowederror") || normalized.includes("securityerror");
|
|
847
|
+
}
|
|
848
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
849
|
+
0 && (module.exports = {
|
|
850
|
+
P256_HALF_N,
|
|
851
|
+
P256_N,
|
|
852
|
+
PASSKEY_POPUP_CHANNEL,
|
|
853
|
+
PASSKEY_POPUP_PATH,
|
|
854
|
+
PASSKEY_POPUP_READY_EVENT,
|
|
855
|
+
PASSKEY_POPUP_REQUEST_EVENT,
|
|
856
|
+
PASSKEY_POPUP_RESPONSE_EVENT,
|
|
857
|
+
arrayBufferToBase64Url,
|
|
858
|
+
base64UrlToArrayBuffer,
|
|
859
|
+
base64UrlToBytes,
|
|
860
|
+
bigIntToBytesBE,
|
|
861
|
+
buildStoredPasskeyResult,
|
|
862
|
+
buildSuccessResponse,
|
|
863
|
+
bytesEqual,
|
|
864
|
+
bytesToBase64Url,
|
|
865
|
+
bytesToBigIntBE,
|
|
866
|
+
bytesToHex,
|
|
867
|
+
closePopup,
|
|
868
|
+
compareBytes,
|
|
869
|
+
decodeChallenge,
|
|
870
|
+
getCachedPasskeyClientCapabilities,
|
|
871
|
+
getPasskeyClientCapabilities,
|
|
872
|
+
getPopupDisplayInfo,
|
|
873
|
+
getResponseError,
|
|
874
|
+
hexToBytes,
|
|
875
|
+
isInIframe,
|
|
876
|
+
isWebAuthnSupported,
|
|
877
|
+
normalizeLowS,
|
|
878
|
+
normalizeSignatureComponent,
|
|
879
|
+
openPasskeyPopupWindow,
|
|
880
|
+
parseDerSignature,
|
|
881
|
+
preloadPasskeyClientCapabilities,
|
|
882
|
+
registerPasskey,
|
|
883
|
+
requestPasskeyPopup,
|
|
884
|
+
shouldUsePasskeyPopup,
|
|
885
|
+
signWithDiscoverablePasskey,
|
|
886
|
+
signWithPasskey,
|
|
887
|
+
signWithPreferredPasskey,
|
|
888
|
+
signWithStoredPasskey,
|
|
889
|
+
toPopupSigningResult,
|
|
890
|
+
uniqueAccounts
|
|
891
|
+
});
|
|
892
|
+
//# sourceMappingURL=index.cjs.map
|