feat(dev): add u2f ui for managing devices and signing in (#2182)
* feat: add u2f ui for managing devices and signing in * refactor: change unnecessary useState to derived constant * fix: modal refactor * fix(web): hide u2f under feature trunk * fix(web): jest setup --------- Co-authored-by: Aman Harwara <amanharwara@protonmail.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { HttpServiceInterface } from '../../Http/HttpServiceInterface'
|
||||
import {
|
||||
ListAuthenticatorsRequestParams,
|
||||
GenerateAuthenticatorAuthenticationOptionsRequestParams,
|
||||
DeleteAuthenticatorRequestParams,
|
||||
VerifyAuthenticatorRegistrationResponseRequestParams,
|
||||
VerifyAuthenticatorAuthenticationResponseRequestParams,
|
||||
} from '../../Request'
|
||||
import {
|
||||
ListAuthenticatorsResponse,
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
GenerateAuthenticatorRegistrationOptionsResponse,
|
||||
VerifyAuthenticatorRegistrationResponseResponse,
|
||||
GenerateAuthenticatorAuthenticationOptionsResponse,
|
||||
VerifyAuthenticatorAuthenticationResponseResponse,
|
||||
} from '../../Response'
|
||||
import { AuthenticatorServerInterface } from './AuthenticatorServerInterface'
|
||||
import { Paths } from './Paths'
|
||||
@@ -45,17 +44,11 @@ export class AuthenticatorServer implements AuthenticatorServerInterface {
|
||||
return response as VerifyAuthenticatorRegistrationResponseResponse
|
||||
}
|
||||
|
||||
async generateAuthenticationOptions(): Promise<GenerateAuthenticatorAuthenticationOptionsResponse> {
|
||||
const response = await this.httpService.get(Paths.v1.generateAuthenticationOptions)
|
||||
async generateAuthenticationOptions(
|
||||
params: GenerateAuthenticatorAuthenticationOptionsRequestParams,
|
||||
): Promise<GenerateAuthenticatorAuthenticationOptionsResponse> {
|
||||
const response = await this.httpService.post(Paths.v1.generateAuthenticationOptions, params)
|
||||
|
||||
return response as GenerateAuthenticatorAuthenticationOptionsResponse
|
||||
}
|
||||
|
||||
async verifyAuthenticationResponse(
|
||||
params: VerifyAuthenticatorAuthenticationResponseRequestParams,
|
||||
): Promise<VerifyAuthenticatorAuthenticationResponseResponse> {
|
||||
const response = await this.httpService.post(Paths.v1.verifyAuthenticationResponse, params)
|
||||
|
||||
return response as VerifyAuthenticatorAuthenticationResponseResponse
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
ListAuthenticatorsRequestParams,
|
||||
DeleteAuthenticatorRequestParams,
|
||||
VerifyAuthenticatorRegistrationResponseRequestParams,
|
||||
VerifyAuthenticatorAuthenticationResponseRequestParams,
|
||||
GenerateAuthenticatorAuthenticationOptionsRequestParams,
|
||||
} from '../../Request'
|
||||
import {
|
||||
ListAuthenticatorsResponse,
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
GenerateAuthenticatorRegistrationOptionsResponse,
|
||||
VerifyAuthenticatorRegistrationResponseResponse,
|
||||
GenerateAuthenticatorAuthenticationOptionsResponse,
|
||||
VerifyAuthenticatorAuthenticationResponseResponse,
|
||||
} from '../../Response'
|
||||
|
||||
export interface AuthenticatorServerInterface {
|
||||
@@ -20,8 +19,7 @@ export interface AuthenticatorServerInterface {
|
||||
verifyRegistrationResponse(
|
||||
params: VerifyAuthenticatorRegistrationResponseRequestParams,
|
||||
): Promise<VerifyAuthenticatorRegistrationResponseResponse>
|
||||
generateAuthenticationOptions(): Promise<GenerateAuthenticatorAuthenticationOptionsResponse>
|
||||
verifyAuthenticationResponse(
|
||||
params: VerifyAuthenticatorAuthenticationResponseRequestParams,
|
||||
): Promise<VerifyAuthenticatorAuthenticationResponseResponse>
|
||||
generateAuthenticationOptions(
|
||||
params: GenerateAuthenticatorAuthenticationOptionsRequestParams,
|
||||
): Promise<GenerateAuthenticatorAuthenticationOptionsResponse>
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ const AuthenticatorPaths = {
|
||||
generateRegistrationOptions: '/v1/authenticators/generate-registration-options',
|
||||
verifyRegistrationResponse: '/v1/authenticators/verify-registration',
|
||||
generateAuthenticationOptions: '/v1/authenticators/generate-authentication-options',
|
||||
verifyAuthenticationResponse: '/v1/authenticators/verify-authentication',
|
||||
}
|
||||
|
||||
export const Paths = {
|
||||
|
||||
Reference in New Issue
Block a user