registration put

This commit is contained in:
2026-01-02 22:27:26 +01:00
parent 1d72d7500a
commit 1914c68c9f
3 changed files with 181 additions and 94 deletions

View File

@@ -1,4 +1,5 @@
use bytes::Bytes;
use getrandom::Error;
use crate::cryptographic_signature::{CryptographicSignature, formatPubKey, sign_message};
use crate::message_handling::EventType;
@@ -23,15 +24,7 @@ pub async fn register_with_the_server(
let pubkey_bytes = encoded_point.as_ref().to_vec();
let pubkey_bytes_minus = pubkey_bytes[1..].to_vec();
let res = client.put(uri).body(pubkey_bytes_minus).send().await?;
if res.status().is_success() {
let str = hex::encode(res.bytes().await?);
println!("Successfully registered with the server : {}", str);
} else {
eprintln!(
"Failed to register with the server. Status: {}",
res.status()
);
}
let res = res.error_for_status()?;
println!("register ip adresses");
Ok(())
}