Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

Commit aaccdfe0 authored by calocedre TAC's avatar calocedre TAC
Browse files

use a constant for QrCode no renewal value

parent b5578b28
Pipeline #244010 passed with stages
in 6 minutes and 54 seconds
......@@ -35,6 +35,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class LocationSpecificPart {
public static final int UNLIMITED_PERIOD_DURATION = 255;
public static final int QRCODE_NO_RENEWAL = 0x1F;
public static final short LOCATION_TEMPORARY_SECRET_KEY_SIZE = 32; // 256 bits
public static final String VERSION_VALIDATION_MESSAGE = "Version should have a value between 0 and 8 (included)";
......@@ -148,7 +149,7 @@ public class LocationSpecificPart {
* @return the number of seconds between a new QR code generation.
*/
public int getQrCodeRenewalInterval() {
if (this.qrCodeRenewalIntervalExponentCompact == 0x1F) {
if (this.qrCodeRenewalIntervalExponentCompact == QRCODE_NO_RENEWAL) {
return 0;
}
return (int) Math.pow(2, this.qrCodeRenewalIntervalExponentCompact);
......
......@@ -68,7 +68,7 @@ public class LocationTest {
@Test
public void testWhenSettingQrCodeValidityStartTimeWithNoQrCodeRenewalIntervalThenQrValidityStartTimeNotUpdated() {
int qrCodeRenewalIntervalExponentCompact = 0x1F;
int qrCodeRenewalIntervalExponentCompact = LocationSpecificPart.QRCODE_NO_RENEWAL;
int periodDuration = 3;
lsp = newLocationSpecificPart(qrCodeRenewalIntervalExponentCompact, periodDuration);
......@@ -84,7 +84,7 @@ public class LocationTest {
@Test
public void testWhenSettingQrCodeValidityStartTimeWithNoQrCodeRenewalIntervalThenQrValidityStartTimeUpdatedWhenNewPeriod() throws CleaEncryptionException {
int qrCodeRenewalIntervalExponentCompact = 0x1F;
int qrCodeRenewalIntervalExponentCompact = LocationSpecificPart.QRCODE_NO_RENEWAL;
int periodDuration = 3;
lsp = newLocationSpecificPart(qrCodeRenewalIntervalExponentCompact, periodDuration);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment