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

Ignoring white space or other invalid charaters in base32 #28

Closed
timothymctim opened this issue Nov 14, 2018 · 2 comments
Closed

Ignoring white space or other invalid charaters in base32 #28

timothymctim opened this issue Nov 14, 2018 · 2 comments
Assignees

Comments

@timothymctim
Copy link

If I understood the code correctly, the base32tohex function in crypto.js, does not ignore white spaces, leading to an incorrect OTP if the secret key is manually added.
A long while ago, I created a similar app for FxOS where I implemented a similar base32 function, which “normalizes”/fixes the input first, before computing the OTP.

base32_input = base32_input.trim().replace(/ /g, '').replace(/-/g, '');
base32_input = base32_input.toUpperCase();
base32_input = base32_input.replace(/1/g, 'L').replace(/8/g, 'B').replace(/0/g, 'O');

If you don’t have time to improve the code, I would be willing to try to setup a development environment for Sailfish OS and make a pull request.

@seiichiro0185
Copy link
Owner

Thank you for reporting this. I'll try taking a look at it next weekend.

@seiichiro0185 seiichiro0185 self-assigned this Nov 15, 2018
@seiichiro0185
Copy link
Owner

I implemented base32 validation for the input field in version 1.8.0 which is up on openrepos.net and will be up in the Store in the next days.
I don't like the idea of manipulating the secret "Behind the users Back", but the Input Validation at least does prevent inserting / saving any invalid secrets to the database.

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

No branches or pull requests

2 participants