Skip to main content

Abstract Class: BaseAuthFIDO2Route<U, A, S>

Defined in: src/routes/BaseAuthFIDO2Route.ts:35

Authenticates users via a registered FIDO2 hardware security key (e.g. a YubiKey) using WebAuthn/CTAP2. See BaseAuthPasskeyRoute for the software/synced-credential ("Passkey") counterpart of this route — both share the same underlying WebAuthn ceremony, but look up credentials stored as SecretType.FIDO2 rather than SecretType.PASSKEY.

Extended by

Type Parameters

U

U extends User

A

A extends Alias

S

S extends Secret

Constructors

Constructor

new BaseAuthFIDO2Route<U, A, S>(): BaseAuthFIDO2Route<U, A, S>

Returns

BaseAuthFIDO2Route<U, A, S>

Properties

aliasClass

abstract protected aliasClass: any

Defined in: src/routes/BaseAuthFIDO2Route.ts:36


aliasRepo?

protected optional aliasRepo?: RepoUtils<A>

Defined in: src/routes/BaseAuthFIDO2Route.ts:43


authMiddleware?

protected optional authMiddleware?: AuthMiddleware

Defined in: src/routes/BaseAuthFIDO2Route.ts:46


defaultScopes

protected defaultScopes: string[] = []

Defined in: src/routes/BaseAuthFIDO2Route.ts:49


fido2Config

protected fido2Config: PasskeyConfig

Defined in: src/routes/BaseAuthFIDO2Route.ts:68

The relying party configuration to use for this FIDO2 strategy. Kept separate from the Passkey strategy's configuration since a hardware key deployment commonly wants a different authenticatorAttachment/residentKey policy (see BaseSecretRoute.fido2Config).


jwtConfig?

protected optional jwtConfig?: any

Defined in: src/routes/BaseAuthFIDO2Route.ts:52


messagingUtils?

protected optional messagingUtils?: MessagingUtils

Defined in: src/routes/BaseAuthFIDO2Route.ts:55


rateLimiter?

protected optional rateLimiter?: RateLimiter

Defined in: src/routes/BaseAuthFIDO2Route.ts:58


secretClass

abstract protected secretClass: any

Defined in: src/routes/BaseAuthFIDO2Route.ts:37


secretRepo?

protected optional secretRepo?: RepoUtils<S>

Defined in: src/routes/BaseAuthFIDO2Route.ts:60


tokenUtils?

protected optional tokenUtils?: TokenUtils

Defined in: src/routes/BaseAuthFIDO2Route.ts:75


userClass

abstract protected userClass: any

Defined in: src/routes/BaseAuthFIDO2Route.ts:38


userRepo?

protected optional userRepo?: RepoUtils<U>

Defined in: src/routes/BaseAuthFIDO2Route.ts:77


userUtils?

protected optional userUtils?: UserUtils<U, A>

Defined in: src/routes/BaseAuthFIDO2Route.ts:79

Methods

authenticate()

authenticate(user, req, res): Promise<AuthResult | undefined>

Defined in: src/routes/BaseAuthFIDO2Route.ts:147

Authenticates the user using a FIDO2 hardware security key and returns a JSON Web Token access token to be used with future API requests.

Parameters

user

JWTUser

req

HttpRequest

res

HttpResponse

Returns

Promise<AuthResult | undefined>


getCredentialById()

protected getCredentialById(credentialId): Promise<StoredPasskeyCredential | undefined>

Defined in: src/routes/BaseAuthFIDO2Route.ts:155

Parameters

credentialId

string

Returns

Promise<StoredPasskeyCredential | undefined>


getCredentials()

protected getCredentials(id): Promise<StoredPasskeyCredential[]>

Defined in: src/routes/BaseAuthFIDO2Route.ts:172

Parameters

id

string

Returns

Promise<StoredPasskeyCredential[]>


getUser()

protected getUser(id): Promise<JWTUser | undefined>

Defined in: src/routes/BaseAuthFIDO2Route.ts:206

Retrieve the user associated with a given uid or alias.

Parameters

id

string

The unqique id of the user or alias to lookup.

Returns

Promise<JWTUser | undefined>


initialize()

protected initialize(): Promise<void>

Defined in: src/routes/BaseAuthFIDO2Route.ts:85

Called on server startup to initialize the route with any defaults.

Returns

Promise<void>


updateCredentialCounter()

protected updateCredentialCounter(credentialId, newCounter): Promise<void>

Defined in: src/routes/BaseAuthFIDO2Route.ts:213

Parameters

credentialId

string

newCounter

number

Returns

Promise<void>