+ public void finishRegistration(
+ final ACI aci,
+ final PNI pni,
+ final MasterKey masterKey,
+ final String pin,
+ final PreKeyCollection aciPreKeys,
+ final PreKeyCollection pniPreKeys
+ ) {
+ this.pinMasterKey = masterKey;
+ this.storageManifestVersion = -1;
+ this.setStorageManifest(null);
+ this.storageKey = null;
+ this.encryptedDeviceName = null;
+ this.deviceId = SignalServiceAddress.DEFAULT_DEVICE_ID;
+ this.isMultiDevice = false;
+ this.registered = true;
+ this.aci = aci;
+ this.pni = pni;
+ this.registrationLockPin = pin;
+ this.lastReceiveTimestamp = 0;
+ save();
+
+ setPreKeys(ServiceIdType.ACI, aciPreKeys);
+ setPreKeys(ServiceIdType.PNI, pniPreKeys);
+ aciAccountData.getSessionStore().archiveAllSessions();
+ pniAccountData.getSessionStore().archiveAllSessions();
+ getSenderKeyStore().deleteAll();
+ getRecipientTrustedResolver().resolveSelfRecipientTrusted(getSelfRecipientAddress());
+ trustSelfIdentity(ServiceIdType.ACI);
+ trustSelfIdentity(ServiceIdType.PNI);
+ }
+
+ public void initDatabase() {
+ getAccountDatabase();
+ }
+