SDK-client-UA-registration #34

Merged
Skipper merged 21 commits from SDK-client-UA-registration into main 2026-03-22 11:11:11 +00:00
Showing only changes of commit 66026e903a - Show all commits

View File

@@ -1,5 +1,26 @@
mod errors;
mod db;
mod auth;
mod db;
mod errors;
fn main() {}
use errors::ProtoError;
fn run(id: u32, sig: &str) {
print!("authenticate(id={id}, sig={sig:?}) => ");
match auth::authenticate(id, sig) {
Ok(nonce) => println!("Ok(nonce={nonce})"),
Err(e) => match e.narrow::<errors::NotRegistered, _>() {
Ok(_) => println!("Err(NotRegistered) — handled locally"),
Err(remaining) => {
let proto = ProtoError::from(remaining);
println!("Err(ProtoError::{proto:?}) — forwarded to wire");
}
},
}
}
fn main() {
run(0, "ok"); // NotRegistered
run(1, "bad"); // InvalidSignature
run(99, "ok"); // Internal
run(1, "ok"); // success
}