-
Notifications
You must be signed in to change notification settings - Fork 142
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
Helper to find the RP ID given users' devices and current origin #2729
Conversation
@LXIF @sea-snake please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, tests pass locally as well. Great work!
"Not possible. Devices must be registered for at least one of the following domains: ic0.app, internetcomputer.org, icp0.io" | ||
); | ||
} catch (error) { | ||
console.error(error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of wrapping the whole findWebAuthnRpId
function in a try/catch just to console log any errors, maybe the caller of findWebAuthnRpId
can console log the error instead to avoid the need for the try/catch?
Since re-throwing an error from a catch block is considered an anti pattern as far as I'm aware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I initially added it wanting to return something different. But then I decided against it and the try/catch was left. I'll remove it.
9c75fce
to
9cb4f27
Compare
Thanks! Did you wanted to add a comment only or approve the PR? |
My bad, friday brained. Approved now. |
* Helper to determine the webauthn RP ID * Improve tests * Rename * Improve comments * Apply suggestions from code review Co-authored-by: sea-snake <[email protected]> * Remove try/catch --------- Co-authored-by: sea-snake <[email protected]>
Motivation
We want to support user registering in multiple domains as well as logging in them.
In this PR, I introduce a helper to find the RP ID given a set of devices and current origin.
Changes
findWebAuthnRpId
.Tests
🟡 Some screens were changed