mirror of
https://github.com/uqbar-dao/nectar.git
synced 2025-01-09 03:00:48 +03:00
register: add more things to signature
This commit is contained in:
parent
b961564c31
commit
072767c3d7
@ -329,7 +329,7 @@ async fn login_handler(
|
||||
password: "secret".to_string(),
|
||||
};
|
||||
|
||||
match keygen::decode_keyfile(&encoded_keyfile, &info.password) {
|
||||
match keygen::decode_keyfile(&encoded_keyfile, &info.password_hash) {
|
||||
Ok(keyfile) => {
|
||||
let token = match register::generate_jwt(&keyfile.jwt_secret_bytes, our.as_ref()) {
|
||||
Some(token) => token,
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"files": {
|
||||
"main.css": "/static/css/main.054f6f32.css",
|
||||
"main.js": "/static/js/main.75ba0410.js",
|
||||
"main.js": "/static/js/main.d89ab669.js",
|
||||
"static/media/unknown.png": "/static/media/unknown.880d04d4611a45ab1001.png",
|
||||
"static/media/background.jpg": "/static/media/background.01d2427cfc21fb685016.jpg",
|
||||
"static/media/kinode.svg": "/static/media/kinode.86d0c1a6a4a3ca3be41616b5989d6925.svg",
|
||||
@ -10,6 +10,6 @@
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/css/main.054f6f32.css",
|
||||
"static/js/main.75ba0410.js"
|
||||
"static/js/main.d89ab669.js"
|
||||
]
|
||||
}
|
@ -1 +1 @@
|
||||
<!doctype html><html lang="en"><head><title>Welcome - Kinode</title><meta charset="utf-8"/><meta http-equiv="pragma" content="no-cache"/><meta http-equiv="cache-control" content="no-cache"/><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet"><link rel="icon" href="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNzc5IiBoZWlnaHQ9IjUxNCIgdmlld0JveD0iMCAwID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IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1.00001,viewport-fit=cover"/><script defer="defer" src="/static/js/main.75ba0410.js"></script><link href="/static/css/main.054f6f32.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
<!doctype html><html lang="en"><head><title>Welcome - Kinode</title><meta charset="utf-8"/><meta http-equiv="pragma" content="no-cache"/><meta http-equiv="cache-control" content="no-cache"/><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet"><link rel="icon" href="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNzc5IiBoZWlnaHQ9IjUxNCIgdmlld0JveD0iMCAwIDc3OSA1MTQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8c3R5bGU+CiAgICAgICAgQG1lZGlhIChwcmVmZXJzLWNvbG9yLXNjaGVtZTogZGFyaykgewogICAgICAgICAgICBzdmcgeyBmaWxsOiB3aGl0ZTsgfQogICAgICAgIH0KICAgICAgICBAbWVkaWEgKHByZWZlcnMtY29sb3Itc2NoZW1lOiBsaWdodCkgewogICAgICAgICAgICBzdmcgeyBmaWxsOiBibGFjazsgfQogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8cGF0aCBkPSJNNzUzLjA5MiA1LjkxOTMyQzc1Ni41NTcgNS4wOTk3NiA3NTUuOTYyIC0wLjAwMDEyMjA3IDc1Mi40MDEgLTAuMDAwMTIyMDdINDI2LjAwMUM0MjQuNzU1IC0wLjAwMDEyMjA3IDQyMy42MzkgMC43NzAyNyA0MjMuMTk3IDEuOTM1MzVMMjM2Ljk2OCA0OTIuNkMyMzUuNzI5IDQ5NS44NjUgMjQwLjEyMyA0OTguMjU1IDI0Mi4xOTEgNDk1LjQ0MUw1NjkuMzU3IDUwLjExMzJDNTY5Ljc3OCA0OS41MzkyIDU3MC4zOTEgNDkuMTMzOSA1NzEuMDg0IDQ4Ljk3TDc1My4wOTIgNS45MTkzMloiLz4KICAgIDxwYXRoIGQ9Ik0xMS45NjY1IDQwLjIyODhDOS4xMDk0OSAzOC43NzcgMTAuMjEzNSAzNC40NTgzIDEzLjQxNjcgMzQuNTU1N0w0MDQuMjczIDQ2LjQzNjdDNDA2LjMzNCA0Ni40OTkzIDQwNy43MTkgNDguNTc0OSA0MDYuOTg2IDUwLjUwMjNMMzQ3LjQzOCAyMDYuOTgxQzM0Ni44MDQgMjA4LjY0NyAzNDQuODY1IDIwOS4zOTYgMzQzLjI3NSAyMDguNTg4TDExLjk2NjUgNDAuMjI4OFoiLz4KPC9zdmc+Cg=="><meta httpequiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1.00001,viewport-fit=cover"/><script defer="defer" src="/static/js/main.d89ab669.js"></script><link href="/static/css/main.054f6f32.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
File diff suppressed because one or more lines are too long
@ -333,8 +333,8 @@ async fn handle_keyfile_vet(
|
||||
false => base64::decode(payload.keyfile).map_err(|_| warp::reject())?,
|
||||
};
|
||||
|
||||
let decoded_keyfile =
|
||||
keygen::decode_keyfile(&encoded_keyfile, &payload.password).map_err(|_| warp::reject())?;
|
||||
let decoded_keyfile = keygen::decode_keyfile(&encoded_keyfile, &payload.password_hash)
|
||||
.map_err(|_| warp::reject())?;
|
||||
|
||||
Ok(warp::reply::json(&KeyfileVetted {
|
||||
username: decoded_keyfile.username,
|
||||
@ -439,8 +439,8 @@ async fn handle_boot(
|
||||
|
||||
// manual json creation to preserve order..
|
||||
let sig_data_json = format!(
|
||||
r#"{{"username":"{}","password":"{}","timestamp":{}}}"#,
|
||||
our.name, info.password, info.timestamp
|
||||
r#"{{"username":"{}","password_hash":"{}","timestamp":{},"direct":{},"reset":{}}}"#,
|
||||
our.name, info.password_hash, info.timestamp, info.direct, info.reset
|
||||
);
|
||||
let sig_data = sig_data_json.as_bytes();
|
||||
|
||||
@ -468,7 +468,7 @@ async fn handle_boot(
|
||||
};
|
||||
|
||||
let encoded_keyfile = keygen::encode_keyfile(
|
||||
info.password,
|
||||
info.password_hash,
|
||||
decoded_keyfile.username.clone(),
|
||||
decoded_keyfile.routers.clone(),
|
||||
&networking_keypair,
|
||||
@ -504,7 +504,8 @@ async fn handle_import_keyfile(
|
||||
.into_response());
|
||||
};
|
||||
|
||||
let (decoded_keyfile, our) = match keygen::decode_keyfile(&encoded_keyfile, &info.password) {
|
||||
let (decoded_keyfile, our) = match keygen::decode_keyfile(&encoded_keyfile, &info.password_hash)
|
||||
{
|
||||
Ok(k) => {
|
||||
let our = Identity {
|
||||
name: k.username.clone(),
|
||||
@ -524,7 +525,7 @@ async fn handle_import_keyfile(
|
||||
}
|
||||
Err(_) => {
|
||||
return Ok(warp::reply::with_status(
|
||||
warp::reply::json(&"Incorrect Password".to_string()),
|
||||
warp::reply::json(&"Incorrect password_hash".to_string()),
|
||||
StatusCode::UNAUTHORIZED,
|
||||
)
|
||||
.into_response())
|
||||
@ -565,7 +566,8 @@ async fn handle_login(
|
||||
.into_response());
|
||||
};
|
||||
|
||||
let (decoded_keyfile, our) = match keygen::decode_keyfile(&encoded_keyfile, &info.password) {
|
||||
let (decoded_keyfile, our) = match keygen::decode_keyfile(&encoded_keyfile, &info.password_hash)
|
||||
{
|
||||
Ok(k) => {
|
||||
let our = Identity {
|
||||
name: k.username.clone(),
|
||||
@ -585,7 +587,7 @@ async fn handle_login(
|
||||
}
|
||||
Err(_) => {
|
||||
return Ok(warp::reply::with_status(
|
||||
warp::reply::json(&"Incorrect Password"),
|
||||
warp::reply::json(&"Incorrect password_hash"),
|
||||
StatusCode::UNAUTHORIZED,
|
||||
)
|
||||
.into_response())
|
||||
@ -613,7 +615,7 @@ async fn confirm_change_network_keys(
|
||||
let mut our = our.as_ref().clone();
|
||||
|
||||
// Get our name from our current keyfile
|
||||
let old_decoded_keyfile = match keygen::decode_keyfile(&encoded_keyfile, &info.password) {
|
||||
let old_decoded_keyfile = match keygen::decode_keyfile(&encoded_keyfile, &info.password_hash) {
|
||||
Ok(k) => {
|
||||
our.name = k.username.clone();
|
||||
k
|
||||
@ -644,7 +646,7 @@ async fn confirm_change_network_keys(
|
||||
};
|
||||
|
||||
let encoded_keyfile = keygen::encode_keyfile(
|
||||
info.password,
|
||||
info.password_hash,
|
||||
decoded_keyfile.username.clone(),
|
||||
decoded_keyfile.routers.clone(),
|
||||
&networking_keypair,
|
||||
|
@ -768,7 +768,7 @@ pub struct Keyfile {
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct KeyfileVet {
|
||||
pub password: String,
|
||||
pub password_hash: String,
|
||||
pub keyfile: String,
|
||||
}
|
||||
|
||||
@ -781,7 +781,7 @@ pub struct KeyfileVetted {
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct BootInfo {
|
||||
pub password: String,
|
||||
pub password_hash: String,
|
||||
pub username: String,
|
||||
pub reset: bool,
|
||||
pub direct: bool,
|
||||
@ -792,18 +792,18 @@ pub struct BootInfo {
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ImportKeyfileInfo {
|
||||
pub password: String,
|
||||
pub password_hash: String,
|
||||
pub keyfile: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct LoginInfo {
|
||||
pub password: String,
|
||||
pub password_hash: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct LoginAndResetInfo {
|
||||
pub password: String,
|
||||
pub password_hash: String,
|
||||
pub direct: bool,
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user