mirror of
https://github.com/standardnotes/server
synced 2026-10-17 03:03:10 -04:00
fix(auth): updating counter post authenticator verification
This commit is contained in:
+2
-2
@@ -36,7 +36,7 @@ describe('VerifyAuthenticatorAuthenticationResponse', () => {
|
||||
|
||||
authenticatorRepository = {} as jest.Mocked<AuthenticatorRepositoryInterface>
|
||||
authenticatorRepository.findByUserUuidAndCredentialId = jest.fn().mockReturnValue(authenticator)
|
||||
authenticatorRepository.save = jest.fn()
|
||||
authenticatorRepository.updateCounter = jest.fn()
|
||||
|
||||
authenticatorChallengeRepository = {} as jest.Mocked<AuthenticatorChallengeRepositoryInterface>
|
||||
authenticatorChallengeRepository.findByUserUuid = jest.fn().mockReturnValue({
|
||||
@@ -221,6 +221,6 @@ describe('VerifyAuthenticatorAuthenticationResponse', () => {
|
||||
})
|
||||
|
||||
expect(result.isFailed()).toBeFalsy()
|
||||
expect(authenticatorRepository.save).toHaveBeenCalled()
|
||||
expect(authenticatorRepository.updateCounter).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
+1
-3
@@ -60,9 +60,7 @@ export class VerifyAuthenticatorAuthenticationResponse implements UseCaseInterfa
|
||||
return Result.fail(`Could not verify authenticator authentication response: ${(error as Error).message}`)
|
||||
}
|
||||
|
||||
authenticator.props.counter = verification.authenticationInfo.newCounter as number
|
||||
|
||||
await this.authenticatorRepository.save(authenticator)
|
||||
await this.authenticatorRepository.updateCounter(authenticator.id, verification.authenticationInfo.newCounter)
|
||||
|
||||
return Result.ok(true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user