aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-03-08 22:53:35 -0700
committerAdam Soltys <[email protected]>2026-03-08 22:53:35 -0700
commit3d8e0931ddc4ee08954543ec7678994efde04260 (patch)
tree0ad10a0632660e0ead6d75cabc71b13466826809 /lib
parent497b830751ed1e5eb25578682a3929b5a6f55398 (diff)
downloadcoinos-server-3d8e0931ddc4ee08954543ec7678994efde04260.tar.gz
coinos-server-3d8e0931ddc4ee08954543ec7678994efde04260.zip
accept android app origin for passkey verification
Diffstat (limited to 'lib')
-rw-r--r--lib/passkey.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/passkey.ts b/lib/passkey.ts
index 8a965c94..2875e388 100644
--- a/lib/passkey.ts
+++ b/lib/passkey.ts
@@ -11,6 +11,8 @@ import { fail } from "$lib/utils";
import { v4 } from "uuid";
const rpName = "coinos";
+const androidOrigin =
+ "android:apk-key-hash:DaYNHto1fsy7jrhOfRaDDy4HCRNqFo8H0gf3DmW7bOw";
function getRpID(origin: string) {
try {
@@ -20,6 +22,10 @@ function getRpID(origin: string) {
}
}
+function getExpectedOrigins(origin: string) {
+ return [origin, androidOrigin];
+}
+
export async function generatePasskeyRegistration(user: any, origin: string) {
const rpID = getRpID(origin);
const passkeys = user.passkeys || [];
@@ -53,7 +59,7 @@ export async function verifyPasskeyRegistration(user: any, response: any, origin
const verification = await verifyRegistrationResponse({
response,
expectedChallenge: expectedChallenge as string,
- expectedOrigin: origin,
+ expectedOrigin: getExpectedOrigins(origin),
expectedRPID: rpID,
});
@@ -110,7 +116,7 @@ export async function verifyPasskeyLogin(response: any, challengeId: string, ori
const verification = await verifyAuthenticationResponse({
response,
expectedChallenge: expectedChallenge as string,
- expectedOrigin: origin,
+ expectedOrigin: getExpectedOrigins(origin),
expectedRPID: rpID,
requireUserVerification: false,
credential: {