public static int getSessionVersion( Context context, MasterSecret masterSecret, CanonicalRecipient recipient) { if (SessionRecordV2.hasSession( context, masterSecret, recipient.getRecipientId(), RecipientDevice.DEFAULT_DEVICE_ID)) { return new SessionRecordV2( context, masterSecret, recipient.getRecipientId(), RecipientDevice.DEFAULT_DEVICE_ID) .getSessionVersion(); } else if (SessionRecordV1.hasSession(context, recipient)) { return new SessionRecordV1(context, masterSecret, recipient).getSessionVersion(); } return 0; }
public static IdentityKey getRemoteIdentityKey( Context context, MasterSecret masterSecret, long recipientId) { if (SessionRecordV2.hasSession( context, masterSecret, recipientId, RecipientDevice.DEFAULT_DEVICE_ID)) { return new SessionRecordV2( context, masterSecret, recipientId, RecipientDevice.DEFAULT_DEVICE_ID) .getRemoteIdentityKey(); } else if (SessionRecordV1.hasSession(context, recipientId)) { return new SessionRecordV1(context, masterSecret, recipientId).getIdentityKey(); } else { return null; } }
private static boolean hasV2Session( Context context, MasterSecret masterSecret, CanonicalRecipient recipient) { return SessionRecordV2.hasSession( context, masterSecret, recipient.getRecipientId(), RecipientDevice.DEFAULT_DEVICE_ID); }
public static void abortSessionFor(Context context, CanonicalRecipient recipient) { Log.w("Session", "Aborting session, deleting keys..."); clearV1SessionFor(context, recipient); SessionRecordV2.deleteAll(context, recipient); }