public abstract class FileBasedOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph> extends OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
Modifier and Type | Class and Description |
---|---|
static class |
FileBasedOmemoStore.FileHierarchy
This class represents the directory structure of the FileBasedOmemoStoreV2.
|
Constructor and Description |
---|
FileBasedOmemoStore() |
FileBasedOmemoStore(File basePath) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsRawSession(OmemoManager omemoManager,
OmemoDevice device)
Return true, if we have a session with the device, otherwise false.
|
static void |
deleteDirectory(File root) |
void |
distrustOmemoIdentity(OmemoManager omemoManager,
OmemoDevice device,
OmemoFingerprint fingerprint) |
Date |
getDateOfLastReceivedMessage(OmemoManager omemoManager,
OmemoDevice from)
Return the date in millis of the last message that was received from device 'from'.
|
Date |
getDateOfLastSignedPreKeyRenewal(OmemoManager omemoManager)
Get the date in millis of the last time the signed preKey was renewed.
|
int |
getDefaultDeviceId(org.jxmpp.jid.BareJid user)
Return the default deviceId for a user.
|
boolean |
isDecidedOmemoIdentity(OmemoManager omemoManager,
OmemoDevice device,
OmemoFingerprint fingerprint) |
boolean |
isFreshInstallation(OmemoManager omemoManager)
Return true if this is a fresh installation.
|
boolean |
isTrustedOmemoIdentity(OmemoManager omemoManager,
OmemoDevice device,
OmemoFingerprint fingerprint) |
HashMap<Integer,T_Sess> |
loadAllRawSessionsOf(OmemoManager omemoManager,
org.jxmpp.jid.BareJid contact)
Load all crypto-lib specific session objects of contact 'contact'.
|
CachedDeviceList |
loadCachedDeviceList(OmemoManager omemoManager,
org.jxmpp.jid.BareJid contact)
Load a list of deviceIds from contact 'contact' from the local cache.
|
int |
loadCurrentSignedPreKeyId(OmemoManager omemoManager)
Return the id of the currently used signed preKey.
|
int |
loadLastPreKeyId(OmemoManager omemoManager)
Return the id of the last generated preKey.
|
T_IdKey |
loadOmemoIdentityKey(OmemoManager omemoManager,
OmemoDevice device)
Load the public identityKey of the device.
|
T_IdKeyPair |
loadOmemoIdentityKeyPair(OmemoManager omemoManager)
Load our identityKeyPair from storage.
|
T_PreKey |
loadOmemoPreKey(OmemoManager omemoManager,
int preKeyId)
Load the preKey with id 'preKeyId' from storage.
|
HashMap<Integer,T_PreKey> |
loadOmemoPreKeys(OmemoManager omemoManager)
Return all our current OmemoPreKeys.
|
T_SigPreKey |
loadOmemoSignedPreKey(OmemoManager omemoManager,
int signedPreKeyId)
Return the signedPreKey with the id 'singedPreKeyId'.
|
HashMap<Integer,T_SigPreKey> |
loadOmemoSignedPreKeys(OmemoManager omemoManager)
Load all our signed PreKeys.
|
T_Sess |
loadRawSession(OmemoManager omemoManager,
OmemoDevice device)
Load the crypto-lib specific session object of the device from storage.
|
void |
purgeOwnDeviceKeys(OmemoManager omemoManager)
Delete this device's IdentityKey, PreKeys, SignedPreKeys and Sessions.
|
void |
removeAllRawSessionsOf(OmemoManager omemoManager,
org.jxmpp.jid.BareJid contact)
Remove all crypto-lib specific session of a contact.
|
void |
removeOmemoPreKey(OmemoManager omemoManager,
int preKeyId)
remove a preKey from storage.
|
void |
removeOmemoSignedPreKey(OmemoManager omemoManager,
int signedPreKeyId)
Remove a signedPreKey from storage.
|
void |
removeRawSession(OmemoManager omemoManager,
OmemoDevice device)
Remove a crypto-lib specific session from storage.
|
void |
setDateOfLastReceivedMessage(OmemoManager omemoManager,
OmemoDevice from,
Date date)
Set the date in millis of the last message that was received from device 'from' to 'date'.
|
void |
setDateOfLastSignedPreKeyRenewal(OmemoManager omemoManager,
Date date)
Set the date in millis of the last time the signed preKey was renewed.
|
void |
setDefaultDeviceId(org.jxmpp.jid.BareJid user,
int defaultDeviceId)
Set the default deviceId of a user.
|
void |
storeCachedDeviceList(OmemoManager omemoManager,
org.jxmpp.jid.BareJid contact,
CachedDeviceList deviceList)
Store the DeviceList of the contact in local storage.
|
void |
storeCurrentSignedPreKeyId(OmemoManager omemoManager,
int currentSignedPreKeyId)
Store the id of the currently used signedPreKey.
|
void |
storeLastPreKeyId(OmemoManager omemoManager,
int currentPreKeyId)
Store the id of the last preKey we generated.
|
void |
storeOmemoIdentityKey(OmemoManager omemoManager,
OmemoDevice device,
T_IdKey t_idKey)
Store the public identityKey of the device.
|
void |
storeOmemoIdentityKeyPair(OmemoManager omemoManager,
T_IdKeyPair identityKeyPair)
Store our identityKeyPair in storage.
|
void |
storeOmemoPreKey(OmemoManager omemoManager,
int preKeyId,
T_PreKey t_preKey)
Store a PreKey in storage.
|
void |
storeOmemoSignedPreKey(OmemoManager omemoManager,
int signedPreKeyId,
T_SigPreKey signedPreKey)
Store a signedPreKey in storage.
|
void |
storeRawSession(OmemoManager omemoManager,
OmemoDevice device,
T_Sess session)
Store a crypto-lib specific session to storage.
|
void |
trustOmemoIdentity(OmemoManager omemoManager,
OmemoDevice device,
OmemoFingerprint fingerprint) |
distrustOmemoIdentity, generateOmemoIdentityKeyPair, generateOmemoPreKeys, generateOmemoSignedPreKey, getFingerprint, getFingerprint, getOmemoSessionOf, isDecidedOmemoIdentity, isTrustedOmemoIdentity, keyUtil, setDateOfLastReceivedMessage, setDateOfLastSignedPreKeyRenewal, storeOmemoPreKeys, trustOmemoIdentity
public FileBasedOmemoStore()
public FileBasedOmemoStore(File basePath)
public boolean isFreshInstallation(OmemoManager omemoManager)
OmemoStore
isFreshInstallation
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.public int getDefaultDeviceId(org.jxmpp.jid.BareJid user)
OmemoStore
getDefaultDeviceId
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
user
- userpublic void setDefaultDeviceId(org.jxmpp.jid.BareJid user, int defaultDeviceId)
OmemoStore
setDefaultDeviceId
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
user
- userdefaultDeviceId
- defaultDeviceIdpublic int loadLastPreKeyId(OmemoManager omemoManager)
OmemoStore
loadLastPreKeyId
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.public void storeLastPreKeyId(OmemoManager omemoManager, int currentPreKeyId)
OmemoStore
storeLastPreKeyId
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.currentPreKeyId
- the id of the last generated PreKeypublic T_IdKeyPair loadOmemoIdentityKeyPair(OmemoManager omemoManager) throws CorruptedOmemoKeyException
OmemoStore
loadOmemoIdentityKeyPair
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.CorruptedOmemoKeyException
- Thrown, if the stored key is damaged (*hands up* not my fault!)public void storeOmemoIdentityKeyPair(OmemoManager omemoManager, T_IdKeyPair identityKeyPair)
OmemoStore
storeOmemoIdentityKeyPair
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.identityKeyPair
- identityKeyPairpublic T_IdKey loadOmemoIdentityKey(OmemoManager omemoManager, OmemoDevice device) throws CorruptedOmemoKeyException
OmemoStore
loadOmemoIdentityKey
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.device
- deviceCorruptedOmemoKeyException
- when the key in question is corrupted and cant be deserialized.public void storeOmemoIdentityKey(OmemoManager omemoManager, OmemoDevice device, T_IdKey t_idKey)
OmemoStore
storeOmemoIdentityKey
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.device
- devicet_idKey
- identityKeypublic boolean isTrustedOmemoIdentity(OmemoManager omemoManager, OmemoDevice device, OmemoFingerprint fingerprint)
isTrustedOmemoIdentity
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
public boolean isDecidedOmemoIdentity(OmemoManager omemoManager, OmemoDevice device, OmemoFingerprint fingerprint)
isDecidedOmemoIdentity
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
public void trustOmemoIdentity(OmemoManager omemoManager, OmemoDevice device, OmemoFingerprint fingerprint)
trustOmemoIdentity
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
public void distrustOmemoIdentity(OmemoManager omemoManager, OmemoDevice device, OmemoFingerprint fingerprint)
distrustOmemoIdentity
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
public void setDateOfLastReceivedMessage(OmemoManager omemoManager, OmemoDevice from, Date date)
OmemoStore
setDateOfLastReceivedMessage
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.from
- device in questiondate
- date of the last received messagepublic Date getDateOfLastReceivedMessage(OmemoManager omemoManager, OmemoDevice from)
OmemoStore
getDateOfLastReceivedMessage
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.from
- device in questionpublic void setDateOfLastSignedPreKeyRenewal(OmemoManager omemoManager, Date date)
OmemoStore
setDateOfLastSignedPreKeyRenewal
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.date
- datepublic Date getDateOfLastSignedPreKeyRenewal(OmemoManager omemoManager)
OmemoStore
getDateOfLastSignedPreKeyRenewal
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.public T_PreKey loadOmemoPreKey(OmemoManager omemoManager, int preKeyId)
OmemoStore
loadOmemoPreKey
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.preKeyId
- id of the key to be loadedpublic void storeOmemoPreKey(OmemoManager omemoManager, int preKeyId, T_PreKey t_preKey)
OmemoStore
storeOmemoPreKey
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.preKeyId
- id of the keyt_preKey
- keypublic void removeOmemoPreKey(OmemoManager omemoManager, int preKeyId)
OmemoStore
removeOmemoPreKey
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.preKeyId
- id of the used key that will be deletedpublic int loadCurrentSignedPreKeyId(OmemoManager omemoManager)
OmemoStore
loadCurrentSignedPreKeyId
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.public void storeCurrentSignedPreKeyId(OmemoManager omemoManager, int currentSignedPreKeyId)
OmemoStore
storeCurrentSignedPreKeyId
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.currentSignedPreKeyId
- if of the signedPreKey that is currently in usepublic HashMap<Integer,T_PreKey> loadOmemoPreKeys(OmemoManager omemoManager)
OmemoStore
loadOmemoPreKeys
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.public T_SigPreKey loadOmemoSignedPreKey(OmemoManager omemoManager, int signedPreKeyId)
OmemoStore
loadOmemoSignedPreKey
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.signedPreKeyId
- id of the keypublic HashMap<Integer,T_SigPreKey> loadOmemoSignedPreKeys(OmemoManager omemoManager)
OmemoStore
loadOmemoSignedPreKeys
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.public void storeOmemoSignedPreKey(OmemoManager omemoManager, int signedPreKeyId, T_SigPreKey signedPreKey)
OmemoStore
storeOmemoSignedPreKey
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.signedPreKeyId
- id of the signedPreKeysignedPreKey
- the key itselfpublic void removeOmemoSignedPreKey(OmemoManager omemoManager, int signedPreKeyId)
OmemoStore
removeOmemoSignedPreKey
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.signedPreKeyId
- id of the key that will be removedpublic T_Sess loadRawSession(OmemoManager omemoManager, OmemoDevice device)
OmemoStore
loadRawSession
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.device
- device whose session we want to loadpublic HashMap<Integer,T_Sess> loadAllRawSessionsOf(OmemoManager omemoManager, org.jxmpp.jid.BareJid contact)
OmemoStore
loadAllRawSessionsOf
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.contact
- BareJid of the contact we want to get all sessions frompublic void storeRawSession(OmemoManager omemoManager, OmemoDevice device, T_Sess session)
OmemoStore
storeRawSession
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.device
- OmemoDevice whose session we want to storesession
- sessionpublic void removeRawSession(OmemoManager omemoManager, OmemoDevice device)
OmemoStore
removeRawSession
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.device
- device whose session we want to deletepublic void removeAllRawSessionsOf(OmemoManager omemoManager, org.jxmpp.jid.BareJid contact)
OmemoStore
removeAllRawSessionsOf
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.contact
- BareJid of the contactpublic boolean containsRawSession(OmemoManager omemoManager, OmemoDevice device)
OmemoStore
containsRawSession
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.device
- devicepublic CachedDeviceList loadCachedDeviceList(OmemoManager omemoManager, org.jxmpp.jid.BareJid contact)
OmemoStore
loadCachedDeviceList
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.contact
- contact we want to get the deviceList ofpublic void storeCachedDeviceList(OmemoManager omemoManager, org.jxmpp.jid.BareJid contact, CachedDeviceList deviceList)
OmemoStore
storeCachedDeviceList
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.contact
- ContactdeviceList
- list of the contacts devices' ids.public void purgeOwnDeviceKeys(OmemoManager omemoManager)
OmemoStore
purgeOwnDeviceKeys
in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
omemoManager
- omemoManager of our device.public static void deleteDirectory(File root)