fix: support steam totp code generation and formatting

Co-authored-by: shuaiplus <100134295+shuaiplus@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-17 03:39:02 +00:00
committed by Shuai
parent 010cda972c
commit b5d58f1aa8
3 changed files with 35 additions and 10 deletions
+3 -1
View File
@@ -18,7 +18,9 @@ const TOTP_RING_CIRCUMFERENCE = 2 * Math.PI * TOTP_RING_RADIUS;
const failedIconHosts = new Set<string>();
function formatTotp(code: string): string {
if (!code || code.length < 6) return code;
if (!code) return code;
if (code.length === 5) return `${code.slice(0, 2)} ${code.slice(2)}`;
if (code.length < 6) return code;
return `${code.slice(0, 3)} ${code.slice(3, 6)}`;
}
@@ -235,7 +235,9 @@ export function maskSecret(value: string): string {
}
export function formatTotp(code: string): string {
if (!code || code.length < 6) return code;
if (!code) return code;
if (code.length === 5) return `${code.slice(0, 2)} ${code.slice(2)}`;
if (code.length < 6) return code;
return `${code.slice(0, 3)} ${code.slice(3, 6)}`;
}