Skip to content

Commit 06ff2aa

Browse files
author
FusionAuth Automation
committed
Sync from monorepo b9ce314f4344
1 parent dae0cf2 commit 06ff2aa

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

src/main/java/io/fusionauth/domain/FIPS.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2025-2025, FusionAuth, All Rights Reserved
2+
* Copyright (c) 2025-2026, FusionAuth, All Rights Reserved
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,8 +28,12 @@
2828
public class FIPS {
2929
public static final int FIPS_MIN_PASSWORD_LENGTH = 14;
3030

31+
public static final int FIPS_RECOVERY_CODE_LENGTH = 14;
32+
3133
public static final int STANDARD_MIN_PASSWORD_LENGTH = 8;
3234

35+
public static final int STANDARD_RECOVERY_CODE_LENGTH = 10;
36+
3337
private static volatile Boolean Enabled;
3438

3539
/**
@@ -58,4 +62,8 @@ public static boolean isEnabled() {
5862
public static int minimumPasswordLength() {
5963
return isEnabled() ? FIPS_MIN_PASSWORD_LENGTH : STANDARD_MIN_PASSWORD_LENGTH;
6064
}
65+
66+
public static int minimumRecoveryCodeLength() {
67+
return isEnabled() ? FIPS_RECOVERY_CODE_LENGTH : STANDARD_RECOVERY_CODE_LENGTH;
68+
}
6169
}

src/main/java/io/fusionauth/domain/UserTwoFactorConfiguration.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021-2023, FusionAuth, All Rights Reserved
2+
* Copyright (c) 2021-2026, FusionAuth, All Rights Reserved
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,13 +33,19 @@ public class UserTwoFactorConfiguration implements Buildable<UserTwoFactorConfig
3333

3434
public final List<String> recoveryCodes = new ArrayList<>();
3535

36+
public String recoveryCodeEncryptionScheme;
37+
38+
public Integer recoveryCodeWorkFactor;
39+
3640
@JacksonConstructor
3741
public UserTwoFactorConfiguration() {
3842
}
3943

4044
public UserTwoFactorConfiguration(UserTwoFactorConfiguration other) {
4145
other.methods.forEach(m -> methods.add(new TwoFactorMethod(m)));
4246
this.recoveryCodes.addAll(other.recoveryCodes);
47+
this.recoveryCodeEncryptionScheme = other.recoveryCodeEncryptionScheme;
48+
this.recoveryCodeWorkFactor = other.recoveryCodeWorkFactor;
4349
}
4450

4551
@Override
@@ -51,7 +57,10 @@ public boolean equals(Object o) {
5157
return false;
5258
}
5359
UserTwoFactorConfiguration that = (UserTwoFactorConfiguration) o;
54-
return Objects.equals(methods, that.methods) && Objects.equals(recoveryCodes, that.recoveryCodes);
60+
return Objects.equals(methods, that.methods) &&
61+
Objects.equals(recoveryCodes, that.recoveryCodes) &&
62+
Objects.equals(recoveryCodeEncryptionScheme, that.recoveryCodeEncryptionScheme) &&
63+
Objects.equals(recoveryCodeWorkFactor, that.recoveryCodeWorkFactor);
5564
}
5665

5766
@JsonIgnore
@@ -74,11 +83,14 @@ public TwoFactorMethod getMethodById(String id) {
7483

7584
@Override
7685
public int hashCode() {
77-
return Objects.hash(methods, recoveryCodes);
86+
return Objects.hash(methods, recoveryCodes, recoveryCodeEncryptionScheme, recoveryCodeWorkFactor);
7887
}
7988

8089
public UserTwoFactorConfiguration secure() {
8190
recoveryCodes.clear();
91+
recoveryCodeWorkFactor = null;
92+
recoveryCodeEncryptionScheme = null;
93+
8294
methods.forEach(TwoFactorMethod::secure);
8395
return this;
8496
}

0 commit comments

Comments
 (0)