-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Update dependencies of the examples #3931
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
base: main
Are you sure you want to change the base?
Conversation
Does this not update the Cargo.lock? |
Forgot to |
use tokio::task; | ||
|
||
use argon2::password_hash::SaltString; | ||
use argon2::{password_hash, Argon2, PasswordHash, PasswordHasher, PasswordVerifier}; | ||
|
||
pub async fn hash(password: String) -> anyhow::Result<String> { | ||
task::spawn_blocking(move || { | ||
let salt = SaltString::generate(rand::thread_rng()); | ||
let salt = SaltString::generate(&mut OsRng); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
argon2
and password-hash
have release-candidate versions out that are compatible with rand-core 0.9
.
I don't know exactly when they plan on publishing full releases, but it might be better to wait for that.
Alternatively, instead of hacking around the incompatibility by using the old version of rand
, this could show how to generate a SaltString
from any version of rand
:
// `SaltString::generate()` is only compatible with `rand 0.6`, which is very out-of-date now.
// This shows how to generate a salt using nearly any `rand` version.
let salt: [u8; Salt::RECOMMENDED_LENGTH] = rand::random();
let salt = SaltString::encode_b64(&salt)
.expect("should not fail; we generated a salt of recommended length");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That snippet is indeed more convenient. I added that but it's 3 examples that have this problem so it might be better to wait this out, not sure.
This pr updates the dependencies of the examples.
Does your PR solve an issue?
fixes #3772
Is this a breaking change?
no, only the examples are updated