Add U2F support

This commit is contained in:
Jonas Lochmann
2022-09-22 08:47:06 +02:00
parent 04aa2ce517
commit 613776cbf9
64 changed files with 2501 additions and 134 deletions
@@ -34,6 +34,7 @@ import { getFamilyEntry } from './family-entry'
import { getUserList } from './user-list'
import { getKeyRequests } from './key-requests'
import { getKeyResponses } from './key-responses'
import { getU2f } from './u2f'
export const generateServerDataStatus = async ({
database, clientStatus, familyId, deviceId, transaction, eventHandler
@@ -51,13 +52,14 @@ export const generateServerDataStatus = async ({
const doesClientSupportTasks = clientLevel >= 3
const doesClientSupportCryptoApps = clientLevel >= 4
const doesClientSupportDh = clientLevel >= 5
const doesClientSupportU2f = clientLevel >= 6
const result: ServerDataStatus = {
fullVersion: config.alwaysPro ? 1 : (
familyEntry.hasFullVersion ? parseInt(familyEntry.fullVersionUntil, 10) : 0
),
message: await getStatusMessage({ database, transaction }) || undefined,
apiLevel: 5
apiLevel: 6
}
if (familyEntry.deviceListVersion !== clientStatus.devices) {
@@ -152,5 +154,14 @@ export const generateServerDataStatus = async ({
}) || undefined
}
if (doesClientSupportU2f) {
result.u2f = await getU2f({
database,
transaction,
familyEntry,
lastVersionId: clientStatus.u2f || null
}) || undefined
}
return result
}