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

Server-side WASM support #447

Open
BrandonDyer64 opened this issue Aug 14, 2024 · 6 comments
Open

Server-side WASM support #447

BrandonDyer64 opened this issue Aug 14, 2024 · 6 comments

Comments

@BrandonDyer64
Copy link

BrandonDyer64 commented Aug 14, 2024

Is your feature request related to a problem? Please describe.
I'm not able to compile webauthn-rs due to openssl being included in a non-optional way. Unfortunately, the openssl crate cannot be compiled on wasm-unknown-unknown which is required for my application.

Describe the solution you'd like
Use an alternative crypto library that's written in native Rust when compiling to wasm-uknown-unknown.

OpenSSL is the only library I have found that allows us to reconstruct an EC public key from its X/Y points or an RSA public key from its n/e for use with signature verification. Without this, we are not able to parse authenticator credentials to perform authentication.

Is this still true? There must be something out there that can work for authentication. Are aws-lc-rs or ring incompatible?

Describe alternatives you've considered

  • An openssl feature enabled by default that can be disabled by users of webauthn-rs
    • If you look at the Platform Support section of rustls you can see they provide a CryptoProvider struct that allows the developer to "replace all cryptography dependencies of rustls. This is a route to being portable to a wider set of architectures and environments, or compliance requirements."

Additional context
I'm running my server code in a Cloudflare Worker

@Firstyear
Copy link
Member

ring crashes on a lot of platforms so we can't use it. Haven't looked at aws-lc-rs

we are considering moving to he RustCrypto ecosystem.

@BrandonDyer64
Copy link
Author

Thank you for your response @Firstyear. Do you know about how long it'll be before that'll be in production? And, is there anything that can be done in the meantime (other libraries, techniques, hacks) that you can think of?

@Firstyear
Copy link
Member

I won't be able to get to it for some time - if @micolous has spare time and feels up it to they can.

Otherwise, if you want to help, feel free. I'm starting a "glue" crate because RustCrypto crates are generally a fragmented bunch and the glue is needed. From there we can swap out small parts of the primitives one at a time, and potentially even make the glue crate it's own interface etc.

@yaleman
Copy link
Member

yaleman commented Aug 15, 2024

Rather than start Yet Another Glue Crate, I'd probably help out rustls and/or implement the crypto::CryptoProvider trait as noted to avoid duplicating work... there was a recent talk saying that they've replaced OpenSSL in some projects recently with it

@Firstyear
Copy link
Member

@yaleman that provider is very much aimed at TLS, not general purpose crypto operations.

@anderspitman
Copy link

anderspitman commented Dec 24, 2024

Just want to provide another use case. I'm working on an authentication library that can be used with multiple languages (currently JS, Go, and Rust). Rather than rewrite things like webauthn support for every language, I'm writing the bulk of the code in Rust, compiling to wasm32, and using Extism to run in each host language.

So far I've been able to use openidconnect-rs to add OIDC support and ATrium to add ATProto/Bluesky login, but I haven't found a webauthn library yet. I see webauthn_rp which does compile for wasm32, but I don't see any examples and I'm not sure if it's fully functional or not.

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

4 participants