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

atob fails on user ids with underscores #66

Closed
ghost opened this issue Jan 24, 2019 · 3 comments
Closed

atob fails on user ids with underscores #66

ghost opened this issue Jan 24, 2019 · 3 comments

Comments

@ghost
Copy link

ghost commented Jan 24, 2019

The Encoder uses atob to encode a user id into a ByteArray. This fails on usernames with underscores like cool_dude_123 (which could be a unique username used by an application).

Uint8Array.from should work here for encoding strings with underscores.

user: {
    id: Uint8Array.from(
        "UZSL85T9AFC", c => c.charCodeAt(0)),
    name: "[email protected]",
    displayName: "Lee",
 }

This was taken from Duo Security's great writeup on Webauthn.

@grzuy
Copy link
Contributor

grzuy commented Feb 22, 2019

Hi @tomek-bt,

Thanks for the issue report!
Sorry I am not sure I totally understand what the issue is...

Are you saying that if you try register with username cool_dude_123, the registration doesn't work?
If that's what you saying I am not able to reproduce that, can you?

@ghost
Copy link
Author

ghost commented Feb 22, 2019

ahh maybe I went about this the wrong way. I dropped into a Javascript console and pasted the function

  function strToBin(str) {
    console.log(str);
    return Uint8Array.from(atob(str), c => c.charCodeAt(0));
  }

Then tried strToBin('foo_bar'), but I can't seem to reproduce this in the web app
atob-error

@grzuy
Copy link
Contributor

grzuy commented Feb 22, 2019

Gotcha.

@grzuy grzuy closed this as completed Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant