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 77d8d28 commit 658b4e0
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,23 +232,25 @@ public JSONArray generatePreKeys(int nextPreKeyId, int count) {
}


public JSONObject initialize(String userId, String password) throws Exception {
public JSONObject initialize(String userId, String password) {
try {
System.out.println("INITIALIZINGXXXX");
Log.d("INITALIZINGXXX", "LOGXXX");
HashMap<String, String> serviceMap = new HashMap();
serviceMap.put("service", context.getPackageName());
keychain.setGenericPassword(context.getPackageName(), "password", password, serviceMap);

System.out.println("INITIALIZINGXXXX1");
SignalProtocolStore store = new MySignalProtocolStore(context);
IdentityKeyUtil.generateIdentityKeys(context);
IdentityKeyPair identityKey = store.getIdentityKeyPair();

System.out.println("INITIALIZINGXXXX2");
SignedPreKeyRecord signedPreKey = PreKeyUtil.generateSignedPreKey(context, identityKey, true);

List<PreKeyRecord> preKeys = PreKeyUtil.generatePreKeys(context, 0, 10);
ArrayList<Object> preKeysArray = new ArrayList();
System.out.println("INITIALIZINGXXX3");
for (int i = 1; i < preKeys.size(); i++) {
System.out.println("INITIALIZINGXXXX4");
HashMap<String, Object> map = new HashMap();
map.put("id", preKeys.get(i).getId());
map.put("public", Base64.encodeBytes(preKeys.get(i).getKeyPair().getPublicKey().serialize()));
Expand Down Expand Up @@ -303,6 +305,7 @@ public JSONObject initialize(String userId, String password) throws Exception {
identityKey.getPublicKey()
);
sessionBuilder.process(preKeyBundle);
System.out.println("INITIALIZINGXXXX999 " + map.toString());
return map;
} catch (Exception e) {
e.printStackTrace();
Expand Down

0 comments on commit 658b4e0

Please sign in to comment.