# Path: axolotl/state/axolotlstore.py
# class AxolotlStore(IdentityKeyStore, PreKeyStore, SignedPreKeyStore, SessionStore):
#     __metaclass__ = abc.ABCMeta
# 
# Path: axolotl/tests/inmemoryidentitykeystore.py
# class InMemoryIdentityKeyStore(IdentityKeyStore):
#     def __init__(self):
#         self.trustedKeys = {}
#         identityKeyPairKeys = Curve.generateKeyPair()
#         self.identityKeyPair = IdentityKeyPair(IdentityKey(identityKeyPairKeys.getPublicKey()),
#                                                identityKeyPairKeys.getPrivateKey())
#         self.localRegistrationId = KeyHelper.generateRegistrationId()
# 
#     def getIdentityKeyPair(self):
#         return self.identityKeyPair
# 
#     def getLocalRegistrationId(self):
#         return self.localRegistrationId
# 
#     def saveIdentity(self, recepientId, identityKey):
#         self.trustedKeys[recepientId] = identityKey
# 
#     def isTrustedIdentity(self, recepientId, identityKey):
#         if recepientId not in self.trustedKeys:
#             return True
#         return self.trustedKeys[recepientId] == identityKey
# 
# Path: axolotl/tests/inmemoryprekeystore.py
# class InMemoryPreKeyStore(PreKeyStore):
#     def __init__(self):
#         self.store = {}
# 
#     def loadPreKey(self, preKeyId):
#         if preKeyId not in self.store:
#             raise InvalidKeyIdException("No such prekeyRecord!")
# 
#         return PreKeyRecord(serialized=self.store[preKeyId])
# 
#     def storePreKey(self, preKeyId, preKeyRecord):
#         self.store[preKeyId] = preKeyRecord.serialize()
# 
#     def containsPreKey(self, preKeyId):
#         return preKeyId in self.store
# 
#     def removePreKey(self, preKeyId):
#         if preKeyId in self.store:
#             del self.store[preKeyId]
# 
# Path: axolotl/tests/inmemorysessionstore.py
# class InMemorySessionStore(SessionStore):
#     def __init__(self):
#         self.sessions = {}
# 
#     def loadSession(self, recepientId, deviceId):
#         if self.containsSession(recepientId, deviceId):
#             return SessionRecord(serialized=self.sessions[(recepientId, deviceId)])
#         else:
#             return SessionRecord()
# 
#     def getSubDeviceSessions(self, recepientId):
#         deviceIds = []
#         for k in self.sessions.keys():
#             if k[0] == recepientId:
#                 deviceIds.append(k[1])
# 
#         return deviceIds
# 
#     def storeSession(self, recepientId, deviceId, sessionRecord):
#         self.sessions[(recepientId, deviceId)] = sessionRecord.serialize()
# 
#     def containsSession(self, recepientId, deviceId):
#         return (recepientId, deviceId) in self.sessions
# 
#     def deleteSession(self, recepientId, deviceId):
#         del self.sessions[(recepientId, deviceId)]
# 
#     def deleteAllSessions(self, recepientId):
#         for k in self.sessions.keys():
#             if k[0] == recepientId:
#                 del self.sessions[k]
# 
# Path: axolotl/tests/inmemorysignedprekeystore.py
# class InMemorySignedPreKeyStore(SignedPreKeyStore):
#     def __init__(self):
#         self.store = {}
# 
#     def loadSignedPreKey(self, signedPreKeyId):
#         if signedPreKeyId not in self.store:
#             raise InvalidKeyIdException("No such signedprekeyrecord! %s " % signedPreKeyId)
# 
#         return SignedPreKeyRecord(serialized=self.store[signedPreKeyId])
# 
#     def loadSignedPreKeys(self):
#         results = []
#         for serialized in self.store.values():
#             results.append(SignedPreKeyRecord(serialized=serialized))
# 
#         return results
# 
#     def storeSignedPreKey(self, signedPreKeyId, signedPreKeyRecord):
#         self.store[signedPreKeyId] = signedPreKeyRecord.serialize()
# 
#     def containsSignedPreKey(self, signedPreKeyId):
#         return signedPreKeyId in self.store
# 
#     def removeSignedPreKey(self, signedPreKeyId):
#         del self.store[signedPreKeyId]


from ..state.axolotlstore import AxolotlStore
from .inmemoryidentitykeystore import InMemoryIdentityKeyStore
from .inmemoryprekeystore import InMemoryPreKeyStore
from .inmemorysessionstore import InMemorySessionStore
from .inmemorysignedprekeystore import InMemorySignedPreKeyStore
    def containsPreKey(self, preKeyId):
        return self.preKeyStore.containsPreKey(preKeyId)

    def removePreKey(self, preKeyId):
        self.preKeyStore.removePreKey(preKeyId)

    def loadSession(self, recepientId, deviceId):
        return self.sessionStore.loadSession(recepientId, deviceId)

    def getSubDeviceSessions(self, recepientId):
        return self.sessionStore.getSubDeviceSessions(recepientId)

    def storeSession(self, recepientId, deviceId, sessionRecord):
        self.sessionStore.storeSession(recepientId, deviceId, sessionRecord)

    def containsSession(self, recepientId, deviceId):
        return self.sessionStore.containsSession(recepientId, deviceId)

    def deleteSession(self, recepientId, deviceId):
        self.sessionStore.deleteSession(recepientId, deviceId)

    def deleteAllSessions(self, recepientId):
        self.sessionStore.deleteAllSessions(recepientId)

    def loadSignedPreKey(self, signedPreKeyId):
        return self.signedPreKeyStore.loadSignedPreKey(signedPreKeyId)

    def loadSignedPreKeys(self):
        return self.signedPreKeyStore.loadSignedPreKeys()


# Path: axolotl/state/axolotlstore.py
# class AxolotlStore(IdentityKeyStore, PreKeyStore, SignedPreKeyStore, SessionStore):
#     __metaclass__ = abc.ABCMeta
# 
# Path: axolotl/tests/inmemoryidentitykeystore.py
# class InMemoryIdentityKeyStore(IdentityKeyStore):
#     def __init__(self):
#         self.trustedKeys = {}
#         identityKeyPairKeys = Curve.generateKeyPair()
#         self.identityKeyPair = IdentityKeyPair(IdentityKey(identityKeyPairKeys.getPublicKey()),
#                                                identityKeyPairKeys.getPrivateKey())
#         self.localRegistrationId = KeyHelper.generateRegistrationId()
# 
#     def getIdentityKeyPair(self):
#         return self.identityKeyPair
# 
#     def getLocalRegistrationId(self):
#         return self.localRegistrationId
# 
#     def saveIdentity(self, recepientId, identityKey):
#         self.trustedKeys[recepientId] = identityKey
# 
#     def isTrustedIdentity(self, recepientId, identityKey):
#         if recepientId not in self.trustedKeys:
#             return True
#         return self.trustedKeys[recepientId] == identityKey
# 
# Path: axolotl/tests/inmemoryprekeystore.py
# class InMemoryPreKeyStore(PreKeyStore):
#     def __init__(self):
#         self.store = {}
# 
#     def loadPreKey(self, preKeyId):
#         if preKeyId not in self.store:
#             raise InvalidKeyIdException("No such prekeyRecord!")
# 
#         return PreKeyRecord(serialized=self.store[preKeyId])
# 
#     def storePreKey(self, preKeyId, preKeyRecord):
#         self.store[preKeyId] = preKeyRecord.serialize()
# 
#     def containsPreKey(self, preKeyId):
#         return preKeyId in self.store
# 
#     def removePreKey(self, preKeyId):
#         if preKeyId in self.store:
#             del self.store[preKeyId]
# 
# Path: axolotl/tests/inmemorysessionstore.py
# class InMemorySessionStore(SessionStore):
#     def __init__(self):
#         self.sessions = {}
# 
#     def loadSession(self, recepientId, deviceId):
#         if self.containsSession(recepientId, deviceId):
#             return SessionRecord(serialized=self.sessions[(recepientId, deviceId)])
#         else:
#             return SessionRecord()
# 
#     def getSubDeviceSessions(self, recepientId):
#         deviceIds = []
#         for k in self.sessions.keys():
#             if k[0] == recepientId:
#                 deviceIds.append(k[1])
# 
#         return deviceIds
# 
#     def storeSession(self, recepientId, deviceId, sessionRecord):
#         self.sessions[(recepientId, deviceId)] = sessionRecord.serialize()
# 
#     def containsSession(self, recepientId, deviceId):
#         return (recepientId, deviceId) in self.sessions
# 
#     def deleteSession(self, recepientId, deviceId):
#         del self.sessions[(recepientId, deviceId)]
# 
#     def deleteAllSessions(self, recepientId):
#         for k in self.sessions.keys():
#             if k[0] == recepientId:
#                 del self.sessions[k]
# 
# Path: axolotl/tests/inmemorysignedprekeystore.py
# class InMemorySignedPreKeyStore(SignedPreKeyStore):
#     def __init__(self):
#         self.store = {}
# 
#     def loadSignedPreKey(self, signedPreKeyId):
#         if signedPreKeyId not in self.store:
#             raise InvalidKeyIdException("No such signedprekeyrecord! %s " % signedPreKeyId)
# 
#         return SignedPreKeyRecord(serialized=self.store[signedPreKeyId])
# 
#     def loadSignedPreKeys(self):
#         results = []
#         for serialized in self.store.values():
#             results.append(SignedPreKeyRecord(serialized=serialized))
# 
#         return results
# 
#     def storeSignedPreKey(self, signedPreKeyId, signedPreKeyRecord):
#         self.store[signedPreKeyId] = signedPreKeyRecord.serialize()
# 
#     def containsSignedPreKey(self, signedPreKeyId):
#         return signedPreKeyId in self.store
# 
#     def removeSignedPreKey(self, signedPreKeyId):
#         del self.store[signedPreKeyId]


# Path: axolotl/tests/inmemoryaxolotlstore.py
from ..state.axolotlstore import AxolotlStore
from .inmemoryidentitykeystore import InMemoryIdentityKeyStore
from .inmemoryprekeystore import InMemoryPreKeyStore
from .inmemorysessionstore import InMemorySessionStore
from .inmemorysignedprekeystore import InMemorySignedPreKeyStore

    def containsPreKey(self, preKeyId):
        return self.preKeyStore.containsPreKey(preKeyId)

    def removePreKey(self, preKeyId):
        self.preKeyStore.removePreKey(preKeyId)

    def loadSession(self, recepientId, deviceId):
        return self.sessionStore.loadSession(recepientId, deviceId)

    def getSubDeviceSessions(self, recepientId):
        return self.sessionStore.getSubDeviceSessions(recepientId)

    def storeSession(self, recepientId, deviceId, sessionRecord):
        self.sessionStore.storeSession(recepientId, deviceId, sessionRecord)

    def containsSession(self, recepientId, deviceId):
        return self.sessionStore.containsSession(recepientId, deviceId)

    def deleteSession(self, recepientId, deviceId):
        self.sessionStore.deleteSession(recepientId, deviceId)

    def deleteAllSessions(self, recepientId):
        self.sessionStore.deleteAllSessions(recepientId)

    def loadSignedPreKey(self, signedPreKeyId):
        return self.signedPreKeyStore.loadSignedPreKey(signedPreKeyId)

    def loadSignedPreKeys(self):
        return self.signedPreKeyStore.loadSignedPreKeys()


    def storeSignedPreKey(self, signedPreKeyId, signedPreKeyRecord):