Skip to content
This repository was archived by the owner on Oct 19, 2024. It is now read-only.

Commit 7815ac1

Browse files
committed
Bump dev.medzik:otp to v1.0.1
1 parent e95555b commit 7815ac1

File tree

5 files changed

+15
-23
lines changed

5 files changed

+15
-23
lines changed

client/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<dependency>
4040
<groupId>dev.medzik</groupId>
4141
<artifactId>otp</artifactId>
42-
<version>1.0.0</version>
42+
<version>1.0.1</version>
4343
<scope>test</scope>
4444
</dependency>
4545
</dependencies>

client/src/test/kotlin/dev/medzik/librepass/client/api/TwoFactorTests.kt

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ class TwoFactorTests {
2020
OTPParameters.builder()
2121
.type(OTPType.TOTP)
2222
.secret(OTPParameters.Secret(twoFactorSecret))
23-
.label(OTPParameters.Label(""))
2423
.build()
2524

2625
@BeforeAll

server/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
<dependency>
111111
<groupId>dev.medzik</groupId>
112112
<artifactId>otp</artifactId>
113-
<version>1.0.0</version>
113+
<version>1.0.1</version>
114114
</dependency>
115115

116116
<!-- Handshake Authentication -->

server/src/main/kotlin/dev/medzik/librepass/server/controllers/api/Auth.kt

+5-8
Original file line numberDiff line numberDiff line change
@@ -234,17 +234,14 @@ class AuthController @Autowired constructor(
234234

235235
consumeRateLimit(user.email)
236236

237-
val totpParameters =
238-
OTPParameters.builder()
239-
.type(OTPType.TOTP)
240-
.secret(OTPParameters.Secret(user.twoFactorSecret))
241-
.label(OTPParameters.Label(""))
242-
.build()
237+
val totpParameters = OTPParameters.builder()
238+
.type(OTPType.TOTP)
239+
.secret(OTPParameters.Secret(user.twoFactorSecret))
240+
.build()
243241

244242
if (!TOTPGenerator.verify(totpParameters, request.code) &&
245243
request.code != user.twoFactorRecoveryCode
246-
)
247-
throw ServerException.InvalidTwoFactor()
244+
) throw ServerException.InvalidTwoFactor()
248245

249246
coroutineScope.launch {
250247
emailService.sendNewLogin(

server/src/main/kotlin/dev/medzik/librepass/server/controllers/api/User.kt

+8-12
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,10 @@ class UserController @Autowired constructor(
222222
if (!validateSharedKey(user, request.sharedKey))
223223
throw ServerException.InvalidSharedKey()
224224

225-
val totpParameters =
226-
OTPParameters.builder()
227-
.type(OTPType.TOTP)
228-
.secret(OTPParameters.Secret(request.secret))
229-
.label(OTPParameters.Label(""))
230-
.build()
225+
val totpParameters = OTPParameters.builder()
226+
.type(OTPType.TOTP)
227+
.secret(OTPParameters.Secret(request.secret))
228+
.build()
231229

232230
if (!TOTPGenerator.verify(totpParameters, request.code))
233231
throw ServerException.InvalidTwoFactor()
@@ -258,12 +256,10 @@ class UserController @Autowired constructor(
258256
if (request.code.isNullOrBlank())
259257
throw ServerException.InvalidTwoFactor()
260258

261-
val totpParameters =
262-
OTPParameters.builder()
263-
.type(OTPType.TOTP)
264-
.secret(OTPParameters.Secret(user.twoFactorSecret))
265-
.label(OTPParameters.Label(""))
266-
.build()
259+
val totpParameters = OTPParameters.builder()
260+
.type(OTPType.TOTP)
261+
.secret(OTPParameters.Secret(user.twoFactorSecret))
262+
.build()
267263

268264
if (!TOTPGenerator.verify(totpParameters, request.code))
269265
throw ServerException.InvalidTwoFactor()

0 commit comments

Comments
 (0)