mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 18:28:10 +01:00
Moving secret values out of the main configuration file
This commit is contained in:
@@ -12,7 +12,9 @@ import static org.mockito.Mockito.doThrow;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Optional;
|
||||
import org.apache.commons.lang3.RandomUtils;
|
||||
import org.mockito.Mockito;
|
||||
import org.whispersystems.textsecuregcm.configuration.secrets.SecretBytes;
|
||||
import org.whispersystems.textsecuregcm.controllers.RateLimitExceededException;
|
||||
import org.whispersystems.textsecuregcm.limits.RateLimiter;
|
||||
import org.whispersystems.textsecuregcm.limits.RateLimiters;
|
||||
@@ -70,4 +72,16 @@ public final class MockUtils {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static SecretBytes randomSecretBytes(final int size) {
|
||||
return new SecretBytes(RandomUtils.nextBytes(size));
|
||||
}
|
||||
|
||||
public static SecretBytes secretBytesOf(final int... byteVals) {
|
||||
final byte[] bytes = new byte[byteVals.length];
|
||||
for (int i = 0; i < byteVals.length; i++) {
|
||||
bytes[i] = (byte) byteVals[i];
|
||||
}
|
||||
return new SecretBytes(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user