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