Merge branch 'jf/invite' of github.com:uqbar-dao/uqbar into jf/invite

This commit is contained in:
realisation 2023-10-24 15:07:31 -04:00
commit 529234f1bd
2 changed files with 11 additions and 7 deletions

View File

@ -1,6 +1,6 @@
use anyhow::Result; use anyhow::Result;
use dotenv; use dotenv;
use ethers::prelude::{namehash}; use ethers::prelude::namehash;
use std::env; use std::env;
use std::sync::Arc; use std::sync::Arc;
use tokio::sync::{mpsc, oneshot}; use tokio::sync::{mpsc, oneshot};

View File

@ -140,8 +140,10 @@ async fn handle_keyfile_vet(
let keyfile_vetted = KeyfileVetted { let keyfile_vetted = KeyfileVetted {
username: decoded_keyfile.username, username: decoded_keyfile.username,
networking_key: format!("0x{}", hex::encode networking_key: format!(
(decoded_keyfile.networking_keypair.public_key().as_ref())), "0x{}",
hex::encode(decoded_keyfile.networking_keypair.public_key().as_ref())
),
routers: decoded_keyfile.routers, routers: decoded_keyfile.routers,
}; };
@ -180,16 +182,18 @@ async fn handle_boot(
Keyfile { Keyfile {
username: our.name.clone(), username: our.name.clone(),
routers: our.allowed_routers.clone(), routers: our.allowed_routers.clone(),
networking_keypair: signature::Ed25519KeyPair networking_keypair: signature::Ed25519KeyPair::from_pkcs8(networking_keypair.as_ref())
::from_pkcs8(networking_keypair.as_ref()).unwrap(), .unwrap(),
jwt_secret_bytes: jwt_secret.to_vec(), jwt_secret_bytes: jwt_secret.to_vec(),
file_key: keygen::generate_file_key(), file_key: keygen::generate_file_key(),
} }
} else { } else {
match keygen::decode_keyfile(encoded_keyfile.clone(), &info.password) { match keygen::decode_keyfile(encoded_keyfile.clone(), &info.password) {
Ok(k) => { Ok(k) => {
our.networking_key = format!("0x{}", hex::encode our.networking_key = format!(
(k.networking_keypair.public_key().as_ref())); "0x{}",
hex::encode(k.networking_keypair.public_key().as_ref())
);
k k
} }
Err(_) => return Err(warp::reject()), Err(_) => return Err(warp::reject()),