Skip to content

Refactor WebAuthn public key algorithms#9270

Merged
aduth merged 2 commits intomainfrom
aduth-reorg-pub-key-alg
Sep 27, 2023
Merged

Refactor WebAuthn public key algorithms#9270
aduth merged 2 commits intomainfrom
aduth-reorg-pub-key-alg

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Sep 27, 2023

🛠 Summary of changes

Some small revisions and clean-up around WebAuthn supported algorithms.

Why?

  • Reduce repeated code with pubKeyCredParams object structure
  • Improve readability of possible and supported algorithms
  • Add sources for referencing, to improve understanding and help ensure accuracy in the future
  • Optimize output size by leveraging TypeScript const enum inlining (minified brotli size reduction of webauthn-setup.js by about 2%, from 1.17kb to 1.15kb)
    • As a follow-up task, we should consider porting most of our enum to const enum to take advantage of the same optimization
  • Eliminate duplicate algorithm in server-side WebAuthn gem configuration (PS256 was previously both a default and concatenated)

📜 Testing Plan

Verify no regressions in setting up a WebAuthn authentication method.

Ensure server-side algorithm configuration includes only unique values (this would produce false on main):

echo "WebAuthn.configuration.algorithms.uniq == WebAuthn.configuration.algorithms" | rails c
# => true

changelog: Internal, Code Quality, Improve code readability of WebAuthn supported algorithms
@aduth aduth requested a review from jmhooper September 27, 2023 14:15
@aduth aduth merged commit 460ab14 into main Sep 27, 2023
@aduth aduth deleted the aduth-reorg-pub-key-alg branch September 27, 2023 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants