Feature: Implement JWT Token Blacklist for Revocation with Merkle Tree Replication #8
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Blacklist Storage:
Key Structure: Use a dedicated prefix like _blacklist:tokens/ followed by the token_hash (SHA3-512 of the JWT).
Value: Simple JSON metadata: {"revoked_at": 1695280000, "reason": "compromised", "user_uuid": "abc123"}.
TTL: Inherit from original token's ExpiresAt (no need to keep forever; expired tokens auto-purge).
Storage Hook: On revocation, add to blacklist via db.Update (atomic with optional tamper log).
Merkle Tree Integration (cluster/merkle.go):
Inclusion: Treat _blacklist:tokens/* as regular keys in getAllKVPairsForMerkleTree()—no special handling needed.
Efficiency: Blacklists are small (few entries), so they add negligible overhead to tree diffs/hashes.
Sync Trigger: On revocation, optionally bump a "blacklist version" key (_meta:blacklist_version) to force quicker Merkle refresh in catch-up sync.
Pruning: During sync, auto-remove expired blacklist entries (e.g., in resolveConflict() if timestamp > revoked_at + TTL).
Example Flow
Configuration