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