mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-24 20:21:27 +00:00
37 lines
1.2 KiB
Java
37 lines
1.2 KiB
Java
![]() |
package org.thoughtcrime.securesms.crypto;
|
||
|
|
||
|
import android.content.Context;
|
||
|
|
||
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||
|
import org.whispersystems.libaxolotl.IdentityKey;
|
||
|
import org.whispersystems.libaxolotl.IdentityKeyPair;
|
||
|
import org.whispersystems.libaxolotl.state.IdentityKeyStore;
|
||
|
import org.whispersystems.textsecure.crypto.MasterSecret;
|
||
|
|
||
|
public class TextSecureIdentityKeyStore implements IdentityKeyStore {
|
||
|
|
||
|
private final Context context;
|
||
|
private final MasterSecret masterSecret;
|
||
|
|
||
|
public TextSecureIdentityKeyStore(Context context, MasterSecret masterSecret) {
|
||
|
this.context = context;
|
||
|
this.masterSecret = masterSecret;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public IdentityKeyPair getIdentityKeyPair() {
|
||
|
return IdentityKeyUtil.getIdentityKeyPair(context, masterSecret);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public int getLocalRegistrationId() {
|
||
|
return TextSecurePreferences.getLocalRegistrationId(context);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void saveIdentity(long recipientId, IdentityKey identityKey) {
|
||
|
DatabaseFactory.getIdentityDatabase(context).saveIdentity(masterSecret, recipientId, identityKey);
|
||
|
}
|
||
|
}
|