mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 17:48:04 +01:00
Moving secret values out of the main configuration file
This commit is contained in:
@@ -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 { };
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user