mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-28 19:56:39 +00:00
feat(tokens-repo): getting stored device key
This commit is contained in:
parent
0ae7c43ebf
commit
5a25e2a270
|
@ -97,7 +97,7 @@ class RedisTokensRepository(AbstractTokensRepository):
|
||||||
|
|
||||||
def _get_stored_new_device_key(self) -> Optional[NewDeviceKey]:
|
def _get_stored_new_device_key(self) -> Optional[NewDeviceKey]:
|
||||||
"""Retrieves new device key that is already stored."""
|
"""Retrieves new device key that is already stored."""
|
||||||
raise NotImplementedError
|
return self._new_device_key_from_hash(NEW_DEVICE_KEY_REDIS_KEY)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _is_date_key(key: str):
|
def _is_date_key(key: str):
|
||||||
|
@ -136,6 +136,9 @@ class RedisTokensRepository(AbstractTokensRepository):
|
||||||
def _recovery_key_from_hash(self, redis_key: str) -> Optional[RecoveryKey]:
|
def _recovery_key_from_hash(self, redis_key: str) -> Optional[RecoveryKey]:
|
||||||
return self._hash_as_model(redis_key, RecoveryKey)
|
return self._hash_as_model(redis_key, RecoveryKey)
|
||||||
|
|
||||||
|
def _new_device_key_from_hash(self, redis_key: str) -> Optional[NewDeviceKey]:
|
||||||
|
return self._hash_as_model(redis_key, NewDeviceKey)
|
||||||
|
|
||||||
def _store_model_as_hash(self, redis_key, model):
|
def _store_model_as_hash(self, redis_key, model):
|
||||||
r = self.connection
|
r = self.connection
|
||||||
for key, value in model.dict().items():
|
for key, value in model.dict().items():
|
||||||
|
|
Loading…
Reference in a new issue