Add enabled to SVR2 configuration

This commit is contained in:
Chris Eager
2023-03-28 16:39:35 -05:00
committed by Chris Eager
parent 4fa08fb189
commit 0cc84131de
7 changed files with 31 additions and 12 deletions

View File

@@ -32,6 +32,7 @@ public class SecureValueRecovery2Client {
private final ExternalServiceCredentialsGenerator secureValueRecoveryCredentialsGenerator;
private final URI deleteUri;
private final FaultTolerantHttpClient httpClient;
private final boolean enabled;
@VisibleForTesting
static final String DELETE_PATH = "/v1/delete";
@@ -52,9 +53,15 @@ public class SecureValueRecovery2Client {
.withSecurityProtocol(FaultTolerantHttpClient.SECURITY_PROTOCOL_TLS_1_2)
.withTrustedServerCertificates(configuration.svrCaCertificates().toArray(new String[0]))
.build();
this.enabled = configuration.enabled();
}
public CompletableFuture<Void> deleteBackups(final UUID accountUuid) {
if (!enabled) {
return CompletableFuture.completedFuture(null);
}
final ExternalServiceCredentials credentials = secureValueRecoveryCredentialsGenerator.generateForUuid(accountUuid);
final HttpRequest request = HttpRequest.newBuilder()

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2021 Signal Messenger, LLC
* Copyright 2023 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/