mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-23 00:06:15 -04:00
refactor(otp-generator): coerce lowercase secret characters to uppercase
This commit is contained in:
parent
f3b1863f09
commit
7c40539ef9
3 changed files with 7 additions and 2 deletions
|
@ -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'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue