ThreadCount Community edition
Uniform stock management for healthcare linen rooms: the coordinator app, the phone counter and the staff app, for your own server. Built from d947f89 on 2026-09-15. Licensed under the Functional Source License (FSL-1.1-ALv2).
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
/* Print the current six-digit code for a base32 TOTP secret.
|
||||
*
|
||||
* TOTP_SECRET=JBSWY3DPEHPK3PXP npx tsx scripts/totp-code.ts
|
||||
*
|
||||
* For the end-to-end suites, which enrol a second factor through the real routes and then need a
|
||||
* live code to sign in with. The secret comes from the environment, never an argument — argv is
|
||||
* visible to every process on the box. Uses the product's own implementation (lib/totp.ts), which
|
||||
* scripts/check-totp.ts proves against RFC 6238's published vectors.
|
||||
*/
|
||||
import { base32Decode, totp } from "../lib/totp";
|
||||
|
||||
const secret = process.env.TOTP_SECRET || "";
|
||||
if (!secret) { console.error("TOTP_SECRET must be set in the environment"); process.exit(1); }
|
||||
process.stdout.write(totp(base32Decode(secret)) + "\n");
|
||||
Reference in New Issue
Block a user