]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/manager/ProvisioningManager.java
Create an AvatarStore
[signal-cli] / src / main / java / org / asamk / signal / manager / ProvisioningManager.java
index f81cfa49acfe1f7ad5087ddf936eb63f4ccb891f..0648c0d38b6b500e8101ace2e6aeb27192248dad 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2015-2020 AsamK and contributors
+  Copyright (C) 2015-2021 AsamK and contributors
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -16,7 +16,8 @@
  */
 package org.asamk.signal.manager;
 
-import org.asamk.signal.storage.SignalAccount;
+import org.asamk.signal.manager.storage.SignalAccount;
+import org.asamk.signal.manager.util.KeyUtils;
 import org.signal.zkgroup.InvalidInputException;
 import org.signal.zkgroup.profiles.ProfileKey;
 import org.whispersystems.libsignal.IdentityKeyPair;
@@ -51,7 +52,7 @@ public class ProvisioningManager {
         this.serviceConfiguration = serviceConfiguration;
         this.userAgent = userAgent;
 
-        identityKey = KeyHelper.generateIdentityKeyPair();
+        identityKey = KeyUtils.generateIdentityKeyPair();
         registrationId = KeyHelper.generateRegistrationId(false);
         password = KeyUtils.createPassword();
         final SleepTimer timer = new UptimeSleepTimer();
@@ -71,8 +72,7 @@ public class ProvisioningManager {
     public String getDeviceLinkUri() throws TimeoutException, IOException {
         String deviceUuid = accountManager.getNewDeviceUuid();
 
-        return Utils.createDeviceLinkUri(new Utils.DeviceLinkInfo(deviceUuid,
-                identityKey.getPublicKey().getPublicKey()));
+        return new DeviceLinkInfo(deviceUuid, identityKey.getPublicKey().getPublicKey()).createDeviceLinkUri();
     }
 
     public String finishDeviceLink(String deviceName) throws IOException, InvalidKeyException, TimeoutException, UserAlreadyExists {
@@ -124,8 +124,10 @@ public class ProvisioningManager {
                 m.requestSyncBlocked();
                 m.requestSyncConfiguration();
 
-                m.saveAccount();
+                m.close(false);
             }
+
+            account.save();
         }
 
         return username;