aboutsummaryrefslogtreecommitdiffstats
path: root/lib/passkey.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-28 15:16:20 -0800
committerAdam Soltys <[email protected]>2026-02-28 15:16:20 -0800
commit32f01e3e328db0006a55c6324625b49d60244b66 (patch)
treeb97866549b919964957365e1e05681e85af7021a /lib/passkey.ts
parenta1632ae402d11fdd7ffc360de97c55e0b4fad677 (diff)
downloadcoinos-server-32f01e3e328db0006a55c6324625b49d60244b66.tar.gz
coinos-server-32f01e3e328db0006a55c6324625b49d60244b66.zip
fix typescript issues
Diffstat (limited to 'lib/passkey.ts')
-rw-r--r--lib/passkey.ts13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/passkey.ts b/lib/passkey.ts
index 29b9b095..ff38b37b 100644
--- a/lib/passkey.ts
+++ b/lib/passkey.ts
@@ -4,9 +4,10 @@ import {
generateAuthenticationOptions,
verifyAuthenticationResponse,
} from "@simplewebauthn/server";
+// @ts-ignore
import type { AuthenticatorTransportFuture } from "@simplewebauthn/types";
import { db, g, s } from "$lib/db";
-import { fail, getUser } from "$lib/utils";
+import { fail } from "$lib/utils";
import { v4 } from "uuid";
const rpName = "coinos";
@@ -27,7 +28,7 @@ export async function generatePasskeyRegistration(user: any, origin: string) {
rpName,
rpID,
userName: user.username,
- userID: new TextEncoder().encode(user.id),
+ userID: new TextEncoder().encode(user.id) as any,
attestationType: "none",
excludeCredentials: passkeys.map((p: any) => ({
id: p.credentialID,
@@ -51,7 +52,7 @@ export async function verifyPasskeyRegistration(user: any, response: any, origin
const verification = await verifyRegistrationResponse({
response,
- expectedChallenge,
+ expectedChallenge: expectedChallenge as string,
expectedOrigin: origin,
expectedRPID: rpID,
});
@@ -108,15 +109,15 @@ export async function verifyPasskeyLogin(response: any, challengeId: string, ori
const verification = await verifyAuthenticationResponse({
response,
- expectedChallenge,
+ expectedChallenge: expectedChallenge as string,
expectedOrigin: origin,
expectedRPID: rpID,
credential: {
id: passkey.credentialID,
- publicKey: Buffer.from(passkey.credentialPublicKey, "base64url"),
+ publicKey: Buffer.from(passkey.credentialPublicKey, "base64url") as any,
counter: passkey.counter,
transports: passkey.transports as AuthenticatorTransportFuture[],
- },
+ } as any,
});
if (!verification.verified) fail("Passkey authentication failed");