Class SignalOmemoStoreConnector

  • All Implemented Interfaces:
    org.whispersystems.libsignal.state.IdentityKeyStore, org.whispersystems.libsignal.state.PreKeyStore, org.whispersystems.libsignal.state.SessionStore, org.whispersystems.libsignal.state.SignedPreKeyStore

    public class SignalOmemoStoreConnector
    extends Object
    implements org.whispersystems.libsignal.state.IdentityKeyStore, org.whispersystems.libsignal.state.SessionStore, org.whispersystems.libsignal.state.PreKeyStore, org.whispersystems.libsignal.state.SignedPreKeyStore
    Class that adapts libsignal-protocol-java's Store classes to the OmemoStore class.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.whispersystems.libsignal.state.IdentityKeyStore

        org.whispersystems.libsignal.state.IdentityKeyStore.Direction
    • Constructor Summary

      Constructors 
      Constructor Description
      SignalOmemoStoreConnector​(OmemoManager omemoManager, OmemoStore<org.whispersystems.libsignal.IdentityKeyPair,​org.whispersystems.libsignal.IdentityKey,​org.whispersystems.libsignal.state.PreKeyRecord,​org.whispersystems.libsignal.state.SignedPreKeyRecord,​org.whispersystems.libsignal.state.SessionRecord,​org.whispersystems.libsignal.SignalProtocolAddress,​org.whispersystems.libsignal.ecc.ECPublicKey,​org.whispersystems.libsignal.state.PreKeyBundle,​org.whispersystems.libsignal.SessionCipher> store)  
    • Constructor Detail

      • SignalOmemoStoreConnector

        public SignalOmemoStoreConnector​(OmemoManager omemoManager,
                                         OmemoStore<org.whispersystems.libsignal.IdentityKeyPair,​org.whispersystems.libsignal.IdentityKey,​org.whispersystems.libsignal.state.PreKeyRecord,​org.whispersystems.libsignal.state.SignedPreKeyRecord,​org.whispersystems.libsignal.state.SessionRecord,​org.whispersystems.libsignal.SignalProtocolAddress,​org.whispersystems.libsignal.ecc.ECPublicKey,​org.whispersystems.libsignal.state.PreKeyBundle,​org.whispersystems.libsignal.SessionCipher> store)
    • Method Detail

      • getIdentityKeyPair

        public org.whispersystems.libsignal.IdentityKeyPair getIdentityKeyPair()
        Specified by:
        getIdentityKeyPair in interface org.whispersystems.libsignal.state.IdentityKeyStore
      • getLocalRegistrationId

        public int getLocalRegistrationId()
        The OMEMO protocol does not make use of a local registration ID, so we can simply return 0 here.
        Specified by:
        getLocalRegistrationId in interface org.whispersystems.libsignal.state.IdentityKeyStore
        Returns:
        local registration id.
      • saveIdentity

        public boolean saveIdentity​(org.whispersystems.libsignal.SignalProtocolAddress signalProtocolAddress,
                                    org.whispersystems.libsignal.IdentityKey identityKey)
        Specified by:
        saveIdentity in interface org.whispersystems.libsignal.state.IdentityKeyStore
      • isTrustedIdentity

        public boolean isTrustedIdentity​(org.whispersystems.libsignal.SignalProtocolAddress signalProtocolAddress,
                                         org.whispersystems.libsignal.IdentityKey identityKey,
                                         org.whispersystems.libsignal.state.IdentityKeyStore.Direction direction)
        Specified by:
        isTrustedIdentity in interface org.whispersystems.libsignal.state.IdentityKeyStore
      • loadPreKey

        public org.whispersystems.libsignal.state.PreKeyRecord loadPreKey​(int i)
                                                                   throws org.whispersystems.libsignal.InvalidKeyIdException
        Specified by:
        loadPreKey in interface org.whispersystems.libsignal.state.PreKeyStore
        Throws:
        org.whispersystems.libsignal.InvalidKeyIdException
      • storePreKey

        public void storePreKey​(int i,
                                org.whispersystems.libsignal.state.PreKeyRecord preKeyRecord)
        Specified by:
        storePreKey in interface org.whispersystems.libsignal.state.PreKeyStore
      • containsPreKey

        public boolean containsPreKey​(int i)
        Specified by:
        containsPreKey in interface org.whispersystems.libsignal.state.PreKeyStore
      • removePreKey

        public void removePreKey​(int i)
        Specified by:
        removePreKey in interface org.whispersystems.libsignal.state.PreKeyStore
      • loadSession

        public org.whispersystems.libsignal.state.SessionRecord loadSession​(org.whispersystems.libsignal.SignalProtocolAddress signalProtocolAddress)
        Specified by:
        loadSession in interface org.whispersystems.libsignal.state.SessionStore
      • storeSession

        public void storeSession​(org.whispersystems.libsignal.SignalProtocolAddress signalProtocolAddress,
                                 org.whispersystems.libsignal.state.SessionRecord sessionRecord)
        Specified by:
        storeSession in interface org.whispersystems.libsignal.state.SessionStore
      • containsSession

        public boolean containsSession​(org.whispersystems.libsignal.SignalProtocolAddress signalProtocolAddress)
        Specified by:
        containsSession in interface org.whispersystems.libsignal.state.SessionStore
      • deleteSession

        public void deleteSession​(org.whispersystems.libsignal.SignalProtocolAddress signalProtocolAddress)
        Specified by:
        deleteSession in interface org.whispersystems.libsignal.state.SessionStore
      • deleteAllSessions

        public void deleteAllSessions​(String s)
        Specified by:
        deleteAllSessions in interface org.whispersystems.libsignal.state.SessionStore
      • loadSignedPreKey

        public org.whispersystems.libsignal.state.SignedPreKeyRecord loadSignedPreKey​(int i)
                                                                               throws org.whispersystems.libsignal.InvalidKeyIdException
        Specified by:
        loadSignedPreKey in interface org.whispersystems.libsignal.state.SignedPreKeyStore
        Throws:
        org.whispersystems.libsignal.InvalidKeyIdException
      • loadSignedPreKeys

        public List<org.whispersystems.libsignal.state.SignedPreKeyRecord> loadSignedPreKeys()
        Specified by:
        loadSignedPreKeys in interface org.whispersystems.libsignal.state.SignedPreKeyStore
      • storeSignedPreKey

        public void storeSignedPreKey​(int i,
                                      org.whispersystems.libsignal.state.SignedPreKeyRecord signedPreKeyRecord)
        Specified by:
        storeSignedPreKey in interface org.whispersystems.libsignal.state.SignedPreKeyStore
      • containsSignedPreKey

        public boolean containsSignedPreKey​(int i)
        Specified by:
        containsSignedPreKey in interface org.whispersystems.libsignal.state.SignedPreKeyStore
      • removeSignedPreKey

        public void removeSignedPreKey​(int i)
        Specified by:
        removeSignedPreKey in interface org.whispersystems.libsignal.state.SignedPreKeyStore
      • asAddress

        public static org.whispersystems.libsignal.SignalProtocolAddress asAddress​(OmemoDevice device)