Netidee Blog Bild
Getting ready for a Beta release
A brief walkthrough of our progress and challenges (30.05.2023)
Förderjahr / Projekt Call #17 / ProjektID: 6374 / Projekt: Opaque

We are quite excited since we are not far away from a beta release! But let's talk about a release next time and instead review our work, that was required to get there.

We started out with setting up the repository with wasm-pack to compile Rust code to Web Assembly and access it via a JavaScript API. This quickly resulted in promising results and early on we could focus on setting up a test-suite.

Sensible Defaults

Initially we aimed for a very simple API. Ideally exactly one set of registration parameters and one set of login parameters. After a closer look and some help from the opaque-ke creators we settled on having optional `identifiers` like the opaque-ke library. This allows us to enable advanced usage, but still keep the API surface area small. An acceptable compromise.

Testing

We wanted to ensure it works end to end and therefore created a full example involving a client and server part. We set up Playwright for end-to-end testing and use it to spin up the example server and client to test the full flow.

That said with end-to-end testing we focus on one flow to register a user followed by two successful login attempts.

With that our job wasn't done though. While we try to keep parameters optional there are still a handful of them and that means things can go wrong. Useful error messages are critical in such cases.

That's why setup the unit-testing library Jest and made sure to test for all known error cases. You can find the full suite here: https://github.com/serenity-kit/opaque/blob/main/tests/opaque.test.js

Error handling

As already mentioned we care about good error messages. Especially with Web Assembly you can quickly run into cryptic error messages that hardly help to figure out what went wrong. We are doing a lot of validation on the inputs and handling errors where we can. And as already mentioned to avoid any regressions we even test for them.

Types

Using a type-system like TypeScript can even prevent some errors from happening. That's why we provide the correct TypeScript types out of the box. This did almost work using a library called tsify Unfortunately it causes our error messages to break. Glad we had tests 😅. So in the spirit of open source we proposed a change to the library and it got accepted. Yay!

Bundlers & Web Assembly

And once we thought we were ready we realized it's not that straightforward to include WebAssembly in a project nowadays. Webpack requires an experimental flag, Vite a plugin, Next even more setup and Metro doesn't support it at all.

We ran into these problems in the past and are currently exploring a library setup that wouldn't require any bundler configuration.

Beta

… and soon we will be ready for a Beta release 🙌

If you want to follow along feel free to check out https://github.com/Serenity-kit/opaque

Bonus: react-native-opaque

Since we initially made good progress on the core library, we even spent some time on the ReactNative integration. This required more attention from us than we initially hoped and expected. But hey, sometimes you win, sometimes you lose. Nevertheless we made good progress which leaves us more time for the details.

Tags:

Security TypeScript JavaScript
CAPTCHA
Diese Frage dient der Überprüfung, ob Sie ein menschlicher Besucher sind und um automatisierten SPAM zu verhindern.
    Datenschutzinformation
    Der datenschutzrechtliche Verantwortliche (Internet Privatstiftung Austria - Internet Foundation Austria, Österreich) würde gerne mit folgenden Diensten Ihre personenbezogenen Daten verarbeiten. Zur Personalisierung können Technologien wie Cookies, LocalStorage usw. verwendet werden. Dies ist für die Nutzung der Website nicht notwendig, ermöglicht aber eine noch engere Interaktion mit Ihnen. Falls gewünscht, treffen Sie bitte eine Auswahl: