()
| 107 | const [isValid, setIsValid] = useState<boolean | null>(null) |
| 108 | |
| 109 | const handleVerify = () => { |
| 110 | const formattedInput = inputCode.replace(/\s/g, "") |
| 111 | const secretKey = process.env.PLASMO_PUBLIC_CODEBOX_SECRET4 |
| 112 | |
| 113 | if ( |
| 114 | formattedInput.length == 6 && |
| 115 | TOTP.verifyTOTP(secretKey, formattedInput) |
| 116 | ) { |
| 117 | setIsValid(true) |
| 118 | onConfirm() |
| 119 | } else if (process.env.PLASMO_PUBLIC_CODEBOX_SECRET3 == formattedInput) { |
| 120 | setIsValid(true) |
| 121 | onConfirm() |
| 122 | } else { |
| 123 | setIsValid(false) |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | // 在原有return中添加: |
| 128 | return ( |
nothing calls this directly
no test coverage detected