refactor(tokens-repo): redis token key func

This commit is contained in:
Houkime 2022-12-14 15:34:25 +00:00
parent d8e3cd67e0
commit ba6a5261fa

View file

@ -57,9 +57,13 @@ class RedisTokensRepository(AbstractTokensRepository):
"""Delete the new device key"""
raise NotImplementedError
@staticmethod
def _token_redis_key(token: Token) -> str:
return RedisTokensRepository.token_key_for_device(token.device_name)
def _store_token(self, new_token: Token):
"""Store a token directly"""
key = RedisTokensRepository.token_key_for_device(new_token.device_name)
key = RedisTokensRepository._token_redis_key(new_token)
self._store_token_as_hash(key, new_token)
def _decrement_recovery_token(self):