Code RoomPassword reset token spec
HardPrep Room Coding #4165

Password reset token spec

Vibe & agenticSecuritySenior–Staff~18 min

You're asking an AI agent to write a Go function that generates password-reset tokens, emails them, and later verifies a presented token against the stored one. Write the spec that makes token generation and verification cryptographically sound. What RNG, encoding, storage, and comparison rules do you mandate, and what acceptance criteria prove it? Then describe what a naive prompt ('generate a reset token and check it on use') gets wrong — there are several traps.

Implement
verify_reset_token(stored_records: list[str], user_id: str, presented_hash: str, now_epoch: int) → str
Examples
in[["u1|9f2a1c04|2000|0"],"u1","9f2a1c04",1500]out"ok"
in[["u1|9f2a1c04|2000|0"],"u1","9f2a1c05",1500]out"invalid_token"
in[["u1|9f2a1c04|2000|1"],"u1","9f2a1c04",1500]out"already_used"
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 18 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.