diff --git a/client/src/services/auth.ts b/client/src/services/auth.ts index 8624ab4..883b7c2 100644 --- a/client/src/services/auth.ts +++ b/client/src/services/auth.ts @@ -45,7 +45,7 @@ export function setActiveMasterKey(key: ArrayBuffer | null) { } // Convert string salt to 32-byte Uint8Array -const PRF_SALT = new TextEncoder().encode("KapteinsDaagboxPRFSaltForE2EKey") +const PRF_SALT = new TextEncoder().encode("KapteinsDaagboxPRFSaltForE2EKey_") export interface RegistrationResult { verified: boolean @@ -88,7 +88,11 @@ export async function registerUser(username: string): Promise { - // Log browser supported extensions to diagnose PRF availability - console.log( - 'Browser supported WebAuthn extensions:', - window.PublicKeyCredential && (window.PublicKeyCredential as any).getClientExtensionResults - ? (window.PublicKeyCredential as any).getClientExtensionResults() - : 'none' - ) + // Log browser WebAuthn capabilities to diagnose PRF availability + if (window.PublicKeyCredential && (window.PublicKeyCredential as any).getClientCapabilities) { + (window.PublicKeyCredential as any).getClientCapabilities().then((caps: any) => { + console.log('Browser WebAuthn client capabilities:', caps) + }).catch((err: any) => { + console.warn('Error reading WebAuthn client capabilities:', err) + }) + } else { + console.log('window.PublicKeyCredential.getClientCapabilities is not supported.') + } // 1. Get authentication options const optionsRes = await fetch(`${API_BASE}/login-options`, { diff --git a/server/src/routes/logbooks.ts b/server/src/routes/logbooks.ts index a4c502c..727cb52 100644 --- a/server/src/routes/logbooks.ts +++ b/server/src/routes/logbooks.ts @@ -46,7 +46,7 @@ router.get('/', async (req: any, res) => { // 2. Create a new logbook router.post('/', async (req: any, res) => { try { - const { id, encryptedTitle } = req.body + const { id, encryptedTitle, encryptedKey, iv, tag } = req.body if (!encryptedTitle) { return res.status(400).json({ error: 'encryptedTitle is required' }) } @@ -55,7 +55,10 @@ router.post('/', async (req: any, res) => { data: { id: id || undefined, userId: req.userId, - encryptedTitle + encryptedTitle, + encryptedKey, + iv, + tag } })