public final class OmemoManager
extends org.jivesoftware.smack.Manager
| Modifier and Type | Class and Description |
|---|---|
static interface |
OmemoManager.InitializationFinishedCallback
Callback which can be used to get notified, when the OmemoManager finished initializing.
|
static class |
OmemoManager.LoggedInOmemoManager
Guard class which ensures that the wrapped OmemoManager knows its BareJid.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addOmemoMessageListener(OmemoMessageListener listener)
Add an OmemoMessageListener.
|
void |
addOmemoMucMessageListener(OmemoMucMessageListener listener)
Add an OmemoMucMessageListener.
|
boolean |
contactSupportsOmemo(org.jxmpp.jid.BareJid contact)
Returns true, if the contact has any active devices published in a deviceList.
|
OmemoMessage.Received |
decrypt(org.jxmpp.jid.BareJid sender,
OmemoElement omemoElement)
Manually decrypt an OmemoElement.
|
java.util.List<MessageOrOmemoMessage> |
decryptMamQueryResult(org.jivesoftware.smackx.mam.MamManager.MamQuery mamQuery)
Decrypt messages from a MAM query.
|
void |
distrustOmemoIdentity(OmemoDevice device,
OmemoFingerprint fingerprint)
Distrust the fingerprint/OmemoDevice tuple.
|
OmemoMessage.Sent |
encrypt(org.jxmpp.jid.BareJid recipient,
java.lang.String message)
OMEMO encrypt a cleartext message for a single recipient.
|
OmemoMessage.Sent |
encrypt(org.jivesoftware.smackx.muc.MultiUserChat muc,
java.lang.String message)
Encrypt a message for all recipients in the MultiUserChat.
|
OmemoMessage.Sent |
encrypt(java.util.Set<org.jxmpp.jid.BareJid> recipients,
java.lang.String message)
OMEMO encrypt a cleartext message for multiple recipients.
|
java.util.HashMap<OmemoDevice,OmemoFingerprint> |
getActiveFingerprints(org.jxmpp.jid.BareJid contact)
Return all OmemoFingerprints of active devices of a contact.
|
java.lang.Integer |
getDeviceId()
Return the deviceId of this OmemoManager.
|
java.util.Set<OmemoDevice> |
getDevicesOf(org.jxmpp.jid.BareJid contact)
Return a set of all OMEMO capable devices of a contact.
|
OmemoFingerprint |
getFingerprint(OmemoDevice device)
Get the fingerprint of a contacts device.
|
static OmemoManager |
getInstanceFor(org.jivesoftware.smack.XMPPConnection connection)
Returns an OmemoManager instance for the given connection.
|
static OmemoManager |
getInstanceFor(org.jivesoftware.smack.XMPPConnection connection,
java.lang.Integer deviceId)
Return an OmemoManager instance for the given connection and deviceId.
|
OmemoDevice |
getOwnDevice()
Return the OmemoDevice of the user.
|
OmemoFingerprint |
getOwnFingerprint()
Return the fingerprint of our identity key.
|
org.jxmpp.jid.BareJid |
getOwnJid()
Return the BareJid of the user.
|
void |
initialize()
Initializes the OmemoManager.
|
void |
initializeAsync(OmemoManager.InitializationFinishedCallback finishedCallback)
Initialize the manager without blocking.
|
boolean |
isDecidedOmemoIdentity(OmemoDevice device,
OmemoFingerprint fingerprint)
Returns true, if the fingerprint/OmemoDevice tuple is decided by the user.
|
boolean |
isTrustedOmemoIdentity(OmemoDevice device,
OmemoFingerprint fingerprint)
Returns true, if the fingerprint/OmemoDevice tuple is trusted, otherwise false.
|
boolean |
multiUserChatSupportsOmemo(org.jivesoftware.smackx.muc.MultiUserChat multiUserChat)
Returns true, if the MUC with the EntityBareJid multiUserChat is non-anonymous and members only (prerequisite
for OMEMO encryption in MUC).
|
void |
purgeDeviceList()
Publish a new device list with just our own deviceId in it.
|
static int |
randomDeviceId()
Returns a pseudo random number from the interval [1, Integer.MAX_VALUE].
|
void |
rebuildSessionWith(OmemoDevice contactsDevice)
Build a fresh session with a contacts device.
|
void |
removeOmemoMessageListener(OmemoMessageListener listener)
Remove an OmemoMessageListener.
|
void |
removeOmemoMucMessageListener(OmemoMucMessageListener listener)
Remove an OmemoMucMessageListener.
|
void |
requestDeviceListUpdateFor(org.jxmpp.jid.BareJid contact)
Request a deviceList update from contact contact.
|
void |
resumeStanzaAndPEPListeners()
Register stanza listeners needed for OMEMO.
|
void |
rotateSignedPreKey()
Rotate the signedPreKey published in our OmemoBundle and republish it.
|
void |
sendRatchetUpdateMessage(OmemoDevice recipient)
Send a ratchet update message.
|
static boolean |
serverSupportsOmemo(org.jivesoftware.smack.XMPPConnection connection,
org.jxmpp.jid.DomainBareJid server)
Returns true, if the Server supports PEP.
|
void |
setTrustCallback(OmemoTrustCallback callback)
Set a TrustCallback for this particular OmemoManager.
|
void |
stopStanzaAndPEPListeners()
Remove active stanza listeners needed for OMEMO.
|
void |
trustOmemoIdentity(OmemoDevice device,
OmemoFingerprint fingerprint)
Trust that a fingerprint belongs to an OmemoDevice.
|
public static OmemoManager getInstanceFor(org.jivesoftware.smack.XMPPConnection connection, java.lang.Integer deviceId)
connection - XmppConnection.deviceId - MUST NOT be null and MUST be greater than 0.public static OmemoManager getInstanceFor(org.jivesoftware.smack.XMPPConnection connection)
connection - XmppConnection.public void setTrustCallback(OmemoTrustCallback callback)
callback - trustCallback.public void initialize()
throws org.jivesoftware.smack.SmackException.NotLoggedInException,
CorruptedOmemoKeyException,
java.lang.InterruptedException,
org.jivesoftware.smack.SmackException.NoResponseException,
org.jivesoftware.smack.SmackException.NotConnectedException,
org.jivesoftware.smack.XMPPException.XMPPErrorException,
org.jivesoftware.smackx.pubsub.PubSubException.NotALeafNodeException,
java.io.IOException
CorruptedOmemoKeyException - if the OMEMO key is corrupted.java.lang.InterruptedException - if the calling thread was interrupted.SmackException.NoResponseException - if there was no response from the remote entity.SmackException.NotConnectedException - if the XMPP connection is not connected.XMPPException.XMPPErrorException - if there was an XMPP error returned.SmackException.NotLoggedInException - if the XMPP connection is not authenticated.PubSubException.NotALeafNodeException - if a PubSub leaf node operation was attempted on a non-leaf node.java.io.IOException - if an I/O error occurred.public void initializeAsync(OmemoManager.InitializationFinishedCallback finishedCallback)
finishedCallback - callback that gets called once the manager is initialized.public java.util.Set<OmemoDevice> getDevicesOf(org.jxmpp.jid.BareJid contact) throws java.io.IOException
contact - contact we want to get a set of device of.java.io.IOException - if an I/O error occurred.requestDeviceListUpdateFor(BareJid)public OmemoMessage.Sent encrypt(org.jxmpp.jid.BareJid recipient, java.lang.String message) throws CryptoFailedException, UndecidedOmemoIdentityException, java.lang.InterruptedException, org.jivesoftware.smack.SmackException.NotConnectedException, org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.SmackException.NotLoggedInException, java.io.IOException
recipient - recipients bareJidmessage - text to encryptCryptoFailedException - when something crypto related failsUndecidedOmemoIdentityException - When there are undecided devicesjava.lang.InterruptedException - if the calling thread was interrupted.SmackException.NotConnectedException - if the XMPP connection is not connected.SmackException.NoResponseException - if there was no response from the remote entity.SmackException.NotLoggedInException - if the XMPP connection is not authenticated.java.io.IOException - if an I/O error occurred.public OmemoMessage.Sent encrypt(java.util.Set<org.jxmpp.jid.BareJid> recipients, java.lang.String message) throws CryptoFailedException, UndecidedOmemoIdentityException, java.lang.InterruptedException, org.jivesoftware.smack.SmackException.NotConnectedException, org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.SmackException.NotLoggedInException, java.io.IOException
recipients - recipients barejidsmessage - text to encryptCryptoFailedException - When something crypto related failsUndecidedOmemoIdentityException - When there are undecided devices.java.lang.InterruptedException - if the calling thread was interrupted.SmackException.NotConnectedException - if the XMPP connection is not connected.SmackException.NoResponseException - if there was no response from the remote entity.SmackException.NotLoggedInException - if the XMPP connection is not authenticated.java.io.IOException - if an I/O error occurred.public OmemoMessage.Sent encrypt(org.jivesoftware.smackx.muc.MultiUserChat muc, java.lang.String message) throws UndecidedOmemoIdentityException, CryptoFailedException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException, org.jivesoftware.smack.SmackException.NoResponseException, NoOmemoSupportException, org.jivesoftware.smack.SmackException.NotLoggedInException, java.io.IOException
muc - multiUserChatmessage - message to sendUndecidedOmemoIdentityException - when there are undecided devices.CryptoFailedException - if the OMEMO cryptography failed.XMPPException.XMPPErrorException - if there was an XMPP error returned.SmackException.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.NoOmemoSupportException - When the muc doesn't support OMEMO.SmackException.NotLoggedInException - if the XMPP connection is not authenticated.java.io.IOException - if an I/O error occurred.public OmemoMessage.Received decrypt(org.jxmpp.jid.BareJid sender, OmemoElement omemoElement) throws org.jivesoftware.smack.SmackException.NotLoggedInException, CorruptedOmemoKeyException, NoRawSessionException, CryptoFailedException, java.io.IOException
sender - bareJid of the message sender (must be the jid of the contact who sent the message)omemoElement - omemoElementSmackException.NotLoggedInException - if the Manager is not authenticatedCorruptedOmemoKeyException - if our or their key is corruptedNoRawSessionException - if the message was not a preKeyMessage, but we had no session with the contactCryptoFailedException - if decryption failsjava.io.IOException - if an I/O error occurred.public java.util.List<MessageOrOmemoMessage> decryptMamQueryResult(org.jivesoftware.smackx.mam.MamManager.MamQuery mamQuery) throws org.jivesoftware.smack.SmackException.NotLoggedInException, java.io.IOException
mamQuery - The MAM querySmackException.NotLoggedInException - if the Manager is not authenticated.java.io.IOException - if an I/O error occurred.public void trustOmemoIdentity(OmemoDevice device, OmemoFingerprint fingerprint)
device - devicefingerprint - fingerprintpublic void distrustOmemoIdentity(OmemoDevice device, OmemoFingerprint fingerprint)
device - devicefingerprint - fingerprintpublic boolean isTrustedOmemoIdentity(OmemoDevice device, OmemoFingerprint fingerprint)
device - devicefingerprint - fingerprinttrue if this is a trusted OMEMO identity.public boolean isDecidedOmemoIdentity(OmemoDevice device, OmemoFingerprint fingerprint)
device - devicefingerprint - fingerprinttrue if the trust is decided for the identity.public void sendRatchetUpdateMessage(OmemoDevice recipient) throws org.jivesoftware.smack.SmackException.NotLoggedInException, CorruptedOmemoKeyException, java.lang.InterruptedException, org.jivesoftware.smack.SmackException.NoResponseException, java.security.NoSuchAlgorithmException, org.jivesoftware.smack.SmackException.NotConnectedException, CryptoFailedException, CannotEstablishOmemoSessionException, java.io.IOException
recipient - recipientCorruptedOmemoKeyException - When the used identityKeys are corruptedCryptoFailedException - When something fails with the cryptoCannotEstablishOmemoSessionException - When we can't establish a session with the recipientSmackException.NotLoggedInException - if the XMPP connection is not authenticated.java.lang.InterruptedException - if the calling thread was interrupted.SmackException.NoResponseException - if there was no response from the remote entity.java.security.NoSuchAlgorithmException - if no such algorithm is available.SmackException.NotConnectedException - if the XMPP connection is not connected.java.io.IOException - if an I/O error occurred.public boolean contactSupportsOmemo(org.jxmpp.jid.BareJid contact)
throws java.lang.InterruptedException,
org.jivesoftware.smackx.pubsub.PubSubException.NotALeafNodeException,
org.jivesoftware.smack.XMPPException.XMPPErrorException,
org.jivesoftware.smack.SmackException.NotConnectedException,
org.jivesoftware.smack.SmackException.NoResponseException,
java.io.IOException
contact - contactSmackException.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.PubSubException.NotALeafNodeException - if a PubSub leaf node operation was attempted on a non-leaf node.XMPPException.XMPPErrorException - if there was an XMPP error returned.java.io.IOException - if an I/O error occurred.public boolean multiUserChatSupportsOmemo(org.jivesoftware.smackx.muc.MultiUserChat multiUserChat)
throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
org.jivesoftware.smack.SmackException.NotConnectedException,
java.lang.InterruptedException,
org.jivesoftware.smack.SmackException.NoResponseException
multiUserChat - MUCXMPPException.XMPPErrorException - if there was an XMPP protocol level errorSmackException.NotConnectedException - if the connection is not connectedjava.lang.InterruptedException - if the thread is interruptedSmackException.NoResponseException - if the server does not respondpublic static boolean serverSupportsOmemo(org.jivesoftware.smack.XMPPConnection connection,
org.jxmpp.jid.DomainBareJid server)
throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
org.jivesoftware.smack.SmackException.NotConnectedException,
java.lang.InterruptedException,
org.jivesoftware.smack.SmackException.NoResponseException
connection - XMPPConnectionserver - domainBareJid of the server to testXMPPException.XMPPErrorException - if there was an XMPP error returned.SmackException.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.public OmemoFingerprint getOwnFingerprint() throws org.jivesoftware.smack.SmackException.NotLoggedInException, CorruptedOmemoKeyException, java.io.IOException
SmackException.NotLoggedInException - if we don't know our bareJid yet.CorruptedOmemoKeyException - if our identityKey is corrupted.java.io.IOException - if an I/O error occurred.public OmemoFingerprint getFingerprint(OmemoDevice device) throws CannotEstablishOmemoSessionException, org.jivesoftware.smack.SmackException.NotLoggedInException, CorruptedOmemoKeyException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException, org.jivesoftware.smack.SmackException.NoResponseException, java.io.IOException
device - contacts OmemoDeviceCannotEstablishOmemoSessionException - if we have no session yet, and are unable to create one.SmackException.NotLoggedInException - if the XMPP connection is not authenticated.CorruptedOmemoKeyException - if the copy of the fingerprint we have is corrupted.SmackException.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.public java.util.HashMap<OmemoDevice,OmemoFingerprint> getActiveFingerprints(org.jxmpp.jid.BareJid contact) throws org.jivesoftware.smack.SmackException.NotLoggedInException, CorruptedOmemoKeyException, CannotEstablishOmemoSessionException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException, org.jivesoftware.smack.SmackException.NoResponseException, java.io.IOException
contact - contactSmackException.NotLoggedInException - if the XMPP connection is not authenticated.CorruptedOmemoKeyException - if the OMEMO key is corrupted.CannotEstablishOmemoSessionException - if no OMEMO session could be established.SmackException.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.public void addOmemoMessageListener(OmemoMessageListener listener)
listener - OmemoMessageListenerpublic void removeOmemoMessageListener(OmemoMessageListener listener)
listener - OmemoMessageListenerpublic void addOmemoMucMessageListener(OmemoMucMessageListener listener)
listener - OmemoMessageListener.public void removeOmemoMucMessageListener(OmemoMucMessageListener listener)
listener - OmemoMucMessageListenerpublic void requestDeviceListUpdateFor(org.jxmpp.jid.BareJid contact)
throws java.lang.InterruptedException,
org.jivesoftware.smackx.pubsub.PubSubException.NotALeafNodeException,
org.jivesoftware.smack.XMPPException.XMPPErrorException,
org.jivesoftware.smack.SmackException.NotConnectedException,
org.jivesoftware.smack.SmackException.NoResponseException,
java.io.IOException
contact - contact we want to obtain the deviceList from.java.lang.InterruptedException - if the calling thread was interrupted.PubSubException.NotALeafNodeException - if a PubSub leaf node operation was attempted on a non-leaf node.XMPPException.XMPPErrorException - if there was an XMPP error returned.SmackException.NotConnectedException - if the XMPP connection is not connected.SmackException.NoResponseException - if there was no response from the remote entity.java.io.IOException - if an I/O error occurred.public void purgeDeviceList()
throws org.jivesoftware.smack.SmackException.NotLoggedInException,
java.lang.InterruptedException,
org.jivesoftware.smack.XMPPException.XMPPErrorException,
org.jivesoftware.smack.SmackException.NotConnectedException,
org.jivesoftware.smack.SmackException.NoResponseException,
java.io.IOException,
org.jivesoftware.smackx.pubsub.PubSubException.NotALeafNodeException
SmackException.NotLoggedInException - if the XMPP connection is not authenticated.java.lang.InterruptedException - if the calling thread was interrupted.XMPPException.XMPPErrorException - if there was an XMPP error returned.SmackException.NotConnectedException - if the XMPP connection is not connected.SmackException.NoResponseException - if there was no response from the remote entity.java.io.IOException - if an I/O error occurred.PubSubException.NotALeafNodeException - if a PubSub leaf node operation was attempted on a non-leaf node.public void rotateSignedPreKey()
throws CorruptedOmemoKeyException,
org.jivesoftware.smack.SmackException.NotLoggedInException,
org.jivesoftware.smack.XMPPException.XMPPErrorException,
org.jivesoftware.smack.SmackException.NotConnectedException,
java.lang.InterruptedException,
org.jivesoftware.smack.SmackException.NoResponseException,
java.io.IOException,
org.jivesoftware.smackx.pubsub.PubSubException.NotALeafNodeException
CorruptedOmemoKeyException - When the IdentityKeyPair is damaged.java.lang.InterruptedException - XMPP errorXMPPException.XMPPErrorException - XMPP errorSmackException.NotConnectedException - XMPP errorSmackException.NoResponseException - XMPP errorSmackException.NotLoggedInException - if the XMPP connection is not authenticated.java.io.IOException - if an I/O error occurred.PubSubException.NotALeafNodeException - if a PubSub leaf node operation was attempted on a non-leaf node.public static int randomDeviceId()
public org.jxmpp.jid.BareJid getOwnJid()
public java.lang.Integer getDeviceId()
public OmemoDevice getOwnDevice()
public void resumeStanzaAndPEPListeners()
stopStanzaAndPEPListeners() was called.public void stopStanzaAndPEPListeners()
public void rebuildSessionWith(OmemoDevice contactsDevice) throws java.lang.InterruptedException, org.jivesoftware.smack.SmackException.NoResponseException, CorruptedOmemoKeyException, org.jivesoftware.smack.SmackException.NotConnectedException, CannotEstablishOmemoSessionException, org.jivesoftware.smack.SmackException.NotLoggedInException
contactsDevice - OmemoDevice of a contact.java.lang.InterruptedException - if the calling thread was interrupted.SmackException.NoResponseException - if there was no response from the remote entity.CorruptedOmemoKeyException - if our or their identityKey is corrupted.SmackException.NotConnectedException - if the XMPP connection is not connected.CannotEstablishOmemoSessionException - if no new session can be established.SmackException.NotLoggedInException - if the connection is not authenticated.