Update dependencies of the examples#3931
Open
joeydewaal wants to merge 12 commits into
Open
Conversation
Collaborator
|
Does this not update the Cargo.lock? |
Contributor
Author
|
Forgot to |
abonander
requested changes
Jul 17, 2025
| 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); |
Collaborator
There was a problem hiding this comment.
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");
Contributor
Author
There was a problem hiding this comment.
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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