feat(auth): add removing authenticator

This commit is contained in:
Karol Sójko
2022-12-29 13:55:08 +01:00
parent 401b78e477
commit de50d76800
13 changed files with 176 additions and 3 deletions
@@ -3,6 +3,7 @@ import { inject } from 'inversify'
import {
BaseHttpController,
controller,
httpDelete,
httpGet,
httpPost,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -26,6 +27,16 @@ export class InversifyExpressAuthenticatorsController extends BaseHttpController
return this.json(result.data, result.status)
}
@httpDelete('/:authenticatorId')
async delete(request: Request, response: Response): Promise<results.JsonResult> {
const result = await this.authenticatorsController.delete({
userUuid: response.locals.user.uuid,
authenticatorId: request.params.authenticatorId,
})
return this.json(result.data, result.status)
}
@httpGet('/generate-registration-options')
async generateRegistrationOptions(_request: Request, response: Response): Promise<results.JsonResult> {
const result = await this.authenticatorsController.generateRegistrationOptions({