Skip to content

Commit d4c5a32

Browse files
committedFeb 15, 2021
Add support for contact discovery service
This addresses #212 Also - Add support for Signal staging services - Consolidate SignalServiceConfiguration initialization to one location - Update libsignal-service-dotnet to 2.10.0.1 - Update other dependencies
1 parent ea298db commit d4c5a32

23 files changed

+246
-46
lines changed
 

‎Signal-Windows.Lib/OutgoingMessages.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public async Task HandleOutgoingMessages()
189189
Logger.LogDebug("HandleOutgoingMessages()");
190190
try
191191
{
192-
var messageSender = new SignalServiceMessageSender(Token, LibUtils.ServiceConfiguration, Store.Username, Store.Password, (int)Store.DeviceId, new Store(), LibUtils.USER_AGENT, Store.DeviceId != 1, Pipe, null, null);
192+
var messageSender = new SignalServiceMessageSender(Token, LibUtils.ServiceConfiguration, Store.Username, Store.Password, (int)Store.DeviceId, new Store(), LibUtils.USER_AGENT, LibUtils.HttpClient, Store.DeviceId != 1, Pipe, null, null);
193193
while (!Token.IsCancellationRequested)
194194
{
195195
ISendable sendable = null;
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using Microsoft.Extensions.Configuration;
2+
using Windows.ApplicationModel;
3+
4+
namespace Signal_Windows.Lib.Settings
5+
{
6+
public class AppConfig
7+
{
8+
private readonly IConfigurationRoot configurationRoot;
9+
10+
public AppConfig()
11+
{
12+
string jsonSettingsFilePath =
13+
$@"{Package.Current.InstalledLocation.Path}\Signal-Windows.Lib\Settings\";
14+
15+
bool useStaging = false;
16+
if (useStaging)
17+
{
18+
jsonSettingsFilePath += "appsettings.json";
19+
}
20+
else
21+
{
22+
jsonSettingsFilePath += "appsettings.production.json";
23+
}
24+
25+
IConfigurationBuilder builder = new ConfigurationBuilder()
26+
.Add(new LocalConfigurationSource(jsonSettingsFilePath));
27+
28+
configurationRoot = builder.Build();
29+
}
30+
31+
public SignalSettings GetSignalSettings()
32+
{
33+
return new SignalSettings(GetSection<string>(nameof(SignalSettings.ServiceUrl)),
34+
GetSection<string>(nameof(SignalSettings.ContactDiscoveryServiceUrl)),
35+
GetSection<string>(nameof(SignalSettings.ContactDiscoveryServiceEnclaveId)));
36+
}
37+
38+
private T GetSection<T>(string key)
39+
{
40+
return configurationRoot.GetSection(key).Get<T>();
41+
}
42+
}
43+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using Microsoft.Extensions.Configuration;
4+
using Newtonsoft.Json.Linq;
5+
using Windows.Storage;
6+
7+
namespace Signal_Windows.Lib.Settings
8+
{
9+
internal class LocalConfigurationProvider : ConfigurationProvider
10+
{
11+
public LocalConfigurationProvider(LocalConfigurationSource localConfigurationSource)
12+
{
13+
var appSettingsFile = WaitAndGet(StorageFile.GetFileFromPathAsync($@"{localConfigurationSource.JsonSettingsFilePath}").AsTask());
14+
JObject o = JObject.Parse(WaitAndGet(FileIO.ReadTextAsync(appSettingsFile).AsTask()));
15+
foreach (JProperty token in o["signalSettings"])
16+
{
17+
Data.Add(token.Name, (string)token.Value);
18+
}
19+
}
20+
21+
private T WaitAndGet<T>(Task<T> t)
22+
{
23+
t.Wait();
24+
return t.Result;
25+
}
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Microsoft.Extensions.Configuration;
2+
3+
namespace Signal_Windows.Lib.Settings
4+
{
5+
internal class LocalConfigurationSource : IConfigurationSource
6+
{
7+
public string JsonSettingsFilePath { get; }
8+
9+
public LocalConfigurationSource(string jsonSettingsFilePath)
10+
{
11+
JsonSettingsFilePath = jsonSettingsFilePath;
12+
}
13+
14+
public IConfigurationProvider Build(IConfigurationBuilder builder)
15+
{
16+
return new LocalConfigurationProvider(this);
17+
}
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace Signal_Windows.Lib.Settings
2+
{
3+
public sealed class SignalSettings
4+
{
5+
public string ServiceUrl { get; private set; }
6+
public string ContactDiscoveryServiceUrl { get; private set; }
7+
public string ContactDiscoveryServiceEnclaveId { get; private set; }
8+
9+
public SignalSettings(string serviceUrl, string contactDiscoveryServiceUrl, string contactDiscoveryServiceEnclaveId)
10+
{
11+
ServiceUrl = serviceUrl;
12+
ContactDiscoveryServiceUrl = contactDiscoveryServiceUrl;
13+
ContactDiscoveryServiceEnclaveId = contactDiscoveryServiceEnclaveId;
14+
}
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"signalSettings": {
3+
"ServiceUrl": "https://textsecure-service-staging.whispersystems.org",
4+
"ContactDiscoveryServiceUrl": "https://api-staging.directory.signal.org",
5+
"ContactDiscoveryServiceEnclaveId": "c98e00a4e3ff977a56afefe7362a27e4961e4f19e211febfbb19b897e6b80b15"
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"signalSettings": {
3+
"ServiceUrl": "https://textsecure-service.whispersystems.org",
4+
"ContactDiscoveryServiceUrl": "https://api.directory.signal.org",
5+
"ContactDiscoveryServiceEnclaveId": "c98e00a4e3ff977a56afefe7362a27e4961e4f19e211febfbb19b897e6b80b15"
6+
}
7+
}

‎Signal-Windows.Lib/Signal-Windows.Lib.csproj

+18-3
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
107107
</PropertyGroup>
108108
<ItemGroup>
109+
<Compile Include="Settings\AppConfig.cs" />
109110
<Compile Include="DisappearingMessagesManager.cs" />
110111
<Compile Include="Events\SignalMessageEventArgs.cs" />
111112
<Compile Include="GlobalSettingsManager.cs" />
@@ -114,6 +115,9 @@
114115
<Compile Include="Migrations\SignalDB\20180521001340_m6.designer.cs">
115116
<DependentUpon>20180521001340_m6.cs</DependentUpon>
116117
</Compile>
118+
<Compile Include="Settings\LocalConfigurationProvider.cs" />
119+
<Compile Include="Settings\LocalConfigurationSource.cs" />
120+
<Compile Include="Settings\SignalSettings.cs" />
117121
<Compile Include="SignalWebSocket.cs" />
118122
<Compile Include="Util\LibUtils.cs" />
119123
<Compile Include="Migrations\LibsignalDB\20170806145530_ls1.cs" />
@@ -167,7 +171,7 @@
167171
</ItemGroup>
168172
<ItemGroup>
169173
<PackageReference Include="libsignal-service-dotnet">
170-
<Version>2.10.0</Version>
174+
<Version>2.10.0.1</Version>
171175
</PackageReference>
172176
<PackageReference Include="Microsoft.EntityFrameworkCore">
173177
<Version>1.1.5</Version>
@@ -181,18 +185,29 @@
181185
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools">
182186
<Version>1.1.5</Version>
183187
</PackageReference>
188+
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions">
189+
<Version>1.1.2</Version>
190+
</PackageReference>
184191
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
185-
<Version>6.1.5</Version>
192+
<Version>6.2.12</Version>
186193
</PackageReference>
187194
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications">
188-
<Version>3.0.0</Version>
195+
<Version>6.1.1</Version>
189196
</PackageReference>
190197
</ItemGroup>
191198
<ItemGroup>
192199
<SDKReference Include="WindowsMobile, Version=10.0.16299.0">
193200
<Name>Windows Mobile Extensions for the UWP</Name>
194201
</SDKReference>
195202
</ItemGroup>
203+
<ItemGroup>
204+
<Content Include="Settings\appsettings.json">
205+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
206+
</Content>
207+
<Content Include="Settings\appsettings.production.json">
208+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
209+
</Content>
210+
</ItemGroup>
196211
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
197212
<VisualStudioVersion>14.0</VisualStudioVersion>
198213
</PropertyGroup>

‎Signal-Windows.Lib/SignalLibHandle.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ private void InitNetwork()
975975
try
976976
{
977977
Logger.LogTrace("InitNetwork() sync context = {0}", SynchronizationContext.Current);
978-
MessageReceiver = new SignalServiceMessageReceiver(LibUtils.ServiceConfiguration, new StaticCredentialsProvider(Store.Username, Store.Password, Store.SignalingKey, (int)Store.DeviceId), LibUtils.USER_AGENT);
978+
MessageReceiver = new SignalServiceMessageReceiver(LibUtils.ServiceConfiguration, new StaticCredentialsProvider(Store.Username, Store.Password, Store.SignalingKey, (int)Store.DeviceId), LibUtils.USER_AGENT, LibUtils.HttpClient);
979979
Task.Run(async () =>
980980
{
981981
try

‎Signal-Windows.Lib/SignalWebSocket.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public async Task ConnectAsync()
9696
if (e.Message.Contains("(403)"))
9797
{
9898
SemaphoreSlim.Release();
99-
throw new AuthorizationFailedException("OWS server rejected authorization.");
99+
throw new AuthorizationFailedException(403, "OWS server rejected authorization.");
100100
}
101101
Logger.LogError("ConnectAsync() failed: {0}\n{1}", e.Message, e.StackTrace); //System.Runtime.InteropServices.COMException (0x80072EE7)
102102
await Task.Delay(10 * 1000);

‎Signal-Windows.Lib/Util/LibUtils.cs

+22-16
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
1+
using System;
2+
using System.IO;
3+
using System.Net.Http;
4+
using System.Threading;
15
using libsignal.ecc;
26
using libsignalmetadatadotnet.certificate;
37
using libsignalservice;
48
using libsignalservice.configuration;
5-
using libsignalservice.push;
69
using libsignalservice.util;
710
using Microsoft.Extensions.Logging;
8-
using Microsoft.Toolkit.Uwp.Notifications;
9-
using System;
10-
using System.Collections.Generic;
11-
using System.IO;
12-
using System.Linq;
13-
using System.Text;
14-
using System.Threading;
15-
using System.Threading.Tasks;
11+
using Signal_Windows.Lib.Settings;
1612
using Windows.ApplicationModel;
17-
using Windows.Foundation.Metadata;
18-
using Windows.Networking.BackgroundTransfer;
1913
using Windows.Storage;
20-
using Windows.UI.Core;
21-
using Windows.UI.Notifications;
2214

2315
namespace Signal_Windows.Lib
2416
{
@@ -28,14 +20,28 @@ public class LibUtils
2820
public const string GlobalMutexName = "SignalWindowsPrivateMessenger_Mutex";
2921
public const string GlobalEventWaitHandleName = "SignalWindowsPrivateMessenger_EventWaitHandle";
3022
public static string UNIDENTIFIED_SENDER_TRUST_ROOT = "BXu6QIKVz5MA8gstzfOgRQGqyLqOwNKHL6INkv3IHWMF";
31-
public static string URL = "https://textsecure-service.whispersystems.org";
32-
public static SignalServiceUrl[] ServiceUrls = new SignalServiceUrl[] { new SignalServiceUrl("https://textsecure-service.whispersystems.org") };
33-
public static SignalServiceConfiguration ServiceConfiguration = new SignalServiceConfiguration(ServiceUrls, null);
23+
public static SignalServiceUrl[] ServiceUrls;
24+
public static SignalContactDiscoveryUrl[] ContactDiscoveryUrls;
25+
public static SignalServiceConfiguration ServiceConfiguration;
3426
public static bool MainPageActive = false;
3527
public static string USER_AGENT = "Signal-Windows";
3628
public static uint PREKEY_BATCH_SIZE = 100;
3729
public static bool WindowActive = false;
3830
public static Mutex GlobalLock;
31+
public static HttpClient HttpClient;
32+
public static AppConfig AppConfig;
33+
public static SignalSettings SignalSettings;
34+
35+
static LibUtils()
36+
{
37+
HttpClient = new HttpClient();
38+
AppConfig = new AppConfig();
39+
SignalSettings = AppConfig.GetSignalSettings();
40+
ServiceUrls = new SignalServiceUrl[] { new SignalServiceUrl(SignalSettings.ServiceUrl) };
41+
ContactDiscoveryUrls = new SignalContactDiscoveryUrl[] { new SignalContactDiscoveryUrl(SignalSettings.ContactDiscoveryServiceUrl) };
42+
ServiceConfiguration = new SignalServiceConfiguration(ServiceUrls, null, ContactDiscoveryUrls);
43+
}
44+
3945
private static SynchronizationContext GlobalLockContext;
4046

4147
internal static void Lock()

‎Signal-Windows.RC/Signal-Windows.RC.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@
112112
</ItemGroup>
113113
<ItemGroup>
114114
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
115-
<Version>6.1.5</Version>
115+
<Version>6.2.12</Version>
116116
</PackageReference>
117117
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications">
118-
<Version>3.0.0</Version>
118+
<Version>6.1.1</Version>
119119
</PackageReference>
120120
</ItemGroup>
121121
<ItemGroup>

‎Signal-Windows.sln

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio Version 16
3-
VisualStudioVersion = 16.0.29503.13
3+
VisualStudioVersion = 16.0.30907.101
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Signal-Windows", "Signal-Windows\Signal-Windows.csproj", "{41736A64-5B66-44AF-879A-501192A46920}"
66
ProjectSection(ProjectDependencies) = postProject

‎Signal-Windows/App.xaml.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,8 @@ sealed partial class App : Application
3535
{
3636
private static App Instance;
3737
private static ILogger Logger = LibsignalLogging.CreateLogger<App>();
38-
public static SignalServiceUrl[] ServiceUrls = new SignalServiceUrl[] { new SignalServiceUrl("https://textsecure-service.whispersystems.org") };
39-
public static SignalServiceConfiguration ServiceConfiguration = new SignalServiceConfiguration(ServiceUrls, null);
4038
public static StorageFolder LocalCacheFolder = ApplicationData.Current.LocalCacheFolder;
4139
public static bool MainPageActive = false;
42-
public static string USER_AGENT = "Signal-Windows";
4340
public static uint PREKEY_BATCH_SIZE = 100;
4441
public static ISignalLibHandle Handle = SignalHelper.CreateSignalLibHandle(false);
4542
private Dictionary<int, SignalWindowsFrontend> _Views = new Dictionary<int, SignalWindowsFrontend>();
@@ -102,7 +99,7 @@ private async void App_Suspending(object sender, SuspendingEventArgs e)
10299
private void OnUnhandledException(object sender, UnhandledExceptionEventArgs ex)
103100
{
104101
Exception e = ex.Exception;
105-
Logger.LogError("UnhandledException {0} occured ({1}):\n{2}", e.GetType(), e.Message, e.StackTrace);
102+
Logger.LogError("UnhandledException {0} occurred ({1}):\n{2}", e.GetType(), e.Message, e.StackTrace);
106103
}
107104

108105
protected override async void OnActivated(IActivatedEventArgs args)

‎Signal-Windows/Package.appxmanifest

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
<Certificates>
5050
<Certificate StoreName="TrustedPeople" Content="textsecure-servicewhispersystemsorg.crt" />
5151
<Certificate StoreName="TrustedPeople" Content="api-directory-signal-org.crt"/>
52+
<Certificate StoreName="TrustedPeople" Content="textsecure-service-staging-whispersystems-org.crt"/>
53+
<Certificate StoreName="TrustedPeople" Content="api-staging-directory-signal-org.crt"/>
5254
</Certificates>
5355
</Extension>
5456
</Extensions>

‎Signal-Windows/Signal-Windows.csproj

+7-4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
<UseVSHostingProcess>false</UseVSHostingProcess>
6666
<ErrorReport>prompt</ErrorReport>
6767
<Prefer32Bit>true</Prefer32Bit>
68+
<UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>
6869
</PropertyGroup>
6970
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
7071
<OutputPath>bin\ARM\Release\</OutputPath>
@@ -144,10 +145,12 @@
144145
<Content Include="Assets\Wide310x150Logo.scale-150.png" />
145146
<Content Include="Assets\Wide310x150Logo.scale-400.png" />
146147
<Content Include="api-directory-signal-org.crt" />
148+
<Content Include="api-staging-directory-signal-org.crt" />
147149
<None Include="Package.StoreAssociation.xml" />
148150
<None Include="Package.xml" />
149151
<Content Include="textsecure-servicewhispersystemsorg.crt" />
150152
<None Include="Signal-Windows_StoreKey.pfx" />
153+
<Content Include="textsecure-service-staging-whispersystems-org.crt" />
151154
</ItemGroup>
152155
<ItemGroup>
153156
<Compile Include="App.xaml.cs">
@@ -386,16 +389,16 @@
386389
</ItemGroup>
387390
<ItemGroup>
388391
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
389-
<Version>6.1.5</Version>
392+
<Version>6.2.12</Version>
390393
</PackageReference>
391394
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications">
392-
<Version>3.0.0</Version>
395+
<Version>6.1.1</Version>
393396
</PackageReference>
394397
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls">
395-
<Version>3.0.0</Version>
398+
<Version>4.0.0</Version>
396399
</PackageReference>
397400
<PackageReference Include="MvvmLight">
398-
<Version>5.4.1</Version>
401+
<Version>5.4.1.1</Version>
399402
</PackageReference>
400403
<PackageReference Include="QueryString.NET">
401404
<Version>1.0.0</Version>

‎Signal-Windows/Utils.cs

+11
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System.Globalization;
1010
using System.Threading.Tasks;
1111
using Windows.ApplicationModel;
12+
using Windows.ApplicationModel.Core;
1213
using Windows.Foundation;
1314
using Windows.Foundation.Metadata;
1415
using Windows.UI;
@@ -132,6 +133,16 @@ public static string GetColorFromBrush(SolidColorBrush brush)
132133
else { return GREY; }
133134
}
134135

136+
public static async Task CallOnMainViewUIThreadAsync(DispatchedHandler handler)
137+
{
138+
await CallOnUIThreadAsync(CoreApplication.MainView.CoreWindow.Dispatcher, handler);
139+
}
140+
141+
public static async Task CallOnUIThreadAsync(CoreDispatcher dispatcher, DispatchedHandler handler)
142+
{
143+
await dispatcher.RunAsync(CoreDispatcherPriority.Normal, handler);
144+
}
145+
135146
public static IMessageView CreateMessageView(SignalMessage message)
136147
{
137148
if (message.Type == SignalMessageType.IdentityKeyChange)

‎Signal-Windows/ViewModels/AddContactPageViewModel.cs

+6-4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using System.Globalization;
2323
using System.Threading;
2424
using Microsoft.Extensions.Logging;
25+
using Signal_Windows.Lib;
2526

2627
namespace Signal_Windows.ViewModels
2728
{
@@ -117,7 +118,7 @@ public async Task RefreshContacts(CancellationToken? cancellationToken = null)
117118
RefreshingContacts = true;
118119
Contacts.Clear();
119120
signalContacts.Clear();
120-
SignalServiceAccountManager accountManager = new SignalServiceAccountManager(App.ServiceConfiguration, App.Handle.Store.Username, App.Handle.Store.Password, (int)App.Handle.Store.DeviceId, App.USER_AGENT);
121+
SignalServiceAccountManager accountManager = new SignalServiceAccountManager(LibUtils.ServiceConfiguration, App.Handle.Store.Username, App.Handle.Store.Password, (int)App.Handle.Store.DeviceId, LibUtils.USER_AGENT, LibUtils.HttpClient);
121122
ContactStore contactStore = await ContactManager.RequestStoreAsync(ContactStoreAccessType.AllContactsReadOnly);
122123
List<PhoneContact> intermediateContacts = new List<PhoneContact>();
123124
if (contactStore != null)
@@ -191,11 +192,12 @@ public async Task RefreshContacts(CancellationToken? cancellationToken = null)
191192
}
192193
}
193194

194-
var signalContactDetails = await accountManager.GetContacts(cancelSource.Token, intermediateContacts.Select(c => c.PhoneNumber).ToList());
195+
List<string> intermediateContactPhoneNumbers = intermediateContacts.Select(c => c.PhoneNumber).ToList();
196+
var registeredUsers = await accountManager.GetRegisteredUsersAsync(intermediateContactPhoneNumbers, LibUtils.SignalSettings.ContactDiscoveryServiceEnclaveId, cancelSource.Token);
195197
foreach (var contact in intermediateContacts)
196198
{
197-
var foundContact = signalContactDetails.FirstOrDefault(c => c.Number == contact.PhoneNumber);
198-
if (foundContact != null)
199+
var foundContact = registeredUsers.FirstOrDefault(c => c.Key == contact.PhoneNumber).Key;
200+
if (!string.IsNullOrEmpty(foundContact))
199201
{
200202
contact.OnSignal = true;
201203
ContactAnnotation contactAnnotation = new ContactAnnotation

‎Signal-Windows/ViewModels/FinishRegistrationPageViewModel.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ await App.CurrentSignalWindowsFrontend(App.MainViewId).Locator.RegisterFinalizat
5757
/* create prekeys */
5858
await LibsignalDBContext.RefreshPreKeys(
5959
cancelSource.Token,
60-
new SignalServiceAccountManager(App.ServiceConfiguration, store.Username, store.Password, (int)store.DeviceId, App.USER_AGENT));
60+
new SignalServiceAccountManager(LibUtils.ServiceConfiguration, store.Username, store.Password, (int)store.DeviceId, LibUtils.USER_AGENT, LibUtils.HttpClient));
6161

6262
/* reload again with prekeys and their offsets */
6363
store = LibsignalDBContext.GetSignalStore();

‎Signal-Windows/ViewModels/LinkPageViewModel.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ await Task.Run(() =>
8282
});
8383

8484
// fetch new device uuid
85-
SignalServiceAccountManager accountManager = new SignalServiceAccountManager(App.ServiceConfiguration, "Signal-Windows", new SignalWebSocketFactory());
85+
SignalServiceAccountManager accountManager = new SignalServiceAccountManager(LibUtils.ServiceConfiguration, LibUtils.USER_AGENT, LibUtils.HttpClient, new SignalWebSocketFactory());
8686
string uuid = await accountManager.GetNewDeviceUuid(CancelSource.Token, new SignalWebSocketFactory());
8787
string tsdevice = "tsdevice:/?uuid=" + Uri.EscapeDataString(uuid) + "&pub_key=" + Uri.EscapeDataString(Base64.EncodeBytesWithoutPadding(tmpIdentity.getPublicKey().serialize()));
8888

@@ -117,7 +117,7 @@ await Task.Run(() =>
117117
App.Handle.Store = store;
118118

119119
// create prekeys
120-
await LibsignalDBContext.RefreshPreKeys(CancelSource.Token, new SignalServiceAccountManager(App.ServiceConfiguration, store.Username, store.Password, (int)store.DeviceId, App.USER_AGENT));
120+
await LibsignalDBContext.RefreshPreKeys(CancelSource.Token, new SignalServiceAccountManager(LibUtils.ServiceConfiguration, store.Username, store.Password, (int)store.DeviceId, LibUtils.USER_AGENT, LibUtils.HttpClient));
121121

122122
// reload again with prekeys and their offsets
123123
App.Handle.Store = LibsignalDBContext.GetSignalStore();

‎Signal-Windows/ViewModels/RegisterFinalizationPageViewModel.cs

+2-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using libsignal.util;
44
using libsignalservice;
55
using libsignalservice.util;
6+
using Signal_Windows.Lib;
67
using Signal_Windows.Models;
78
using Signal_Windows.Storage;
89
using Signal_Windows.Views;
@@ -69,19 +70,14 @@ internal async Task OnNavigatedTo()
6970
}
7071
catch(Exception e)
7172
{
72-
var title = e.Message;
73-
var content = "Please ensure your phone number is correct and your device is connected to the internet.";
74-
MessageDialog dialog = new MessageDialog(content, title);
75-
var result = dialog.ShowAsync();
7673
View.Frame.Navigate(typeof(RegisterPage));
7774
}
7875
}
7976

8077
private async Task<SignalServiceAccountManager> InitRegistration(bool voice)
8178
{
8279
App.Handle.PurgeAccountData();
83-
SignalServiceAccountManager accountManager = new SignalServiceAccountManager(App.ServiceConfiguration, App.CurrentSignalWindowsFrontend(App.MainViewId).Locator.RegisterPageInstance.FinalNumber, Password, 1 /*device id isn't actually used*/, App.USER_AGENT);
84-
if (voice)
80+
SignalServiceAccountManager accountManager = new SignalServiceAccountManager(LibUtils.ServiceConfiguration, App.CurrentSignalWindowsFrontend(App.MainViewId).Locator.RegisterPageInstance.FinalNumber, Password, 1 /*device id isn't actually used*/, LibUtils.USER_AGENT, LibUtils.HttpClient);
8581
{
8682
await accountManager.RequestVoiceVerificationCode(CancelSource.Token);
8783
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIEQDCCAyigAwIBAgICEDswDQYJKoZIhvcNAQELBQAwgY0xCzAJBgNVBAYTAlVT
3+
MRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMR0w
4+
GwYDVQQKDBRPcGVuIFdoaXNwZXIgU3lzdGVtczEdMBsGA1UECwwUT3BlbiBXaGlz
5+
cGVyIFN5c3RlbXMxEzARBgNVBAMMClRleHRTZWN1cmUwHhcNMTkwNjAxMDAwMDAw
6+
WhcNMzEwMTA5MDMzODQ4WjCBizELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlm
7+
b3JuaWExHTAbBgNVBAoMFE9wZW4gV2hpc3BlciBTeXN0ZW1zMR0wGwYDVQQLDBRP
8+
cGVuIFdoaXNwZXIgU3lzdGVtczEpMCcGA1UEAwwgYXBpLXN0YWdpbmcuZGlyZWN0
9+
b3J5LnNpZ25hbC5vcmcwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDC
10+
W8XIRtpbvAfl20N8qTqGXCsSh6t56xc6JQqVxKp3D1c3Rmkeok34kyFoY0ASZ5We
11+
whK4qb8lwh+XKWCwPrSD4PflfdwYE6Zj5HqRNtIkxpU2eNSnjTG20y1gZa/zvvRJ
12+
624G9eXk/W3MdBPJm6XwmstwnApCljRFeK+sAAIz3wWF4xK4q1dlExSYo/+P5fYA
13+
lYsIvr6xdG2jAwWryQijbcjXEeqNZZ0P7G3nomv3in3rqYJsQt5ooZl+/g4/pVlS
14+
8eKIqeBSeyx2WFAZS8XLyZ8GYNNkQUsJtRSENlHsudBHo6zmX4vvfI3A3kl9D6yf
15+
zdfn/dHnNFXjFz1cgnytAgMBAAGjgakwgaYwCQYDVR0TBAIwADAsBglghkgBhvhC
16+
AQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFDwg
17+
LNfkZMeCu59TURlhRALnil+/MB8GA1UdIwQYMBaAFAGLGPE/+zkZRG6Fhr6UZTKn
18+
MjyQMCsGA1UdEQQkMCKCIGFwaS1zdGFnaW5nLmRpcmVjdG9yeS5zaWduYWwub3Jn
19+
MA0GCSqGSIb3DQEBCwUAA4IBAQAQaTCZfjRiU8nPkphjca0jYXChN/jXDxpdX/fH
20+
S7C6gSd6orAvAv9IXDuT76WJWJgQvk0pf+qiWghZUAYPUp/bSeF2ujIrPdzTdtoG
21+
MZfgqu+gfyKJI0U/5KcZIAT29bWGE5XMQK3h4Z5yhWEWa7YTWpDP8TevxgjbkA6T
22+
mrkT4qbH2pInb4iDFWyJQfJIPbKe2a57qEMkMpHsNlNGvUE3D1UWjEX/lJUv1mVm
23+
fkuDurf+429N1RmnxPaCToKp1mwUHh/f/jPZOf1tbEqWbxHBm2vomuOk6ERHWwJc
24+
emfnutybrXA9vUrW6ECAMYL36JxMf4wjWhUNdPZSQsbNufqA
25+
-----END CERTIFICATE-----
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIID+zCCAuOgAwIBAgICEBUwDQYJKoZIhvcNAQELBQAwgY0xCzAJBgNVBAYTAlVT
3+
MRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMR0w
4+
GwYDVQQKDBRPcGVuIFdoaXNwZXIgU3lzdGVtczEdMBsGA1UECwwUT3BlbiBXaGlz
5+
cGVyIFN5c3RlbXMxEzARBgNVBAMMClRleHRTZWN1cmUwHhcNMTkwMjE1MTczODE3
6+
WhcNMjkwMzEyMTgxNzUwWjCBmDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlm
7+
b3JuaWExHTAbBgNVBAoMFE9wZW4gV2hpc3BlciBTeXN0ZW1zMR0wGwYDVQQLDBRP
8+
cGVuIFdoaXNwZXIgU3lzdGVtczE2MDQGA1UEAwwtdGV4dHNlY3VyZS1zZXJ2aWNl
9+
LXN0YWdpbmcud2hpc3BlcnN5c3RlbXMub3JnMIIBIjANBgkqhkiG9w0BAQEFAAOC
10+
AQ8AMIIBCgKCAQEAq+R2DEZS27gxQO5dCnzmKpcKkR0qf3RNxiKjcXbvXy+Ev8AG
11+
ENDfTeBUX7UV+qz+mOO58rlHXbDnHgPJE47UoOhbaWSfSMsmeflBDRfA7aO1k3Yn
12+
TQB5jTxH2IEyZNOPaSOGWnqReMSlkcrzsfQMmwaNWxcBBquOnmnVrnQIH6ORUl5X
13+
PrTyhak/va4jdxfbsZKthuWJ6WhfW3MCwI/hsKrwK3eT7mVG9widhRoIYLER7DTy
14+
rqIv124quOjqsy8uqFIglCHGHeKtz8zbyh2dFtnwNQiDF/JPWAAZwHPpgeZgQET5
15+
s6nT5wG4Xio7uesrkih1acXiSCyWILNKmm10+wIDAQABo1gwVjBUBgNVHREETTBL
16+
gi10ZXh0c2VjdXJlLXNlcnZpY2Utc3RhZ2luZy53aGlzcGVyc3lzdGVtcy5vcmeC
17+
GnNlcnZpY2Utc3RhZ2luZy5zaWduYWwub3JnMA0GCSqGSIb3DQEBCwUAA4IBAQC3
18+
2VRSxXJio8b5WLHT5NVXMw+oxZ9MR5vpuWBTleLh3SUx0Ach0Qdsi1sqYNqXyI9I
19+
UhlZFZNAiebe/t4BSGYa7H9Pfj0LQfKCWElHCLjAvVPod/fD4LPipyS0lhA0DjAu
20+
FLmEBvIc6JxnM/KX4qJGfek+IvuHwXYMkIplq5N8f0G8uN3zV2s58fSgXcxYi2nk
21+
VzS0CLcxcopDxxZCrW1PQihFdIEsi5/yL2C4sKI5luiBGdjv5/ei1mBk8jD7oszL
22+
Etgz6o+I7uxjOny6+tAxchSeAJc0/y95EZSdSYwaEAen8F19SIAnrpRU4ljgQrG9
23+
yIchV8zNxKkUYpEt2D++
24+
-----END CERTIFICATE-----

0 commit comments

Comments
 (0)
Please sign in to comment.