public SetupQRCodeDTO Setup() { var user = User.GetSubjectId(); var setup = _totpSetupGenerator.Generate("Brixel-Entry", user, _accountKeyService.GetAccountKey(user)); _logger.LogInformation($"Generate setup code for {user}"); return(new SetupQRCodeDTO() { ManualSetupKey = setup.ManualSetupKey, Image = setup.QrCodeImage }); }
public async Task <bool> OpenDoorRequest([FromBody] int validationCode) { var user = User.GetSubjectId(); var validationResult = _totpValidator.Validate(_accountKeyService.GetAccountKey(user), validationCode); if (!validationResult) { throw new Exception("Invalid validation token"); } return(await _doorRequestService.OpenDoor()); }