MCPcopy Create free account
hub / github.com/027xiguapi/code-box / generateTOTP

Method generateTOTP

utils/totp.ts:12–16  ·  view source on GitHub ↗

* Generate a TOTP code from a secret key * @param secret Base32 encoded secret key * @returns TOTP code

(secret: string)

Source from the content-addressed store, hash-verified

10 * @returns TOTP code
11 */
12 public static generateTOTP(secret: string): string {
13 const epoch = Math.floor(Date.now() / 1000)
14 const timeCounter = Math.floor(epoch / this.PERIOD)
15 return this.generateTOTPAtCounter(secret, timeCounter)
16 }
17
18 /**
19 * Validate if a secret key is in valid Base32 format

Callers 1

verifyTOTPMethod · 0.95

Calls 1

generateTOTPAtCounterMethod · 0.95

Tested by

no test coverage detected