Package org.jivesoftware.smackx.omemo
Class FileBasedOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- java.lang.Object
-
- org.jivesoftware.smackx.omemo.OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
-
- org.jivesoftware.smackx.omemo.FileBasedOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
-
- Direct Known Subclasses:
SignalFileBasedOmemoStore
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>
Like a rocket! Implementation of theOmemoStore
class that uses plain files for storage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FileBasedOmemoStore.FileHierarchy
This class represents the directory structure of the FileBasedOmemoStore.
-
Constructor Summary
Constructors Constructor Description FileBasedOmemoStore(java.io.File basePath)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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, BareJid contact)
Load all crypto-lib specific session objects of contact 'contact'.OmemoCachedDeviceList
loadCachedDeviceList(OmemoDevice userDevice, 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(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, 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, 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()
ConvertBareJids
to Strings using the legacyJid.toString()
method instead of the proper, url safeJid.asUrlEncodedString()
method.-
Methods inherited from class org.jivesoftware.smackx.omemo.OmemoStore
generateOmemoIdentityKeyPair, generateOmemoPreKeys, generateOmemoSignedPreKey, getFingerprint, getFingerprint, getFingerprintAndMaybeBuildSession, keyUtil, loadCachedDeviceList, loadCurrentOmemoSignedPreKeyId, replenishKeys, storeOmemoPreKeys
-
-
-
-
Constructor Detail
-
FileBasedOmemoStore
public FileBasedOmemoStore(java.io.File basePath)
-
-
Method Detail
-
loadOmemoIdentityKeyPair
public T_IdKeyPair loadOmemoIdentityKeyPair(OmemoDevice userDevice) throws CorruptedOmemoKeyException, java.io.IOException
Description copied from class:OmemoStore
Load our identityKeyPair from storage. Return null, if we have no identityKeyPair.- Specified by:
loadOmemoIdentityKeyPair
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.- Returns:
- loaded identityKeyPair
- Throws:
CorruptedOmemoKeyException
- Thrown, if the stored key is damaged (*hands up* not my fault!)java.io.IOException
- if an I/O error occurred.
-
storeOmemoIdentityKeyPair
public void storeOmemoIdentityKeyPair(OmemoDevice userDevice, T_IdKeyPair identityKeyPair) throws java.io.IOException
Description copied from class:OmemoStore
Store our identityKeyPair in storage. It would be a cool feature, if the key could be stored in a encrypted database or something similar.- Specified by:
storeOmemoIdentityKeyPair
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.identityKeyPair
- identityKeyPair- Throws:
java.io.IOException
- if an I/O error occurred.
-
removeOmemoIdentityKeyPair
public void removeOmemoIdentityKeyPair(OmemoDevice userDevice)
Description copied from class:OmemoStore
Remove the identityKeyPair of a user.- Specified by:
removeOmemoIdentityKeyPair
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our device.
-
loadOmemoIdentityKey
public T_IdKey loadOmemoIdentityKey(OmemoDevice userDevice, OmemoDevice contactsDevice) throws CorruptedOmemoKeyException, java.io.IOException
Description copied from class:OmemoStore
Load the public identityKey of a device.- Specified by:
loadOmemoIdentityKey
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.contactsDevice
- the device of which we want to load the identityKey.- Returns:
- loaded identityKey
- Throws:
CorruptedOmemoKeyException
- when the key in question is corrupted and cant be deserialized.java.io.IOException
- if an I/O error occurred.
-
storeOmemoIdentityKey
public void storeOmemoIdentityKey(OmemoDevice userDevice, OmemoDevice contactsDevice, T_IdKey t_idKey) throws java.io.IOException
Description copied from class:OmemoStore
Store the public identityKey of the device.- Specified by:
storeOmemoIdentityKey
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.contactsDevice
- device.t_idKey
- identityKey belonging to the contactsDevice.- Throws:
java.io.IOException
- if an I/O error occurred.
-
removeOmemoIdentityKey
public void removeOmemoIdentityKey(OmemoDevice userDevice, OmemoDevice contactsDevice)
Description copied from class:OmemoStore
Removes the identityKey of a device.- Specified by:
removeOmemoIdentityKey
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our omemoDevice.contactsDevice
- device of which we want to delete the identityKey.
-
localDeviceIdsOf
public java.util.SortedSet<java.lang.Integer> localDeviceIdsOf(BareJid localUser)
Description copied from class:OmemoStore
Returns a sorted set of all the deviceIds, the localUser has had data stored under in the store. Basically this returns the deviceIds of all "accounts" of localUser, which are known to the store.- Specified by:
localDeviceIdsOf
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
localUser
- BareJid of the user.- Returns:
- set of deviceIds with available data.
-
setDateOfLastReceivedMessage
public void setDateOfLastReceivedMessage(OmemoDevice userDevice, OmemoDevice contactsDevice, java.util.Date date) throws java.io.IOException
Description copied from class:OmemoStore
Set the date of the last message that was received from a device.- Specified by:
setDateOfLastReceivedMessage
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- omemoManager of our device.contactsDevice
- device in questiondate
- date of the last received message- Throws:
java.io.IOException
- if an I/O error occurred.
-
getDateOfLastReceivedMessage
public java.util.Date getDateOfLastReceivedMessage(OmemoDevice userDevice, OmemoDevice contactsDevice) throws java.io.IOException
Description copied from class:OmemoStore
Return the date of the last message that was received from device 'from'.- Specified by:
getDateOfLastReceivedMessage
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.contactsDevice
- device in question- Returns:
- date if existent, null
- Throws:
java.io.IOException
- if an I/O error occurred.
-
setDateOfLastDeviceIdPublication
public void setDateOfLastDeviceIdPublication(OmemoDevice userDevice, OmemoDevice contactsDevice, java.util.Date date) throws java.io.IOException
Description copied from class:OmemoStore
Set the date of the last time the deviceId was published. This method only gets called, when the deviceId was inactive/non-existent before it was published.- Specified by:
setDateOfLastDeviceIdPublication
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevicecontactsDevice
- OmemoDevice in questiondate
- date of the last publication after not being published- Throws:
java.io.IOException
- if an I/O error occurred.
-
getDateOfLastDeviceIdPublication
public java.util.Date getDateOfLastDeviceIdPublication(OmemoDevice userDevice, OmemoDevice contactsDevice) throws java.io.IOException
Description copied from class:OmemoStore
Return the date of the last time the deviceId was published after previously being not published. (Point in time, where the status of the deviceId changed from inactive/non-existent to active).- Specified by:
getDateOfLastDeviceIdPublication
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevicecontactsDevice
- OmemoDevice in question- Returns:
- date of the last publication after not being published
- Throws:
java.io.IOException
- if an I/O error occurred.
-
setDateOfLastSignedPreKeyRenewal
public void setDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice, java.util.Date date) throws java.io.IOException
Description copied from class:OmemoStore
Set the date of the last time the signed preKey was renewed.- Specified by:
setDateOfLastSignedPreKeyRenewal
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.date
- date- Throws:
java.io.IOException
- if an I/O error occurred.
-
getDateOfLastSignedPreKeyRenewal
public java.util.Date getDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice) throws java.io.IOException
Description copied from class:OmemoStore
Get the date of the last time the signed preKey was renewed.- Specified by:
getDateOfLastSignedPreKeyRenewal
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.- Returns:
- date if existent, otherwise null
- Throws:
java.io.IOException
- if an I/O error occurred.
-
loadOmemoPreKey
public T_PreKey loadOmemoPreKey(OmemoDevice userDevice, int preKeyId) throws java.io.IOException
Description copied from class:OmemoStore
Load the preKey with id 'preKeyId' from storage.- Specified by:
loadOmemoPreKey
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.preKeyId
- id of the key to be loaded- Returns:
- loaded preKey
- Throws:
java.io.IOException
- if an I/O error occurred.
-
storeOmemoPreKey
public void storeOmemoPreKey(OmemoDevice userDevice, int preKeyId, T_PreKey t_preKey) throws java.io.IOException
Description copied from class:OmemoStore
Store a PreKey in storage.- Specified by:
storeOmemoPreKey
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.preKeyId
- id of the keyt_preKey
- key- Throws:
java.io.IOException
- if an I/O error occurred.
-
removeOmemoPreKey
public void removeOmemoPreKey(OmemoDevice userDevice, int preKeyId)
Description copied from class:OmemoStore
Remove a preKey from storage. This is called, when a contact used one of our preKeys to establish a session with us.- Specified by:
removeOmemoPreKey
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.preKeyId
- id of the used key that will be deleted
-
loadOmemoPreKeys
public java.util.TreeMap<java.lang.Integer,T_PreKey> loadOmemoPreKeys(OmemoDevice userDevice) throws java.io.IOException
Description copied from class:OmemoStore
Return all our current OmemoPreKeys.- Specified by:
loadOmemoPreKeys
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.- Returns:
- Map containing our preKeys
- Throws:
java.io.IOException
- if an I/O error occurred.
-
loadOmemoSignedPreKey
public T_SigPreKey loadOmemoSignedPreKey(OmemoDevice userDevice, int signedPreKeyId) throws java.io.IOException
Description copied from class:OmemoStore
Return the signedPreKey with the id 'singedPreKeyId'.- Specified by:
loadOmemoSignedPreKey
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.signedPreKeyId
- id of the key- Returns:
- loaded signed preKey
- Throws:
java.io.IOException
- if an I/O error occurred.
-
loadOmemoSignedPreKeys
public java.util.TreeMap<java.lang.Integer,T_SigPreKey> loadOmemoSignedPreKeys(OmemoDevice userDevice) throws java.io.IOException
Description copied from class:OmemoStore
Load all our signed PreKeys.- Specified by:
loadOmemoSignedPreKeys
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.- Returns:
- HashMap of our singedPreKeys
- Throws:
java.io.IOException
- if an I/O error occurred.
-
storeOmemoSignedPreKey
public void storeOmemoSignedPreKey(OmemoDevice userDevice, int signedPreKeyId, T_SigPreKey signedPreKey) throws java.io.IOException
Description copied from class:OmemoStore
Store a signedPreKey in storage.- Specified by:
storeOmemoSignedPreKey
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.signedPreKeyId
- id of the signedPreKeysignedPreKey
- the key itself- Throws:
java.io.IOException
- if an I/O error occurred.
-
removeOmemoSignedPreKey
public void removeOmemoSignedPreKey(OmemoDevice userDevice, int signedPreKeyId)
Description copied from class:OmemoStore
Remove a signedPreKey from storage.- Specified by:
removeOmemoSignedPreKey
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.signedPreKeyId
- id of the key that will be removed
-
loadRawSession
public T_Sess loadRawSession(OmemoDevice userDevice, OmemoDevice contactsDevice) throws java.io.IOException
Description copied from class:OmemoStore
Load the crypto-lib specific session object of the device from storage.- Specified by:
loadRawSession
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.contactsDevice
- device whose session we want to load- Returns:
- crypto related session
- Throws:
java.io.IOException
- if an I/O error occurred.
-
loadAllRawSessionsOf
public java.util.HashMap<java.lang.Integer,T_Sess> loadAllRawSessionsOf(OmemoDevice userDevice, BareJid contact) throws java.io.IOException
Description copied from class:OmemoStore
Load all crypto-lib specific session objects of contact 'contact'.- Specified by:
loadAllRawSessionsOf
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.contact
- BareJid of the contact we want to get all sessions from- Returns:
- TreeMap of deviceId and sessions of the contact
- Throws:
java.io.IOException
- if an I/O error occurred.
-
storeRawSession
public void storeRawSession(OmemoDevice userDevice, OmemoDevice contactsDevice, T_Sess session) throws java.io.IOException
Description copied from class:OmemoStore
Store a crypto-lib specific session to storage.- Specified by:
storeRawSession
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.contactsDevice
- OmemoDevice whose session we want to storesession
- session- Throws:
java.io.IOException
- if an I/O error occurred.
-
removeRawSession
public void removeRawSession(OmemoDevice userDevice, OmemoDevice contactsDevice)
Description copied from class:OmemoStore
Remove a crypto-lib specific session from storage.- Specified by:
removeRawSession
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.contactsDevice
- device whose session we want to delete
-
removeAllRawSessionsOf
public void removeAllRawSessionsOf(OmemoDevice userDevice, BareJid contact)
Description copied from class:OmemoStore
Remove all crypto-lib specific session of a contact.- Specified by:
removeAllRawSessionsOf
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.contact
- BareJid of the contact
-
containsRawSession
public boolean containsRawSession(OmemoDevice userDevice, OmemoDevice contactsDevice)
Description copied from class:OmemoStore
Return true, if we have a session with the device, otherwise false. Hint for Signal: Do not try 'return getSession() != null' since this will create a new session.- Specified by:
containsRawSession
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.contactsDevice
- device- Returns:
- true if we have session, otherwise false
-
storeOmemoMessageCounter
public void storeOmemoMessageCounter(OmemoDevice userDevice, OmemoDevice contactsDevice, int counter) throws java.io.IOException
Description copied from class:OmemoStore
Store the number of messages we sent to a device since we last received a message back. This counter gets reset to 0 whenever we receive a message from the contacts device.- Specified by:
storeOmemoMessageCounter
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our omemoDevice.contactsDevice
- device of which we want to set the message counter.counter
- counter value.- Throws:
java.io.IOException
- if an I/O error occurred.
-
loadOmemoMessageCounter
public int loadOmemoMessageCounter(OmemoDevice userDevice, OmemoDevice contactsDevice) throws java.io.IOException
Description copied from class:OmemoStore
Return the current value of the message counter. This counter represents the number of message we sent to the contactsDevice without getting a reply back. The default value for this counter is 0.- Specified by:
loadOmemoMessageCounter
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our omemoDevicecontactsDevice
- device of which we want to get the message counter.- Returns:
- counter value.
- Throws:
java.io.IOException
- if an I/O error occurred.
-
loadCachedDeviceList
public OmemoCachedDeviceList loadCachedDeviceList(OmemoDevice userDevice, BareJid contact) throws java.io.IOException
Description copied from class:OmemoStore
Load a list of deviceIds from contact 'contact' from the local cache.- Specified by:
loadCachedDeviceList
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.contact
- contact we want to get the deviceList of- Returns:
- CachedDeviceList of the contact
- Throws:
java.io.IOException
- if an I/O error occurred.
-
storeCachedDeviceList
public void storeCachedDeviceList(OmemoDevice userDevice, BareJid contact, OmemoCachedDeviceList contactsDeviceList) throws java.io.IOException
Description copied from class:OmemoStore
Store the DeviceList of the contact in local storage. See this as a cache.- Specified by:
storeCachedDeviceList
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.contact
- ContactcontactsDeviceList
- list of the contacts devices' ids.- Throws:
java.io.IOException
- if an I/O error occurred.
-
purgeOwnDeviceKeys
public void purgeOwnDeviceKeys(OmemoDevice userDevice)
Description copied from class:OmemoStore
Delete this device's IdentityKey, PreKeys, SignedPreKeys and Sessions.- Specified by:
purgeOwnDeviceKeys
in classOmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
- Parameters:
userDevice
- our OmemoDevice.
-
deleteDirectory
public static void deleteDirectory(java.io.File root)
Delete a directory with all subdirectories.- Parameters:
root
- directory to be deleted
-
useLegacyBareJidEncoding
public static void useLegacyBareJidEncoding()
ConvertBareJids
to Strings using the legacyJid.toString()
method instead of the proper, url safeJid.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.
-
-