refactor(tokens-repo): redis token key func

pull/26/head
Houkime 2022-12-14 15:34:25 +00:00
parent d8e3cd67e0
commit ba6a5261fa
1 changed files with 5 additions and 1 deletions

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):