Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarBasem committed Feb 8, 2021
1 parent b6ce172 commit 244c346
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
Expand Down Expand Up @@ -243,15 +242,15 @@ public JSONObject initialize(String userId, String password) {
IdentityKeyPair identityKey = store.getIdentityKeyPair();
SignedPreKeyRecord signedPreKey = PreKeyUtil.generateSignedPreKey(context, identityKey, true);
List<PreKeyRecord> preKeys = PreKeyUtil.generatePreKeys(context, 0, 10);
ArrayList<Object> preKeysArray = new ArrayList<Object>();
JSONArray preKeysArray = new JSONArray();
for (int i = 1; i < preKeys.size(); i++) {
JSONObject preKey = new JSONObject();
preKey.put("id", preKeys.get(i).getId());
preKey.put("public", Base64.encodeBytes(preKeys.get(i).getKeyPair().getPublicKey().serialize()));
HashMap<String, String> cipherMap = pbEncrypt(preKeys.get(i).getKeyPair().getPrivateKey().serialize(), password);
preKey.put("cipher", cipherMap.get("cipher"));
preKey.put("salt", cipherMap.get("salt"));
preKeysArray.add(preKey);
preKeysArray.put(preKey);
// WritableMap params = Arguments.createMap();
// params.putInt("progress", i + 1);
// params.putInt("total", preKeys.size());
Expand Down

0 comments on commit 244c346

Please sign in to comment.