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
userDevice
- CorruptedOmemoKeyException
public T_IdKeyPair generateOmemoIdentityKeyPair()
public abstract T_IdKeyPair loadOmemoIdentityKeyPair(OmemoDevice userDevice) throws CorruptedOmemoKeyException
userDevice
- our OmemoDevice.CorruptedOmemoKeyException
- Thrown, if the stored key is damaged (*hands up* not my fault!)public abstract void storeOmemoIdentityKeyPair(OmemoDevice userDevice, T_IdKeyPair identityKeyPair)
userDevice
- our OmemoDevice.identityKeyPair
- identityKeyPairpublic abstract void removeOmemoIdentityKeyPair(OmemoDevice userDevice)
userDevice
- our device.public abstract T_IdKey loadOmemoIdentityKey(OmemoDevice userDevice, OmemoDevice contactsDevice) throws CorruptedOmemoKeyException
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 abstract void storeOmemoIdentityKey(OmemoDevice userDevice, OmemoDevice contactsDevice, T_IdKey contactsKey)
userDevice
- our OmemoDevice.contactsDevice
- device.contactsKey
- identityKey belonging to the contactsDevice.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)
userDevice
- our omemoDevice.contactsDevice
- device of which we want to set the message counter.counter
- counter value.public abstract int loadOmemoMessageCounter(OmemoDevice userDevice, OmemoDevice contactsDevice)
userDevice
- our omemoDevicecontactsDevice
- device of which we want to get the message counter.public abstract void setDateOfLastReceivedMessage(OmemoDevice userDevice, OmemoDevice contactsDevice, java.util.Date date)
userDevice
- omemoManager of our device.contactsDevice
- device in questiondate
- date of the last received messagepublic abstract java.util.Date getDateOfLastReceivedMessage(OmemoDevice userDevice, OmemoDevice contactsDevice)
userDevice
- our OmemoDevice.contactsDevice
- device in questionpublic abstract void setDateOfLastDeviceIdPublication(OmemoDevice userDevice, OmemoDevice contactsDevice, java.util.Date date)
userDevice
- our OmemoDevicecontactsDevice
- OmemoDevice in questiondate
- date of the last publication after not being publishedpublic abstract java.util.Date getDateOfLastDeviceIdPublication(OmemoDevice userDevice, OmemoDevice contactsDevice)
userDevice
- our OmemoDevicecontactsDevice
- OmemoDevice in questionpublic abstract void setDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice, java.util.Date date)
userDevice
- our OmemoDevice.date
- datepublic abstract java.util.Date getDateOfLastSignedPreKeyRenewal(OmemoDevice userDevice)
userDevice
- our OmemoDevice.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)
userDevice
- our OmemoDevice.preKeyId
- id of the key to be loadedpublic abstract void storeOmemoPreKey(OmemoDevice userDevice, int preKeyId, T_PreKey preKey)
userDevice
- our OmemoDevice.preKeyId
- id of the keypreKey
- keypublic void storeOmemoPreKeys(OmemoDevice userDevice, java.util.TreeMap<java.lang.Integer,T_PreKey> preKeyHashMap)
userDevice
- our OmemoDevice.preKeyHashMap
- HashMap of preKeyspublic 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)
userDevice
- our OmemoDevice.public abstract T_SigPreKey loadOmemoSignedPreKey(OmemoDevice userDevice, int signedPreKeyId)
userDevice
- our OmemoDevice.signedPreKeyId
- id of the keypublic int loadCurrentOmemoSignedPreKeyId(OmemoDevice userDevice)
public abstract java.util.TreeMap<java.lang.Integer,T_SigPreKey> loadOmemoSignedPreKeys(OmemoDevice userDevice)
userDevice
- our OmemoDevice.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)
userDevice
- our OmemoDevice.signedPreKeyId
- id of the signedPreKeysignedPreKey
- the key itselfpublic 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)
userDevice
- our OmemoDevice.contactsDevice
- device whose session we want to loadpublic abstract java.util.HashMap<java.lang.Integer,T_Sess> loadAllRawSessionsOf(OmemoDevice userDevice, org.jxmpp.jid.BareJid contact)
userDevice
- our OmemoDevice.contact
- BareJid of the contact we want to get all sessions frompublic abstract void storeRawSession(OmemoDevice userDevice, OmemoDevice contactsDevice, T_Sess session)
userDevice
- our OmemoDevice.contactsDevice
- OmemoDevice whose session we want to storesession
- sessionpublic 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)
userDevice
- our OmemoDevice.contact
- contact we want to get the deviceList ofpublic OmemoCachedDeviceList loadCachedDeviceList(OmemoDevice userDevice)
userDevice
- public abstract void storeCachedDeviceList(OmemoDevice userDevice, org.jxmpp.jid.BareJid contact, OmemoCachedDeviceList contactsDeviceList)
userDevice
- our OmemoDevice.contact
- ContactcontactsDeviceList
- list of the contacts devices' ids.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
userDevice
- our OmemoDevice.CorruptedOmemoKeyException
- if the identityKey of userDevice is corrupted.public OmemoFingerprint getFingerprint(OmemoDevice userDevice, OmemoDevice contactsDevice) throws CorruptedOmemoKeyException, NoIdentityKeyException
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.public OmemoFingerprint getFingerprintAndMaybeBuildSession(OmemoManager.LoggedInOmemoManager managerGuard, OmemoDevice contactsDevice) throws CannotEstablishOmemoSessionException, CorruptedOmemoKeyException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException, org.jivesoftware.smack.SmackException.NoResponseException
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
java.lang.InterruptedException
SmackException.NoResponseException