Skip to content

Commit 1af69cd

Browse files
committed
Allow for immediate salt rotation temporarily
1 parent 6bfb4c1 commit 1af69cd

File tree

2 files changed

+343
-346
lines changed

2 files changed

+343
-346
lines changed

src/main/java/com/uid2/admin/secret/SaltRotation.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,13 @@ public Result rotateSalts(RotatingSaltProvider.SaltSnapshot lastSnapshot,
3434
Duration[] minAges,
3535
double fraction,
3636
LocalDate targetDate) throws Exception {
37-
final Instant nextEffective = targetDate.atStartOfDay().toInstant(ZoneOffset.UTC);
37+
final Instant nextEffective = Instant.now() ;
3838
final Instant nextExpires = nextEffective.plus(7, ChronoUnit.DAYS);
3939
if (nextEffective.equals(lastSnapshot.getEffective()) || nextEffective.isBefore(lastSnapshot.getEffective())) {
4040
return Result.noSnapshot("cannot create a new salt snapshot with effective timestamp equal or prior to that of an existing snapshot");
4141
}
4242

4343
List<Integer> saltIndexesToRotate = pickSaltIndexesToRotate(lastSnapshot, nextEffective, minAges, fraction);
44-
if (saltIndexesToRotate.isEmpty()) {
45-
return Result.noSnapshot("all salts are below min rotation age");
46-
}
4744

4845
var updatedSalts = updateSalts(lastSnapshot.getAllRotatingSalts(), saltIndexesToRotate, nextEffective.toEpochMilli());
4946

0 commit comments

Comments
 (0)