Skip to content

Commit

Permalink
Add default label in OTPParameters builder
Browse files Browse the repository at this point in the history
  • Loading branch information
M3DZIK committed May 5, 2024
1 parent 5b6b7e7 commit 18e1f74
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main/java/dev/medzik/otp/OTPParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public final class OTPParameters {
@NonNull
private OTPType type;
@NonNull
private String label;
@Builder.Default
private String label = "";
private String issuer;
@NonNull
private Secret secret;
Expand Down
1 change: 0 additions & 1 deletion src/test/java/dev/medzik/otp/HOTPGeneratorTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public void testHOTP() {
OTPParameters params = OTPParameters.builder()
.type(OTPType.HOTP)
.secret(new OTPParameters.Secret("JBSWY3DPEHPK3PXP"))
.label(new OTPParameters.Label("test"))
.build();

String code = HOTPGenerator.generate(params, 1);
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/dev/medzik/otp/TOTPGeneratorTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public void testGenerateTOTP() throws InterruptedException {
OTPParameters params = OTPParameters.builder()
.type(OTPType.TOTP)
.secret(OTPParameters.Secret.generate())
.label(new OTPParameters.Label("test"))
.build();

String code = TOTPGenerator.now(params);
Expand All @@ -30,7 +29,6 @@ public void testTOTP() {
OTPParameters params = OTPParameters.builder()
.type(OTPType.TOTP)
.secret(new OTPParameters.Secret("JBSWY3DPEHPK3PXP"))
.label(new OTPParameters.Label("test"))
.build();

assertEquals(TOTPGenerator.at(params, 1707566984), "785021");
Expand Down

0 comments on commit 18e1f74

Please sign in to comment.