fix: Detect OTP protocols case-insensitively #723

This commit is contained in:
Artem Chepurnoy 2024-11-28 16:01:54 +02:00
parent 98bc4416ed
commit a6eaf9178e
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
1 changed files with 3 additions and 3 deletions

View File

@ -17,9 +17,9 @@ sealed interface TotpToken {
url: String,
): Either<Throwable, TotpToken> = catch {
when {
url.startsWith(PREFIX_OTP_AUTH) -> parseOtpAuth(url)
url.startsWith(PREFIX_OTP_STEAM) -> parseOtpSteam(url)
url.startsWith(PREFIX_OTP_MOBILE) -> parseOtpMobile(url)
url.startsWith(PREFIX_OTP_AUTH, ignoreCase = true) -> parseOtpAuth(url)
url.startsWith(PREFIX_OTP_STEAM, ignoreCase = true) -> parseOtpSteam(url)
url.startsWith(PREFIX_OTP_MOBILE, ignoreCase = true) -> parseOtpMobile(url)
else -> {
// By default we think that the url is a key and the token
// type is otp-auth.