Ravi Sir's Cards › AWS
Hash and expire OTPs
A six-digit code has only one million possibilities. A plain hash is weak protection for a leaked table. Keep the HMAC key outside the table. Store the HMAC and an expiresAt Unix timestamp in seconds. Check expiry in the verifier and consume the code with a conditional update. DynamoDB TTL later clears the row.
Read card text
What this card says
Small code space
A six-digit code has only one million possibilities. A plain hash is weak protection for a leaked table.
Use a keyed HMAC
Keep the HMAC key outside the table. Store the HMAC and an expiresAt Unix timestamp in seconds.
Expire and consume
Check expiry in the verifier and consume the code with a conditional update. DynamoDB TTL later clears the row.