multi-account

This commit is contained in:
Thomas 2021-02-23 19:15:10 +01:00
parent 7ed9398009
commit f0affaa332
2 changed files with 6 additions and 6 deletions

View File

@ -157,24 +157,24 @@ public class ECDH {
return base64Encode(getPair(context, account).getPublic().getEncoded());
}
void saveServerKey(Context context, String strPeerPublic) {
void saveServerKey(Context context, Account account, String strPeerPublic) {
SharedPreferences.Editor prefsEditor = PreferenceManager
.getDefaultSharedPreferences(context).edit();
prefsEditor.putString(peer_public, strPeerPublic);
prefsEditor.putString(peer_public + account.getId() + account.getInstance(), strPeerPublic);
prefsEditor.commit();
}
PublicKey getServerKey(Context context) throws Exception {
PublicKey getServerKey(Context context, Account account) throws Exception {
return readPublicKey(
PreferenceManager.getDefaultSharedPreferences(context)
.getString(peer_public, "")
.getString(peer_public + account.getId() + account.getInstance(), "")
);
}
byte[] getSecret(Context context, Account account) {
try {
return generateSecret(getPair(context, account).getPrivate(), getServerKey(context));
return generateSecret(getPair(context, account).getPrivate(), getServerKey(context, account));
} catch (Exception e) {
e.printStackTrace();
return null;

View File

@ -21,7 +21,7 @@ public class PushNotifications {
//register
ecdh.saveServerKey(context, server_key);
ecdh.saveServerKey(context, account, server_key);
}
public static void getDistributors(Context context) {