{
  "id": 21948680,
  "title": "TOTP in Node with no packages: four steps, each checked against RFC 6238",
  "url": "https://urgent.news/2026/11/26/totp-in-node-with-no-packages-four-steps-each-checked-against-rfc-6238",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-26T08:42:43.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/theomnikit/totp-in-node-with-no-packages-four-steps-each-checked-against-rfc-6238-45jm"
  },
  "original_language": "en",
  "account": "Two of four steps in authenticator code generation are examined: the Base32 secret decoding and clock conversion to a counter. The ASCII text 12345678901234567890 serves as the secret, provided in Base32 format as GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ. The current Unix time in seconds is divided by the period (typically 30 seconds) and the result, rounded down, serves as the counter. This counter is represented as 8 bytes, written using big-endian notation.",
  "summary": "When an authenticator code is rejected, the fault sits in one of four steps: decoding the secret, turning the clock into a counter, the HMAC, or the truncation to six digits. Writing those four steps yourself is the quickest way to know which one to look at. Here they are in Node with no packages, each with a known answer to check against. The known answer is the test vector from RFC 6238. Its…",
  "key_points": [
    "Four steps in TOTP generation examined: Base32 secret decoding and clock conversion",
    "ASCII secret \"12345678901234567890\" provided as GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ",
    "Unix time divided by period (30 seconds) to generate counter"
  ],
  "editors_take": "Implementing these specific RFC 6238 steps without external dependencies reduces the software supply chain risk for developers needing to build secure, time-based one-time password authenticators in Node environments.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}