multi-account
This commit is contained in:
parent
7ed9398009
commit
f0affaa332
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue