T_IdKeyPair - IdentityKeyPair classT_IdKey - IdentityKey classT_PreKey - PreKey classT_SigPreKey - SignedPreKey classT_Sess - Session classT_Addr - Address classT_ECPub - Elliptic Curve PublicKey classT_Bundle - Bundle classT_Ciph - Cipher classpublic abstract class OmemoStore<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_Addr,T_ECPub,T_Bundle,T_Ciph>
extends java.lang.Object
| Constructor and Description |
|---|
OmemoStore()
Create a new OmemoStore.
|
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
containsRawSession(OmemoDevice userDevice,
OmemoDevice contactsDevice)
Return true, if we have a session with the device, otherwise false.
|
T_IdKeyPair |
generateOmemoIdentityKeyPair()
Generate a new IdentityKeyPair.
|
java.util.TreeMap<java.lang.Integer,T_PreKey> |
generateOmemoPreKeys(int startId,
int count)
Generate 'count' new PreKeys beginning with id 'startId'.
|
T_SigPreKey |
generateOmemoSignedPreKey(T_IdKeyPair identityKeyPair,
int signedPreKeyId)
Generate a new signed preKey.
|
abstract java.util.Date |
getDateOfLastDeviceIdPublication(OmemoDevice userDevice,
OmemoDevice contactsDevice)
Return the date of the last time the deviceId was published after previously being not published.
|
abstract java.util.Date |
getDateOfLastReceivedMessage(OmemoDevice userDevice,
OmemoDevice contactsDevice)
Return the date of the last message that was received from device 'from'.
|
abstract java.util.Date |
getDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice)
Get the date of the last time the signed preKey was renewed.
|
OmemoFingerprint |
getFingerprint(OmemoDevice userDevice)
Return our identityKeys fingerprint.
|
OmemoFingerprint |
getFingerprint(OmemoDevice userDevice,
OmemoDevice contactsDevice)
Return the fingerprint of the identityKey belonging to contactsDevice.
|
OmemoFingerprint |
getFingerprintAndMaybeBuildSession(OmemoManager.LoggedInOmemoManager managerGuard,
OmemoDevice contactsDevice)
Return the fingerprint of the given devices announced identityKey.
|
abstract OmemoKeyUtil<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_ECPub,T_Bundle> |
keyUtil()
Return a concrete KeyUtil object that we can use as a utility to create keys etc.
|
abstract 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)
Load a list of deviceIds from our own devices.
|
abstract OmemoCachedDeviceList |
loadCachedDeviceList(OmemoDevice userDevice,
org.jxmpp.jid.BareJid contact)
Load a list of deviceIds from contact 'contact' from the local cache.
|
int |
loadCurrentOmemoSignedPreKeyId(OmemoDevice userDevice) |
abstract T_IdKey |
loadOmemoIdentityKey(OmemoDevice userDevice,
OmemoDevice contactsDevice)
Load the public identityKey of a device.
|
abstract T_IdKeyPair |
loadOmemoIdentityKeyPair(OmemoDevice userDevice)
Load our identityKeyPair from storage.
|
abstract int |
loadOmemoMessageCounter(OmemoDevice userDevice,
OmemoDevice contactsDevice)
Return the current value of the message counter.
|
abstract T_PreKey |
loadOmemoPreKey(OmemoDevice userDevice,
int preKeyId)
Load the preKey with id 'preKeyId' from storage.
|
abstract java.util.TreeMap<java.lang.Integer,T_PreKey> |
loadOmemoPreKeys(OmemoDevice userDevice)
Return all our current OmemoPreKeys.
|
abstract T_SigPreKey |
loadOmemoSignedPreKey(OmemoDevice userDevice,
int signedPreKeyId)
Return the signedPreKey with the id 'singedPreKeyId'.
|
abstract java.util.TreeMap<java.lang.Integer,T_SigPreKey> |
loadOmemoSignedPreKeys(OmemoDevice userDevice)
Load all our signed PreKeys.
|
abstract T_Sess |
loadRawSession(OmemoDevice userDevice,
OmemoDevice contactsDevice)
Load the crypto-lib specific session object of the device from storage.
|
abstract 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.
|
abstract void |
purgeOwnDeviceKeys(OmemoDevice userDevice)
Delete this device's IdentityKey, PreKeys, SignedPreKeys and Sessions.
|
abstract void |
removeAllRawSessionsOf(OmemoDevice userDevice,
org.jxmpp.jid.BareJid contact)
Remove all crypto-lib specific session of a contact.
|
abstract void |
removeOmemoIdentityKey(OmemoDevice userDevice,
OmemoDevice contactsDevice)
Removes the identityKey of a device.
|
abstract void |
removeOmemoIdentityKeyPair(OmemoDevice userDevice)
Remove the identityKeyPair of a user.
|
abstract void |
removeOmemoPreKey(OmemoDevice userDevice,
int preKeyId)
Remove a preKey from storage.
|
abstract void |
removeOmemoSignedPreKey(OmemoDevice userDevice,
int signedPreKeyId)
Remove a signedPreKey from storage.
|
abstract void |
removeRawSession(OmemoDevice userDevice,
OmemoDevice contactsDevice)
Remove a crypto-lib specific session from storage.
|
void |
replenishKeys(OmemoDevice userDevice)
Replenish our supply of keys.
|
abstract void |
setDateOfLastDeviceIdPublication(OmemoDevice userDevice,
OmemoDevice contactsDevice,
java.util.Date date)
Set the date of the last time the deviceId was published.
|
abstract void |
setDateOfLastReceivedMessage(OmemoDevice userDevice,
OmemoDevice contactsDevice,
java.util.Date date)
Set the date of the last message that was received from a device.
|
abstract void |
setDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice,
java.util.Date date)
Set the date of the last time the signed preKey was renewed.
|
abstract void |
storeCachedDeviceList(OmemoDevice userDevice,
org.jxmpp.jid.BareJid contact,
OmemoCachedDeviceList contactsDeviceList)
Store the DeviceList of the contact in local storage.
|
abstract void |
storeOmemoIdentityKey(OmemoDevice userDevice,
OmemoDevice contactsDevice,
T_IdKey contactsKey)
Store the public identityKey of the device.
|
abstract void |
storeOmemoIdentityKeyPair(OmemoDevice userDevice,
T_IdKeyPair identityKeyPair)
Store our identityKeyPair in storage.
|
abstract 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.
|
abstract void |
storeOmemoPreKey(OmemoDevice userDevice,
int preKeyId,
T_PreKey preKey)
Store a PreKey in storage.
|
void |
storeOmemoPreKeys(OmemoDevice userDevice,
java.util.TreeMap<java.lang.Integer,T_PreKey> preKeyHashMap)
Store a whole bunch of preKeys.
|
abstract void |
storeOmemoSignedPreKey(OmemoDevice userDevice,
int signedPreKeyId,
T_SigPreKey signedPreKey)
Store a signedPreKey in storage.
|
abstract void |
storeRawSession(OmemoDevice userDevice,
OmemoDevice contactsDevice,
T_Sess session)
Store a crypto-lib specific session to storage.
|
public abstract java.util.SortedSet<java.lang.Integer> localDeviceIdsOf(org.jxmpp.jid.BareJid localUser)
localUser - BareJid of the user.public void replenishKeys(OmemoDevice userDevice) throws CorruptedOmemoKeyException, java.io.IOException
userDevice - our own OMEMO deviceCorruptedOmemoKeyException - if the OMEMO key is corrupted.java.io.IOException - if an I/O error occurred.public T_IdKeyPair generateOmemoIdentityKeyPair()
public abstract T_IdKeyPair loadOmemoIdentityKeyPair(OmemoDevice userDevice) throws CorruptedOmemoKeyException, java.io.IOException
userDevice - our OmemoDevice.CorruptedOmemoKeyException - Thrown, if the stored key is damaged (*hands up* not my fault!)java.io.IOException - if an I/O error occurred.public abstract void storeOmemoIdentityKeyPair(OmemoDevice userDevice, T_IdKeyPair identityKeyPair) throws java.io.IOException
userDevice - our OmemoDevice.identityKeyPair - identityKeyPairjava.io.IOException - if an I/O error occurred.public abstract void removeOmemoIdentityKeyPair(OmemoDevice userDevice)
userDevice - our device.public abstract T_IdKey loadOmemoIdentityKey(OmemoDevice userDevice, OmemoDevice contactsDevice) throws CorruptedOmemoKeyException, java.io.IOException
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.java.io.IOException - if an I/O error occurred.public abstract void storeOmemoIdentityKey(OmemoDevice userDevice, OmemoDevice contactsDevice, T_IdKey contactsKey) throws java.io.IOException
userDevice - our OmemoDevice.contactsDevice - device.contactsKey - identityKey belonging to the contactsDevice.java.io.IOException - if an I/O error occurred.public abstract void removeOmemoIdentityKey(OmemoDevice userDevice, OmemoDevice contactsDevice)
userDevice - our omemoDevice.contactsDevice - device of which we want to delete the identityKey.public abstract void storeOmemoMessageCounter(OmemoDevice userDevice, OmemoDevice contactsDevice, int counter) throws java.io.IOException
userDevice - our omemoDevice.contactsDevice - device of which we want to set the message counter.counter - counter value.java.io.IOException - if an I/O error occurred.public abstract int loadOmemoMessageCounter(OmemoDevice userDevice, OmemoDevice contactsDevice) throws java.io.IOException
userDevice - our omemoDevicecontactsDevice - device of which we want to get the message counter.java.io.IOException - if an I/O error occurred.public abstract void setDateOfLastReceivedMessage(OmemoDevice userDevice, OmemoDevice contactsDevice, java.util.Date date) throws java.io.IOException
userDevice - omemoManager of our device.contactsDevice - device in questiondate - date of the last received messagejava.io.IOException - if an I/O error occurred.public abstract java.util.Date getDateOfLastReceivedMessage(OmemoDevice userDevice, OmemoDevice contactsDevice) throws java.io.IOException
userDevice - our OmemoDevice.contactsDevice - device in questionjava.io.IOException - if an I/O error occurred.public abstract void setDateOfLastDeviceIdPublication(OmemoDevice userDevice, OmemoDevice contactsDevice, java.util.Date date) throws java.io.IOException
userDevice - our OmemoDevicecontactsDevice - OmemoDevice in questiondate - date of the last publication after not being publishedjava.io.IOException - if an I/O error occurred.public abstract java.util.Date getDateOfLastDeviceIdPublication(OmemoDevice userDevice, OmemoDevice contactsDevice) throws java.io.IOException
userDevice - our OmemoDevicecontactsDevice - OmemoDevice in questionjava.io.IOException - if an I/O error occurred.public abstract void setDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice, java.util.Date date) throws java.io.IOException
userDevice - our OmemoDevice.date - datejava.io.IOException - if an I/O error occurred.public abstract java.util.Date getDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice) throws java.io.IOException
userDevice - our OmemoDevice.java.io.IOException - if an I/O error occurred.public java.util.TreeMap<java.lang.Integer,T_PreKey> generateOmemoPreKeys(int startId, int count)
startId - start idcount - how many keys do we want to generatepublic abstract T_PreKey loadOmemoPreKey(OmemoDevice userDevice, int preKeyId) throws java.io.IOException
userDevice - our OmemoDevice.preKeyId - id of the key to be loadedjava.io.IOException - if an I/O error occurred.public abstract void storeOmemoPreKey(OmemoDevice userDevice, int preKeyId, T_PreKey preKey) throws java.io.IOException
userDevice - our OmemoDevice.preKeyId - id of the keypreKey - keyjava.io.IOException - if an I/O error occurred.public void storeOmemoPreKeys(OmemoDevice userDevice, java.util.TreeMap<java.lang.Integer,T_PreKey> preKeyHashMap) throws java.io.IOException
userDevice - our OmemoDevice.preKeyHashMap - HashMap of preKeysjava.io.IOException - if an I/O error occurred.public abstract void removeOmemoPreKey(OmemoDevice userDevice, int preKeyId)
userDevice - our OmemoDevice.preKeyId - id of the used key that will be deletedpublic abstract java.util.TreeMap<java.lang.Integer,T_PreKey> loadOmemoPreKeys(OmemoDevice userDevice) throws java.io.IOException
userDevice - our OmemoDevice.java.io.IOException - if an I/O error occurred.public abstract T_SigPreKey loadOmemoSignedPreKey(OmemoDevice userDevice, int signedPreKeyId) throws java.io.IOException
userDevice - our OmemoDevice.signedPreKeyId - id of the keyjava.io.IOException - if an I/O error occurred.public int loadCurrentOmemoSignedPreKeyId(OmemoDevice userDevice) throws java.io.IOException
java.io.IOExceptionpublic abstract java.util.TreeMap<java.lang.Integer,T_SigPreKey> loadOmemoSignedPreKeys(OmemoDevice userDevice) throws java.io.IOException
userDevice - our OmemoDevice.java.io.IOException - if an I/O error occurred.public T_SigPreKey generateOmemoSignedPreKey(T_IdKeyPair identityKeyPair, int signedPreKeyId) throws CorruptedOmemoKeyException
identityKeyPair - identityKeyPair used to sign the preKeysignedPreKeyId - id that the preKey will haveCorruptedOmemoKeyException - when something goes wrongpublic abstract void storeOmemoSignedPreKey(OmemoDevice userDevice, int signedPreKeyId, T_SigPreKey signedPreKey) throws java.io.IOException
userDevice - our OmemoDevice.signedPreKeyId - id of the signedPreKeysignedPreKey - the key itselfjava.io.IOException - if an I/O error occurred.public abstract void removeOmemoSignedPreKey(OmemoDevice userDevice, int signedPreKeyId)
userDevice - our OmemoDevice.signedPreKeyId - id of the key that will be removedpublic abstract T_Sess loadRawSession(OmemoDevice userDevice, OmemoDevice contactsDevice) throws java.io.IOException
userDevice - our OmemoDevice.contactsDevice - device whose session we want to loadjava.io.IOException - if an I/O error occurred.public abstract java.util.HashMap<java.lang.Integer,T_Sess> loadAllRawSessionsOf(OmemoDevice userDevice, org.jxmpp.jid.BareJid contact) throws java.io.IOException
userDevice - our OmemoDevice.contact - BareJid of the contact we want to get all sessions fromjava.io.IOException - if an I/O error occurred.public abstract void storeRawSession(OmemoDevice userDevice, OmemoDevice contactsDevice, T_Sess session) throws java.io.IOException
userDevice - our OmemoDevice.contactsDevice - OmemoDevice whose session we want to storesession - sessionjava.io.IOException - if an I/O error occurred.public abstract void removeRawSession(OmemoDevice userDevice, OmemoDevice contactsDevice)
userDevice - our OmemoDevice.contactsDevice - device whose session we want to deletepublic abstract void removeAllRawSessionsOf(OmemoDevice userDevice, org.jxmpp.jid.BareJid contact)
userDevice - our OmemoDevice.contact - BareJid of the contactpublic abstract boolean containsRawSession(OmemoDevice userDevice, OmemoDevice contactsDevice)
userDevice - our OmemoDevice.contactsDevice - devicepublic abstract OmemoCachedDeviceList loadCachedDeviceList(OmemoDevice userDevice, org.jxmpp.jid.BareJid contact) throws java.io.IOException
userDevice - our OmemoDevice.contact - contact we want to get the deviceList ofjava.io.IOException - if an I/O error occurred.public OmemoCachedDeviceList loadCachedDeviceList(OmemoDevice userDevice) throws java.io.IOException
userDevice - our own OMEMO devicejava.io.IOException - if an I/O error occurred.public abstract void storeCachedDeviceList(OmemoDevice userDevice, org.jxmpp.jid.BareJid contact, OmemoCachedDeviceList contactsDeviceList) throws java.io.IOException
userDevice - our OmemoDevice.contact - ContactcontactsDeviceList - list of the contacts devices' ids.java.io.IOException - if an I/O error occurred.public abstract void purgeOwnDeviceKeys(OmemoDevice userDevice)
userDevice - our OmemoDevice.public abstract OmemoKeyUtil<T_IdKeyPair,T_IdKey,T_PreKey,T_SigPreKey,T_Sess,T_ECPub,T_Bundle> keyUtil()
public OmemoFingerprint getFingerprint(OmemoDevice userDevice) throws CorruptedOmemoKeyException, java.io.IOException
userDevice - our OmemoDevice.CorruptedOmemoKeyException - if the identityKey of userDevice is corrupted.java.io.IOException - if an I/O error occurred.public OmemoFingerprint getFingerprint(OmemoDevice userDevice, OmemoDevice contactsDevice) throws CorruptedOmemoKeyException, NoIdentityKeyException, java.io.IOException
userDevice - our OmemoDevice.contactsDevice - OmemoDevice we want to have the fingerprint for.CorruptedOmemoKeyException - if the IdentityKey is corrupted.NoIdentityKeyException - if no IdentityKey for contactsDevice has been found locally.java.io.IOException - if an I/O error occurred.public OmemoFingerprint getFingerprintAndMaybeBuildSession(OmemoManager.LoggedInOmemoManager managerGuard, OmemoDevice contactsDevice) throws CannotEstablishOmemoSessionException, CorruptedOmemoKeyException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException, org.jivesoftware.smack.SmackException.NoResponseException, java.io.IOException
managerGuard - authenticated OmemoManagercontactsDevice - OmemoDevice we want to get the fingerprint fromCannotEstablishOmemoSessionException - If we have no local copy of the identityKey of the contact
and are unable to build a fresh sessionCorruptedOmemoKeyException - If the identityKey we have of the contact is corruptedSmackException.NotConnectedException - if the XMPP connection is not connected.java.lang.InterruptedException - if the calling thread was interrupted.SmackException.NoResponseException - if there was no response from the remote entity.java.io.IOException - if an I/O error occurred.