mirror of
https://github.com/Art051/it-tools.git
synced 2025-08-11 19:29:03 +00:00
refactor(otp-generator): coerce lowercase secret characters to uppercase
This commit is contained in:
committed by
Corentin THOMASSET
parent
f3b1863f09
commit
7c40539ef9
@@ -26,6 +26,7 @@ function base32toHex(base32: string) {
|
||||
const base32Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
||||
|
||||
const bits = base32
|
||||
.toUpperCase() // Since base 32, we coerce lowercase to uppercase
|
||||
.replace(/=+$/, '')
|
||||
.split('')
|
||||
.map((value) => base32Chars.indexOf(value).toString(2).padStart(5, '0'))
|
||||
|
||||
Reference in New Issue
Block a user