]> nmode's Git Repositories - signal-cli/blob - lib/src/main/java/org/asamk/signal/manager/config/LiveConfig.java
Update URL for reaching Signal chat server
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / config / LiveConfig.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 LiveConfig {
25
26 private final static byte[] UNIDENTIFIED_SENDER_TRUST_ROOT = Base64.getDecoder()
27 .decode("BXu6QIKVz5MA8gstzfOgRQGqyLqOwNKHL6INkv3IHWMF");
28 private final static String CDS_MRENCLAVE = "c98e00a4e3ff977a56afefe7362a27e4961e4f19e211febfbb19b897e6b80b15";
29
30 private final static String KEY_BACKUP_ENCLAVE_NAME = "fe7c1bfae98f9b073d220366ea31163ee82f6d04bead774f71ca8e5c40847bfe";
31 private final static byte[] KEY_BACKUP_SERVICE_ID = Hex.decode(
32 "fe7c1bfae98f9b073d220366ea31163ee82f6d04bead774f71ca8e5c40847bfe");
33 private final static String KEY_BACKUP_MRENCLAVE = "a3baab19ef6ce6f34ab9ebb25ba722725ae44a8872dc0ff08ad6d83a9489de87";
34
35 private final static String URL = "https://chat.signal.org";
36 private final static String CDN_URL = "https://cdn.signal.org";
37 private final static String CDN2_URL = "https://cdn2.signal.org";
38 private final static String SIGNAL_CONTACT_DISCOVERY_URL = "https://api.directory.signal.org";
39 private final static String SIGNAL_KEY_BACKUP_URL = "https://api.backup.signal.org";
40 private final static String STORAGE_URL = "https://storage.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("AMhf5ywVwITZMsff/eCyudZx9JDmkkkbV6PInzG4p8x3VqVJSFiMvnvlEKWuRob/1eaIetR31IYeAbm0NdOuHH8Qi+Rexi1wLlpzIo1gstHWBfZzy1+qHRV5A4TqPp15YzBPm0WSggW6PbSn+F4lf57VCnHF7p8SvzAA2ZZJPYJURt8X7bbg+H3i+PEjH9DXItNEqs2sNcug37xZQDLm7X0=");
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 LiveConfig() {
84 }
85 }