str4d / wage

A WASM package and web app for encrypting and decrypting age-encrypted files, powered by rage.
https://rage-encry.pt
Apache License 2.0
74 stars 14 forks source link

Newtypes for decryptor and streams #3

Closed str4d closed 4 years ago

str4d commented 4 years ago

In the stream today, I ran into the issue that types with lifetimes cannot be returned from Rust to JavaScript, so instead we boxed the values and returned the pointers as u32s (eww).

It literally just occurred to me that, once we have the pointer as an integer, we can just wrap that in a newtype and then #[wasm_bindgen] to have a JavaScript typed object 🤩