-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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?
Changes from 7 commits
5b7d118
bb61d8d
0ba5b66
181f65e
544e177
08af881
050b3a7
39e7ca7
49cedf8
8769b58
e5d8b2a
f56d380
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
use anyhow::{anyhow, Context}; | ||
use argon2::password_hash::rand_core::OsRng; | ||
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); | ||
|
||
Ok(Argon2::default() | ||
.hash_password(password.as_bytes(), &salt) | ||
.map_err(|e| anyhow!(e).context("failed to hash password"))? | ||
|
Uh oh!
There was an error while loading. Please reload this page.