Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Multi-Tenant One-Time Password Service

Issue, deliver, and verify short-lived one-time passwords while isolating tenant policy, abuse, and data.

Problem statement

For this exercise, assume that a tenant requests a challenge for a user, the user receives a code, and one verification attempt consumes it safely. Create a tenant-scoped OTP challenge under policy and abuse limits. Dispatch the code through one configured channel without exposing it in APIs or logs.

Atomically verify, expire, or consume a challenge with bounded attempts. Configure tenant-approved lifetime, channels, templates, and rate limits within platform bounds. Assume 10,000 tenants and 100,000 challenge requests per second at peak.

Issue accepted challenges within 300 milliseconds at p95 and verify locally within 150 milliseconds at p95. Codes expire after five minutes, allow five attempts, and retain non-secret audit metadata for ninety days.

Preserve this invariant: verification consumes one active challenge atomically, codes are never stored or logged in plaintext, and one tenant cannot exhaust another's capacity. Keep unrelated product features and company-specific infrastructure outside the first version.

What to build

  1. Create a tenant-scoped OTP challenge under policy and abuse limits.
  2. Dispatch the code through one configured channel without exposing it in APIs or logs.
  3. Atomically verify, expire, or consume a challenge with bounded attempts.
  4. Configure tenant-approved lifetime, channels, templates, and rate limits within platform bounds.

At scale

  • For this exercise, assume 10,000 tenants and 100,000 challenge requests per second at peak.
  • For this exercise, issue accepted challenges within 300 milliseconds at p95 and verify locally within 150 milliseconds at p95.
  • For this exercise, codes expire after five minutes, allow five attempts, and retain non-secret audit metadata for ninety days.