MCPcopy Create free account
hub / github.com/Rust-Web-Development/code / register

Function register

ch_09/src/routes/authentication.rs:19–37  ·  view source on GitHub ↗
(
    store: Store,
    account: Account,
)

Source from the content-addressed store, hash-verified

17const PASETO_KEY: &[u8; 32] = b"RANDOM WORDS WINTER MACINTOSH PC";
18
19pub async fn register(
20 store: Store,
21 account: Account,
22) -> Result<impl warp::Reply, warp::Rejection> {
23 let hashed_password = hash_password(account.password.as_bytes());
24
25 let account = Account {
26 id: account.id,
27 email: account.email,
28 password: hashed_password,
29 };
30
31 match store.add_account(account).await {
32 Ok(_) => {
33 Ok(warp::reply::with_status("Account added", StatusCode::OK))
34 }
35 Err(e) => Err(warp::reject::custom(e)),
36 }
37}
38
39pub async fn login(
40 store: Store,

Callers

nothing calls this directly

Calls 2

hash_passwordFunction · 0.70
add_accountMethod · 0.45

Tested by

no test coverage detected