Interface RevocationChecker

Interface for application-side revocation checking.

The Me2em protocol does not prescribe a storage backend for revocation. Applications implement this interface using their preferred store (Redis, PostgreSQL, in-memory Set, etc.) and pass it to Session.verifyStateless.

// In-memory implementation (for simple cases)
class InMemoryRevocationChecker implements RevocationChecker {
private revoked = new Set<string>();
async isRevoked(sessionId: string): Promise<boolean> {
return this.revoked.has(sessionId);
}
revoke(sessionId: string): void {
this.revoked.add(sessionId);
}
}

// Redis implementation (for production)
class RedisRevocationChecker implements RevocationChecker {
constructor(private redis: Redis) {}
async isRevoked(sessionId: string): Promise<boolean> {
return (await this.redis.sismember('me2em:revoked', sessionId)) === 1;
}
}
interface RevocationChecker {
    isRevoked(sessionId: string): Promise<boolean>;
}

Methods

Methods

  • Checks whether a session has been revoked.

    Parameters

    • sessionId: string

      The jti field from the session payload.

    Returns Promise<boolean>

    A Promise resolving to true if revoked, false otherwise.