Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 21x 21x 6x 7x 7x | import type Redis from 'ioredis';
import { TokenRevocationService } from '../../application/user/token-revocation-service';
const REVOKED_REFRESH_KEY_PREFIX = 'revoked-refresh:';
export class RedisTokenRevocationService implements TokenRevocationService {
constructor(private readonly redis: Redis) {}
async revoke(jti: string, ttlSeconds: number): Promise<void> {
await this.redis.set(`${REVOKED_REFRESH_KEY_PREFIX}${jti}`, '1', 'EX', ttlSeconds);
}
async isRevoked(jti: string): Promise<boolean> {
const value = await this.redis.get(`${REVOKED_REFRESH_KEY_PREFIX}${jti}`);
return value !== null;
}
}
|