Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarBasem committed Mar 27, 2021
1 parent 3882799 commit 36586d8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -433,25 +433,26 @@ public JSONObject initialize(String userId, String password, ProgressEvent progr
signedPreKeyJson.put("salt", signedCipherMap.get("salt"));
signedPreKeyJson.put("timestamp", Long.toString(signedPreKey.getTimestamp()));

int localId = KeyHelper.generateRegistrationId(false);
Preferences.setLocalRegistrationId(context, localId);
JSONObject identityKeyJson = new JSONObject();
identityKeyJson.put("id", Preferences.getActiveIdentityKeyId(context));
identityKeyJson.put("public", Base64.encodeBytes(identityKey.getPublicKey().serialize()));
identityKeyJson.put("localId", localId);
HashMap<String, String> identityCipherMap = pbEncrypt(identityKey.getPrivateKey().serialize(), password);
identityKeyJson.put("cipher", identityCipherMap.get("cipher"));
identityKeyJson.put("salt", identityCipherMap.get("salt"));
identityKeyJson.put("timestamp", Preferences.getActiveIdentityKeyTimestamp(context));

String oneTimeId = UUID.randomUUID().toString();
int localId = KeyHelper.generateRegistrationId(false);
Preferences.setLocalRegistrationId(context, localId);
JSONObject map = new JSONObject();
map.put("identityKey", identityKeyJson);
map.put("signedPreKey", signedPreKeyJson);
map.put("preKeys", preKeysArray);
map.put("passwordHash", passwordHash);
map.put("passwordSalt", Base64.encodeBytes(salt));
map.put("oneTimeId", oneTimeId);
map.put("localId", localId);

PreferenceManager.getDefaultSharedPreferences(context).edit().putString("oneTimeId", oneTimeId).apply();
PreferenceManager.getDefaultSharedPreferences(context).edit().putString("userId", userId).apply();

Expand Down
2 changes: 1 addition & 1 deletion server/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = stick-protocol-server
version = 1.1.52
version = 1.1.54
description = Stick protocol server for Django.
long_description = file: README.rst
long_description_content_type = text/x-rst
Expand Down
2 changes: 1 addition & 1 deletion server/stick_protocol/stick_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def process_pre_key_bundle(self, data, user):
user.passwordSalt = data["passwordSalt"]
user.set_password(data["passwordHash"]) # This will create a "Double-Hashed" password
user.oneTimeId = data["oneTimeId"]
user.SPID = data['SPID']
user.localId = data['localId']
user.nextPreKeyId = data['nextPreKeyId']
user.finishedRegistration = True
user.save()
Expand Down

0 comments on commit 36586d8

Please sign in to comment.