wage icon indicating copy to clipboard operation
wage copied to clipboard

Update rage dependency

Open besendorf opened this issue 1 year ago • 0 comments

Hey,

I wanted to use this library but noticed that the rage dependency was not updated since 0.9.0. As some security issues have been fixed since then I would appreciate if you could update the wasm library to the latest rage version. I tried myself and received the following errors during build. Build with 0.9.0 worked fine.

wasm-pack build
[INFO]: 🎯  Checking for the Wasm target...
[INFO]: 🌀  Compiling to Wasm...
   Compiling wage v0.0.0 (/home/user/programms/wage)
error[E0432]: unresolved import `age::secrecy::SecretVec`
 --> src/shim.rs:1:34
  |
1 | use age::secrecy::{ExposeSecret, SecretVec};
  |                                  ^^^^^^^^^
  |                                  |
  |                                  no `SecretVec` in the root
  |                                  help: a similar name exists in the module: `SecretBox`

error[E0599]: no associated item named `Recipients` found for struct `age::Decryptor` in the current scope
   --> src/lib.rs:272:29
    |
272 |             age::Decryptor::Recipients(d) => d,
    |                             ^^^^^^^^^^ associated item not found in `Decryptor<_>`

error[E0599]: no associated item named `Passphrase` found for struct `age::Decryptor` in the current scope
   --> src/lib.rs:273:29
    |
273 |             age::Decryptor::Passphrase(_) => panic!("Shouldn't be called"),
    |                             ^^^^^^^^^^ associated item not found in `Decryptor<_>`

error[E0599]: no associated item named `Recipients` found for struct `age::Decryptor` in the current scope
   --> src/lib.rs:291:29
    |
291 |             age::Decryptor::Recipients(_) => panic!("Shouldn't be called"),
    |                             ^^^^^^^^^^ associated item not found in `Decryptor<_>`

error[E0599]: no associated item named `Passphrase` found for struct `age::Decryptor` in the current scope
   --> src/lib.rs:292:29
    |
292 |             age::Decryptor::Passphrase(d) => d,
    |                             ^^^^^^^^^^ associated item not found in `Decryptor<_>`

error[E0308]: mismatched types
   --> src/lib.rs:296:47
    |
296 |             .decrypt_async(&SecretString::new(passphrase), None)
    |                             ----------------- ^^^^^^^^^^ expected `Box<str>`, found `String`
    |                             |
    |                             arguments to this function are incorrect
    |
    = note: expected struct `Box<str>`
               found struct `String`
note: associated function defined here
   --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secrecy-0.10.3/src/lib.rs:84:12
    |
84  |     pub fn new(boxed_secret: Box<S>) -> Self {
    |            ^^^
help: call `Into::into` on this expression to convert `String` into `Box<str>`
    |
296 |             .decrypt_async(&SecretString::new(passphrase.into()), None)
    |                                                         +++++++

warning: use of deprecated method `web_sys::BlobPropertyBag::type_`: Use `set_type()` instead.
  --> src/lib.rs:55:37
   |
55 |             &BlobPropertyBag::new().type_("text/plain;charset=utf-8"),
   |                                     ^^^^^
   |
   = note: `#[warn(deprecated)]` on by default

error[E0308]: mismatched types
   --> src/lib.rs:162:9
    |
149 |       pub fn into_encryptor(self) -> Option<Encryptor> {
    |                                      ----------------- expected `Option<Encryptor>` because of return type
...
162 | /         age::Encryptor::with_recipients(
163 | |             recipients
164 | |                 .into_iter()
165 | |                 .map(|k| match k {
...   |
169 | |         )
170 | |         .map(Encryptor)
    | |_______________________^ expected `Option<Encryptor>`, found `Result<Encryptor, EncryptError>`
    |
    = note: expected enum `Option<Encryptor>`
               found enum `Result<Encryptor, EncryptError>`

error[E0308]: mismatched types
   --> src/lib.rs:191:13
    |
190 |         Encryptor(age::Encryptor::with_user_passphrase(SecretString::new(
    |                                                        ----------------- arguments to this function are incorrect
191 |             passphrase,
    |             ^^^^^^^^^^ expected `Box<str>`, found `String`
    |
    = note: expected struct `Box<str>`
               found struct `String`
note: associated function defined here
   --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/secrecy-0.10.3/src/lib.rs:84:12
    |
84  |     pub fn new(boxed_secret: Box<S>) -> Self {
    |            ^^^
help: call `Into::into` on this expression to convert `String` into `Box<str>`
    |
191 |             passphrase.into(),
    |                       +++++++

error[E0599]: no associated item named `Recipients` found for struct `age::Decryptor` in the current scope
   --> src/lib.rs:259:29
    |
259 |             age::Decryptor::Recipients(_) => DecryptorType::Recipients,
    |                             ^^^^^^^^^^ associated item not found in `Decryptor<_>`

error[E0599]: no associated item named `Passphrase` found for struct `age::Decryptor` in the current scope
   --> src/lib.rs:260:29
    |
260 |             age::Decryptor::Passphrase(_) => DecryptorType::Passphrase,
    |                             ^^^^^^^^^^ associated item not found in `Decryptor<_>`

Some errors have detailed explanations: E0308, E0432, E0599.
For more information about an error, try `rustc --explain E0308`.
warning: `wage` (lib) generated 1 warning
error: could not compile `wage` (lib) due to 10 previous errors; 1 warning emitted
Error: Compiling your crate to WebAssembly failed
Caused by: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit status: 101
  full command: cd "/home/user/programms/wage" && "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"

besendorf avatar Feb 16 '25 10:02 besendorf