]> nmode's Git Repositories - signal-cli/blob - lib/src/main/java/org/asamk/signal/manager/config/StagingConfig.java
b5a146dd0674ac054ae8b66de86187519c24718c
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / config / StagingConfig.java
1 package org.asamk.signal.manager.config;
2
3 import org.bouncycastle.util.encoders.Hex;
4 import org.signal.libsignal.protocol.InvalidKeyException;
5 import org.signal.libsignal.protocol.ecc.Curve;
6 import org.signal.libsignal.protocol.ecc.ECPublicKey;
7 import org.whispersystems.signalservice.api.push.TrustStore;
8 import org.whispersystems.signalservice.internal.configuration.SignalCdnUrl;
9 import org.whispersystems.signalservice.internal.configuration.SignalCdsiUrl;
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 import java.util.Optional;
21
22 import okhttp3.Dns;
23 import okhttp3.Interceptor;
24
25 class StagingConfig {
26
27 private final static byte[] UNIDENTIFIED_SENDER_TRUST_ROOT = Base64.getDecoder()
28 .decode("BbqY1DzohE4NUZoVF+L18oUPrK3kILllLEJh2UnPSsEx");
29 private final static String CDS_MRENCLAVE = "74778bb0f93ae1f78c26e67152bab0bbeb693cd56d1bb9b4e9244157acc58081";
30 private final static String CDSI_MRENCLAVE = "ef4787a56a154ac6d009138cac17155acd23cfe4329281252365dd7c252e7fbf";
31
32 private final static String KEY_BACKUP_ENCLAVE_NAME = "39963b736823d5780be96ab174869a9499d56d66497aa8f9b2244f777ebc366b";
33 private final static byte[] KEY_BACKUP_SERVICE_ID = Hex.decode(
34 "9dbc6855c198e04f21b5cc35df839fdcd51b53658454dfa3f817afefaffc95ef");
35 private final static String KEY_BACKUP_MRENCLAVE = "45627094b2ea4a66f4cf0b182858a8dcf4b8479122c3820fe7fd0551a6d4cf5c";
36
37 private final static String URL = "https://chat.staging.signal.org";
38 private final static String CDN_URL = "https://cdn-staging.signal.org";
39 private final static String CDN2_URL = "https://cdn2-staging.signal.org";
40 private final static String SIGNAL_CONTACT_DISCOVERY_URL = "https://api-staging.directory.signal.org";
41 private final static String SIGNAL_KEY_BACKUP_URL = "https://api-staging.backup.signal.org";
42 private final static String STORAGE_URL = "https://storage-staging.signal.org";
43 private final static String SIGNAL_CDSI_URL = "https://cdsi.staging.signal.org";
44 private final static TrustStore TRUST_STORE = new WhisperTrustStore();
45
46 private final static Optional<Dns> dns = Optional.empty();
47 private final static Optional<SignalProxy> proxy = Optional.empty();
48
49 private final static byte[] zkGroupServerPublicParams = Base64.getDecoder()
50 .decode("ABSY21VckQcbSXVNCGRYJcfWHiAMZmpTtTELcDmxgdFbtp/bWsSxZdMKzfCp8rvIs8ocCU3B37fT3r4Mi5qAemeGeR2X+/YmOGR5ofui7tD5mDQfstAI9i+4WpMtIe8KC3wU5w3Inq3uNWVmoGtpKndsNfwJrCg0Hd9zmObhypUnSkfYn2ooMOOnBpfdanRtrvetZUayDMSC5iSRcXKpdlukrpzzsCIvEwjwQlJYVPOQPj4V0F4UXXBdHSLK05uoPBCQG8G9rYIGedYsClJXnbrgGYG3eMTG5hnx4X4ntARBgELuMWWUEEfSK0mjXg+/2lPmWcTZWR9nkqgQQP0tbzuiPm74H2wMO4u1Wafe+UwyIlIT9L7KLS19Aw8r4sPrXZSSsOZ6s7M1+rTJN0bI5CKY2PX29y5Ok3jSWufIKcgKOnWoP67d5b2du2ZVJjpjfibNIHbT/cegy/sBLoFwtHogVYUewANUAXIaMPyCLRArsKhfJ5wBtTminG/PAvuBdJ70Z/bXVPf8TVsR292zQ65xwvWTejROW6AZX6aqucUj");
51
52 static SignalServiceConfiguration createDefaultServiceConfiguration(
53 final List<Interceptor> interceptors
54 ) {
55 return new SignalServiceConfiguration(new SignalServiceUrl[]{new SignalServiceUrl(URL, TRUST_STORE)},
56 Map.of(0,
57 new SignalCdnUrl[]{new SignalCdnUrl(CDN_URL, TRUST_STORE)},
58 2,
59 new SignalCdnUrl[]{new SignalCdnUrl(CDN2_URL, TRUST_STORE)}),
60 new SignalContactDiscoveryUrl[]{new SignalContactDiscoveryUrl(SIGNAL_CONTACT_DISCOVERY_URL,
61 TRUST_STORE)},
62 new SignalKeyBackupServiceUrl[]{new SignalKeyBackupServiceUrl(SIGNAL_KEY_BACKUP_URL, TRUST_STORE)},
63 new SignalStorageUrl[]{new SignalStorageUrl(STORAGE_URL, TRUST_STORE)},
64 new SignalCdsiUrl[]{new SignalCdsiUrl(SIGNAL_CDSI_URL, TRUST_STORE)},
65 interceptors,
66 dns,
67 proxy,
68 zkGroupServerPublicParams);
69 }
70
71 static ECPublicKey getUnidentifiedSenderTrustRoot() {
72 try {
73 return Curve.decodePoint(UNIDENTIFIED_SENDER_TRUST_ROOT, 0);
74 } catch (InvalidKeyException e) {
75 throw new AssertionError(e);
76 }
77 }
78
79 static KeyBackupConfig createKeyBackupConfig() {
80 return new KeyBackupConfig(KEY_BACKUP_ENCLAVE_NAME, KEY_BACKUP_SERVICE_ID, KEY_BACKUP_MRENCLAVE);
81 }
82
83 static String getCdsMrenclave() {
84 return CDS_MRENCLAVE;
85 }
86
87 private StagingConfig() {
88 }
89 }