Moving secret values out of the main configuration file

This commit is contained in:
Sergey Skrobotov
2023-05-17 11:14:04 -07:00
parent 8d1c26d07d
commit 287e2fa89a
57 changed files with 959 additions and 551 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2020 Signal Messenger, LLC
* Copyright 2013 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
@@ -25,12 +25,12 @@ import javax.validation.Payload;
ExactlySizeValidatorForString.class,
ExactlySizeValidatorForArraysOfByte.class,
ExactlySizeValidatorForCollection.class,
ExactlySizeValidatorForSecretBytes.class,
})
@Documented
public @interface ExactlySize {
String message() default "{org.whispersystems.textsecuregcm.util.ExactlySize." +
"message}";
String message() default "{org.whispersystems.textsecuregcm.util.ExactlySize.message}";
Class<?>[] groups() default { };

View File

@@ -0,0 +1,15 @@
/*
* Copyright 2023 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.util;
import org.whispersystems.textsecuregcm.configuration.secrets.SecretBytes;
public class ExactlySizeValidatorForSecretBytes extends ExactlySizeValidator<SecretBytes> {
@Override
protected int size(final SecretBytes value) {
return value == null ? 0 : value.value().length;
}
}

View File

@@ -13,6 +13,7 @@ import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import javax.annotation.Nonnull;
import org.whispersystems.textsecuregcm.configuration.secrets.SecretsModule;
public class SystemMapper {
@@ -37,6 +38,7 @@ public class SystemMapper {
.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY)
.setVisibility(PropertyAccessor.CREATOR, JsonAutoDetect.Visibility.PUBLIC_ONLY)
.registerModules(
SecretsModule.INSTANCE,
new JavaTimeModule(),
new Jdk8Module());
}