fix(auth): authentication options

This commit is contained in:
Karol Sójko
2023-03-08 14:08:40 +01:00
parent e84e78ec55
commit 1d11c5a186
2 changed files with 6 additions and 6 deletions
@@ -54,7 +54,7 @@ describe('GenerateAuthenticatorAuthenticationOptions', () => {
})
expect(result.isFailed()).toBe(true)
expect(result.getError()).toBe('Could not generate authenticator registration options: Username cannot be empty')
expect(result.getError()).toBe('Could not generate authenticator authentication options: Username cannot be empty')
})
it('should return error if user uuid is not valid', async () => {
@@ -70,7 +70,7 @@ describe('GenerateAuthenticatorAuthenticationOptions', () => {
expect(result.isFailed()).toBe(true)
expect(result.getError()).toBe(
'Could not generate authenticator registration options: Given value is not a valid uuid: invalid',
'Could not generate authenticator authentication options: Given value is not a valid uuid: invalid',
)
})
@@ -97,7 +97,7 @@ describe('GenerateAuthenticatorAuthenticationOptions', () => {
})
expect(result.isFailed()).toBe(true)
expect(result.getError()).toBe('Could not generate authenticator registration options: Oops')
expect(result.getError()).toBe('Could not generate authenticator authentication options: Oops')
mock.mockRestore()
})
@@ -19,7 +19,7 @@ export class GenerateAuthenticatorAuthenticationOptions implements UseCaseInterf
async execute(dto: GenerateAuthenticatorAuthenticationOptionsDTO): Promise<Result<Record<string, unknown>>> {
const usernameOrError = Username.create(dto.username)
if (usernameOrError.isFailed()) {
return Result.fail(`Could not generate authenticator registration options: ${usernameOrError.getError()}`)
return Result.fail(`Could not generate authenticator authentication options: ${usernameOrError.getError()}`)
}
const username = usernameOrError.getValue()
@@ -46,7 +46,7 @@ export class GenerateAuthenticatorAuthenticationOptions implements UseCaseInterf
const userUuidOrError = Uuid.create(user.uuid)
if (userUuidOrError.isFailed()) {
return Result.fail(`Could not generate authenticator registration options: ${userUuidOrError.getError()}`)
return Result.fail(`Could not generate authenticator authentication options: ${userUuidOrError.getError()}`)
}
const userUuid = userUuidOrError.getValue()
@@ -67,7 +67,7 @@ export class GenerateAuthenticatorAuthenticationOptions implements UseCaseInterf
})
if (authenticatorChallengeOrError.isFailed()) {
return Result.fail(
`Could not generate authenticator registration options: ${authenticatorChallengeOrError.getError()}`,
`Could not generate authenticator authentication options: ${authenticatorChallengeOrError.getError()}`,
)
}
const authenticatorChallenge = authenticatorChallengeOrError.getValue()