Code RoomJWT time claims validation
MediumPrep Room Coding #281

JWT time claims validation

CodingSecurityMid–Senior~25 min

Validate the time-based claims of an already-decoded JWT payload (signature verification is out of scope). Given the claims dict and the current Unix time 'now', return 'valid' only if all present time claims pass: 'exp' (expiry) must be strictly greater than now, 'nbf' (not-before) must be <= now, and 'iat' (issued-at) must be <= now. A 'leeway' in seconds is allowed in the candidate's favor on each bound. Missing claims are skipped. Return the first failure as 'expired', 'not_yet_valid', or 'issued_in_future' in that check order, else 'valid'.

Implement
validate_jwt_claims(claims: dict, now: int, leeway: int) → str
Examples
in[{"exp":2000,"iat":1000,"nbf":1000},1500,0]out"valid"
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 25 min
InputExpectedGot
[{"exp":2000,"iat":1000,"nbf":1000},1500,0]"valid"not run yetsample