]> nmode's Git Repositories - signal-cli/blob - lib/src/main/java/org/asamk/signal/manager/config/SandboxConfig.java
Enable announcement group capability
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / config / SandboxConfig.java
1 package org.asamk.signal.manager.config;
2
3 import org.bouncycastle.util.encoders.Hex;
4 import org.whispersystems.libsignal.InvalidKeyException;
5 import org.whispersystems.libsignal.ecc.Curve;
6 import org.whispersystems.libsignal.ecc.ECPublicKey;
7 import org.whispersystems.libsignal.util.guava.Optional;
8 import org.whispersystems.signalservice.api.push.TrustStore;
9 import org.whispersystems.signalservice.internal.configuration.SignalCdnUrl;
10 import org.whispersystems.signalservice.internal.configuration.SignalContactDiscoveryUrl;
11 import org.whispersystems.signalservice.internal.configuration.SignalKeyBackupServiceUrl;
12 import org.whispersystems.signalservice.internal.configuration.SignalProxy;
13 import org.whispersystems.signalservice.internal.configuration.SignalServiceConfiguration;
14 import org.whispersystems.signalservice.internal.configuration.SignalServiceUrl;
15 import org.whispersystems.signalservice.internal.configuration.SignalStorageUrl;
16
17 import java.util.Base64;
18 import java.util.List;
19 import java.util.Map;
20
21 import okhttp3.Dns;
22 import okhttp3.Interceptor;
23
24 class SandboxConfig {
25
26 private final static byte[] UNIDENTIFIED_SENDER_TRUST_ROOT = Base64.getDecoder()
27 .decode("BbqY1DzohE4NUZoVF+L18oUPrK3kILllLEJh2UnPSsEx");
28 private final static String CDS_MRENCLAVE = "c98e00a4e3ff977a56afefe7362a27e4961e4f19e211febfbb19b897e6b80b15";
29
30 private final static String KEY_BACKUP_ENCLAVE_NAME = "823a3b2c037ff0cbe305cc48928cfcc97c9ed4a8ca6d49af6f7d6981fb60a4e9";
31 private final static byte[] KEY_BACKUP_SERVICE_ID = Hex.decode(
32 "51a56084c0b21c6b8f62b1bc792ec9bedac4c7c3964bb08ddcab868158c09982");
33 private final static String KEY_BACKUP_MRENCLAVE = "a3baab19ef6ce6f34ab9ebb25ba722725ae44a8872dc0ff08ad6d83a9489de87";
34
35 private final static String URL = "https://textsecure-service-staging.whispersystems.org";
36 private final static String CDN_URL = "https://cdn-staging.signal.org";
37 private final static String CDN2_URL = "https://cdn2-staging.signal.org";
38 private final static String SIGNAL_CONTACT_DISCOVERY_URL = "https://api-staging.directory.signal.org";
39 private final static String SIGNAL_KEY_BACKUP_URL = "https://api-staging.backup.signal.org";
40 private final static String STORAGE_URL = "https://storage-staging.signal.org";
41 private final static TrustStore TRUST_STORE = new WhisperTrustStore();
42
43 private final static Optional<Dns> dns = Optional.absent();
44 private final static Optional<SignalProxy> proxy = Optional.absent();
45
46 private final static byte[] zkGroupServerPublicParams = Base64.getDecoder()
47 .decode("ABSY21VckQcbSXVNCGRYJcfWHiAMZmpTtTELcDmxgdFbtp/bWsSxZdMKzfCp8rvIs8ocCU3B37fT3r4Mi5qAemeGeR2X+/YmOGR5ofui7tD5mDQfstAI9i+4WpMtIe8KC3wU5w3Inq3uNWVmoGtpKndsNfwJrCg0Hd9zmObhypUnSkfYn2ooMOOnBpfdanRtrvetZUayDMSC5iSRcXKpdls=");
48
49 static SignalServiceConfiguration createDefaultServiceConfiguration(
50 final List<Interceptor> interceptors
51 ) {
52 return new SignalServiceConfiguration(new SignalServiceUrl[]{new SignalServiceUrl(URL, TRUST_STORE)},
53 Map.of(0,
54 new SignalCdnUrl[]{new SignalCdnUrl(CDN_URL, TRUST_STORE)},
55 2,
56 new SignalCdnUrl[]{new SignalCdnUrl(CDN2_URL, TRUST_STORE)}),
57 new SignalContactDiscoveryUrl[]{new SignalContactDiscoveryUrl(SIGNAL_CONTACT_DISCOVERY_URL,
58 TRUST_STORE)},
59 new SignalKeyBackupServiceUrl[]{new SignalKeyBackupServiceUrl(SIGNAL_KEY_BACKUP_URL, TRUST_STORE)},
60 new SignalStorageUrl[]{new SignalStorageUrl(STORAGE_URL, TRUST_STORE)},
61 interceptors,
62 dns,
63 proxy,
64 zkGroupServerPublicParams);
65 }
66
67 static ECPublicKey getUnidentifiedSenderTrustRoot() {
68 try {
69 return Curve.decodePoint(UNIDENTIFIED_SENDER_TRUST_ROOT, 0);
70 } catch (InvalidKeyException e) {
71 throw new AssertionError(e);
72 }
73 }
74
75 static KeyBackupConfig createKeyBackupConfig() {
76 return new KeyBackupConfig(KEY_BACKUP_ENCLAVE_NAME, KEY_BACKUP_SERVICE_ID, KEY_BACKUP_MRENCLAVE);
77 }
78
79 static String getCdsMrenclave() {
80 return CDS_MRENCLAVE;
81 }
82
83 private SandboxConfig() {
84 }
85 }