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

Method isValidSecret

utils/totp.ts:23–26  ·  view source on GitHub ↗

* Validate if a secret key is in valid Base32 format * @param secret The secret key to validate * @returns boolean indicating if the secret is valid

(secret: string)

Source from the content-addressed store, hash-verified

21 * @returns boolean indicating if the secret is valid
22 */
23 public static isValidSecret(secret: string): boolean {
24 const base32Regex = /^[A-Z2-7]+=*$/
25 return base32Regex.test(secret.toUpperCase())
26 }
27
28 /**
29 * Generate TOTP at a specific counter value

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected