Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix secret not being case-insensitive #81

Merged
merged 1 commit into from
Dec 28, 2023
Merged

Fix secret not being case-insensitive #81

merged 1 commit into from
Dec 28, 2023

Conversation

Toreno96
Copy link
Collaborator

Fixes #80.

Fixes #80.

* * *

Example secret provided by Google when trying to enable MFA for Google
account (with the note that spaces can be ignored):

```
qea4 ptmn kvd5 ampv wm6d rc6m bbh4 urbo
```

Example respective URI:

```
otpauth://totp/Google%3Adaniel%40buttercms.com?secret=qea4ptmnkvd5ampvwm6drc6mbbh4urbo&issuer=Google
```

Result:

```
$ otp add uri google
Enter URI:
Repeat for confirmation:
Usage: otp add uri [OPTIONS] ALIAS
Try 'otp add uri -h' for help.

Error: invalid Base32 value; Non-base32 digit found
```

This _is_ Base32-encoded, **however**, Google ignores the [official
spec](https://datatracker.ietf.org/doc/html/rfc3548#section-5) that
instructs to use **uppercase** letters for Base32-encoded value. On the
other hand, the spec also mentions case insensitivity of the value:

> The Base 32 encoding is designed to represent arbitrary sequences of
> octets in a form that needs to be case insensitive

So maybe the issue comes from the spec being ambiguous.

We should make the `secret` parameter case-insensitive.
@Toreno96 Toreno96 merged commit 3f28469 into master Dec 28, 2023
2 checks passed
@Toreno96 Toreno96 deleted the issue-80 branch December 28, 2023 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Key URI provided by Google detected as invalid Base32 value
1 participant