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 FileBasedOmemoStore.
|
| Constructor and Description |
|---|
FileBasedOmemoStore(java.io.File basePath) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsRawSession(OmemoDevice userDevice,
OmemoDevice contactsDevice)
Return true, if we have a session with the device, otherwise false.
|
static void |
deleteDirectory(java.io.File root)
Delete a directory with all subdirectories.
|
java.util.Date |
getDateOfLastDeviceIdPublication(OmemoDevice userDevice,
OmemoDevice contactsDevice)
Return the date of the last time the deviceId was published after previously being not published.
|
java.util.Date |
getDateOfLastReceivedMessage(OmemoDevice userDevice,
OmemoDevice contactsDevice)
Return the date of the last message that was received from device 'from'.
|
java.util.Date |
getDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice)
Get the date of the last time the signed preKey was renewed.
|
java.util.HashMap<java.lang.Integer,T_Sess> |
loadAllRawSessionsOf(OmemoDevice userDevice,
org.jxmpp.jid.BareJid contact)
Load all crypto-lib specific session objects of contact 'contact'.
|
OmemoCachedDeviceList |
loadCachedDeviceList(OmemoDevice userDevice,
org.jxmpp.jid.BareJid contact)
Load a list of deviceIds from contact 'contact' from the local cache.
|
T_IdKey |
loadOmemoIdentityKey(OmemoDevice userDevice,
OmemoDevice contactsDevice)
Load the public identityKey of a device.
|
T_IdKeyPair |
loadOmemoIdentityKeyPair(OmemoDevice userDevice)
Load our identityKeyPair from storage.
|
int |
loadOmemoMessageCounter(OmemoDevice userDevice,
OmemoDevice contactsDevice)
Return the current value of the message counter.
|
T_PreKey |
loadOmemoPreKey(OmemoDevice userDevice,
int preKeyId)
Load the preKey with id 'preKeyId' from storage.
|
java.util.TreeMap<java.lang.Integer,T_PreKey> |
loadOmemoPreKeys(OmemoDevice userDevice)
Return all our current OmemoPreKeys.
|
T_SigPreKey |
loadOmemoSignedPreKey(OmemoDevice userDevice,
int signedPreKeyId)
Return the signedPreKey with the id 'singedPreKeyId'.
|
java.util.TreeMap<java.lang.Integer,T_SigPreKey> |
loadOmemoSignedPreKeys(OmemoDevice userDevice)
Load all our signed PreKeys.
|
T_Sess |
loadRawSession(OmemoDevice userDevice,
OmemoDevice contactsDevice)
Load the crypto-lib specific session object of the device from storage.
|
java.util.SortedSet<java.lang.Integer> |
localDeviceIdsOf(org.jxmpp.jid.BareJid localUser)
Returns a sorted set of all the deviceIds, the localUser has had data stored under in the store.
|
void |
purgeOwnDeviceKeys(OmemoDevice userDevice)
Delete this device's IdentityKey, PreKeys, SignedPreKeys and Sessions.
|
void |
removeAllRawSessionsOf(OmemoDevice userDevice,
org.jxmpp.jid.BareJid contact)
Remove all crypto-lib specific session of a contact.
|
void |
removeOmemoIdentityKey(OmemoDevice userDevice,
OmemoDevice contactsDevice)
Removes the identityKey of a device.
|
void |
removeOmemoIdentityKeyPair(OmemoDevice userDevice)
Remove the identityKeyPair of a user.
|
void |
removeOmemoPreKey(OmemoDevice userDevice,
int preKeyId)
Remove a preKey from storage.
|
void |
removeOmemoSignedPreKey(OmemoDevice userDevice,
int signedPreKeyId)
Remove a signedPreKey from storage.
|
void |
removeRawSession(OmemoDevice userDevice,
OmemoDevice contactsDevice)
Remove a crypto-lib specific session from storage.
|
void |
setDateOfLastDeviceIdPublication(OmemoDevice userDevice,
OmemoDevice contactsDevice,
java.util.Date date)
Set the date of the last time the deviceId was published.
|
void |
setDateOfLastReceivedMessage(OmemoDevice userDevice,
OmemoDevice contactsDevice,
java.util.Date date)
Set the date of the last message that was received from a device.
|
void |
setDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice,
java.util.Date date)
Set the date of the last time the signed preKey was renewed.
|
void |
storeCachedDeviceList(OmemoDevice userDevice,
org.jxmpp.jid.BareJid contact,
OmemoCachedDeviceList contactsDeviceList)
Store the DeviceList of the contact in local storage.
|
void |
storeOmemoIdentityKey(OmemoDevice userDevice,
OmemoDevice contactsDevice,
T_IdKey t_idKey)
Store the public identityKey of the device.
|
void |
storeOmemoIdentityKeyPair(OmemoDevice userDevice,
T_IdKeyPair identityKeyPair)
Store our identityKeyPair in storage.
|
void |
storeOmemoMessageCounter(OmemoDevice userDevice,
OmemoDevice contactsDevice,
int counter)
Store the number of messages we sent to a device since we last received a message back.
|
void |
storeOmemoPreKey(OmemoDevice userDevice,
int preKeyId,
T_PreKey t_preKey)
Store a PreKey in storage.
|
void |
storeOmemoSignedPreKey(OmemoDevice userDevice,
int signedPreKeyId,
T_SigPreKey signedPreKey)
Store a signedPreKey in storage.
|
void |
storeRawSession(OmemoDevice userDevice,
OmemoDevice contactsDevice,
T_Sess session)
Store a crypto-lib specific session to storage.
|
static void |
useLegacyBareJidEncoding()
Convert
BareJids to Strings using the legacy Jid.toString() method instead of the
proper, url safe Jid.asUrlEncodedString() method. |
generateOmemoIdentityKeyPair, generateOmemoPreKeys, generateOmemoSignedPreKey, getFingerprint, getFingerprint, getFingerprintAndMaybeBuildSession, keyUtil, loadCachedDeviceList, loadCurrentOmemoSignedPreKeyId, replenishKeys, storeOmemoPreKeyspublic T_IdKeyPair loadOmemoIdentityKeyPair(OmemoDevice userDevice) throws CorruptedOmemoKeyException
OmemoStoreloadOmemoIdentityKeyPair in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.CorruptedOmemoKeyException - Thrown, if the stored key is damaged (*hands up* not my fault!)public void storeOmemoIdentityKeyPair(OmemoDevice userDevice, T_IdKeyPair identityKeyPair)
OmemoStorestoreOmemoIdentityKeyPair in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.identityKeyPair - identityKeyPairpublic void removeOmemoIdentityKeyPair(OmemoDevice userDevice)
OmemoStoreremoveOmemoIdentityKeyPair in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our device.public T_IdKey loadOmemoIdentityKey(OmemoDevice userDevice, OmemoDevice contactsDevice) throws CorruptedOmemoKeyException
OmemoStoreloadOmemoIdentityKey in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.contactsDevice - the device of which we want to load the identityKey.CorruptedOmemoKeyException - when the key in question is corrupted and cant be deserialized.public void storeOmemoIdentityKey(OmemoDevice userDevice, OmemoDevice contactsDevice, T_IdKey t_idKey)
OmemoStorestoreOmemoIdentityKey in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.contactsDevice - device.t_idKey - identityKey belonging to the contactsDevice.public void removeOmemoIdentityKey(OmemoDevice userDevice, OmemoDevice contactsDevice)
OmemoStoreremoveOmemoIdentityKey in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our omemoDevice.contactsDevice - device of which we want to delete the identityKey.public java.util.SortedSet<java.lang.Integer> localDeviceIdsOf(org.jxmpp.jid.BareJid localUser)
OmemoStorelocalDeviceIdsOf in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>localUser - BareJid of the user.public void setDateOfLastReceivedMessage(OmemoDevice userDevice, OmemoDevice contactsDevice, java.util.Date date)
OmemoStoresetDateOfLastReceivedMessage in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - omemoManager of our device.contactsDevice - device in questiondate - date of the last received messagepublic java.util.Date getDateOfLastReceivedMessage(OmemoDevice userDevice, OmemoDevice contactsDevice)
OmemoStoregetDateOfLastReceivedMessage in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.contactsDevice - device in questionpublic void setDateOfLastDeviceIdPublication(OmemoDevice userDevice, OmemoDevice contactsDevice, java.util.Date date)
OmemoStoresetDateOfLastDeviceIdPublication in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevicecontactsDevice - OmemoDevice in questiondate - date of the last publication after not being publishedpublic java.util.Date getDateOfLastDeviceIdPublication(OmemoDevice userDevice, OmemoDevice contactsDevice)
OmemoStoregetDateOfLastDeviceIdPublication in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevicecontactsDevice - OmemoDevice in questionpublic void setDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice, java.util.Date date)
OmemoStoresetDateOfLastSignedPreKeyRenewal in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.date - datepublic java.util.Date getDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice)
OmemoStoregetDateOfLastSignedPreKeyRenewal in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.public T_PreKey loadOmemoPreKey(OmemoDevice userDevice, int preKeyId)
OmemoStoreloadOmemoPreKey in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.preKeyId - id of the key to be loadedpublic void storeOmemoPreKey(OmemoDevice userDevice, int preKeyId, T_PreKey t_preKey)
OmemoStorestoreOmemoPreKey in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.preKeyId - id of the keyt_preKey - keypublic void removeOmemoPreKey(OmemoDevice userDevice, int preKeyId)
OmemoStoreremoveOmemoPreKey in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.preKeyId - id of the used key that will be deletedpublic java.util.TreeMap<java.lang.Integer,T_PreKey> loadOmemoPreKeys(OmemoDevice userDevice)
OmemoStoreloadOmemoPreKeys in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.public T_SigPreKey loadOmemoSignedPreKey(OmemoDevice userDevice, int signedPreKeyId)
OmemoStoreloadOmemoSignedPreKey in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.signedPreKeyId - id of the keypublic java.util.TreeMap<java.lang.Integer,T_SigPreKey> loadOmemoSignedPreKeys(OmemoDevice userDevice)
OmemoStoreloadOmemoSignedPreKeys in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.public void storeOmemoSignedPreKey(OmemoDevice userDevice, int signedPreKeyId, T_SigPreKey signedPreKey)
OmemoStorestoreOmemoSignedPreKey in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.signedPreKeyId - id of the signedPreKeysignedPreKey - the key itselfpublic void removeOmemoSignedPreKey(OmemoDevice userDevice, int signedPreKeyId)
OmemoStoreremoveOmemoSignedPreKey in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.signedPreKeyId - id of the key that will be removedpublic T_Sess loadRawSession(OmemoDevice userDevice, OmemoDevice contactsDevice)
OmemoStoreloadRawSession in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.contactsDevice - device whose session we want to loadpublic java.util.HashMap<java.lang.Integer,T_Sess> loadAllRawSessionsOf(OmemoDevice userDevice, org.jxmpp.jid.BareJid contact)
OmemoStoreloadAllRawSessionsOf in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.contact - BareJid of the contact we want to get all sessions frompublic void storeRawSession(OmemoDevice userDevice, OmemoDevice contactsDevice, T_Sess session)
OmemoStorestoreRawSession in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.contactsDevice - OmemoDevice whose session we want to storesession - sessionpublic void removeRawSession(OmemoDevice userDevice, OmemoDevice contactsDevice)
OmemoStoreremoveRawSession in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.contactsDevice - device whose session we want to deletepublic void removeAllRawSessionsOf(OmemoDevice userDevice, org.jxmpp.jid.BareJid contact)
OmemoStoreremoveAllRawSessionsOf in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.contact - BareJid of the contactpublic boolean containsRawSession(OmemoDevice userDevice, OmemoDevice contactsDevice)
OmemoStorecontainsRawSession in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.contactsDevice - devicepublic void storeOmemoMessageCounter(OmemoDevice userDevice, OmemoDevice contactsDevice, int counter)
OmemoStorestoreOmemoMessageCounter in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our omemoDevice.contactsDevice - device of which we want to set the message counter.counter - counter value.public int loadOmemoMessageCounter(OmemoDevice userDevice, OmemoDevice contactsDevice)
OmemoStoreloadOmemoMessageCounter in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our omemoDevicecontactsDevice - device of which we want to get the message counter.public OmemoCachedDeviceList loadCachedDeviceList(OmemoDevice userDevice, org.jxmpp.jid.BareJid contact)
OmemoStoreloadCachedDeviceList in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.contact - contact we want to get the deviceList ofpublic void storeCachedDeviceList(OmemoDevice userDevice, org.jxmpp.jid.BareJid contact, OmemoCachedDeviceList contactsDeviceList)
OmemoStorestoreCachedDeviceList in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.contact - ContactcontactsDeviceList - list of the contacts devices' ids.public void purgeOwnDeviceKeys(OmemoDevice userDevice)
OmemoStorepurgeOwnDeviceKeys in class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>userDevice - our OmemoDevice.public static void deleteDirectory(java.io.File root)
root - public static void useLegacyBareJidEncoding()
BareJids to Strings using the legacy Jid.toString() method instead of the
proper, url safe Jid.asUrlEncodedString() method.
While it is highly advised to use the new format, you can use this method to stay backwards compatible to data
sets created by the old implementation.