feat: initial schema

This commit is contained in:
hdbg
2026-02-10 14:03:01 +01:00
parent 7816518977
commit 5b27c78bfc
8 changed files with 60 additions and 26 deletions

23
protobufs/arbiter.proto Normal file
View File

@@ -0,0 +1,23 @@
syntax = "proto3";
package arbiter;
import "auth.proto";
message ClientMessage {
oneof payload {
arbiter.auth.AuthChallengeRequest auth_challenge_request = 1;
arbiter.auth.AuthChallengeSolution auth_challenge_solution = 2;
}
}
message ServerMessage {
oneof payload {
arbiter.auth.AuthChallenge auth_challenge = 1;
arbiter.auth.AuthResponse auth_response = 2;
}
}
service Server {
rpc Communicate(stream ClientMessage) returns (stream ServerMessage);
}

View File

@@ -25,8 +25,3 @@ message AuthResponse {
google.protobuf.Timestamp expires_at = 3 ; google.protobuf.Timestamp expires_at = 3 ;
google.protobuf.Timestamp refresh_expires_at = 4 ; google.protobuf.Timestamp refresh_expires_at = 4 ;
} }
service AuthService {
rpc GetChallenge(AuthChallengeRequest) returns (AuthChallenge);
rpc SubmitSolution(AuthChallengeSolution) returns (AuthResponse);
}

View File

@@ -1,2 +0,0 @@
syntax = "proto3";
package arbiter.evm;

14
server/Cargo.lock generated
View File

@@ -40,9 +40,12 @@ version = "0.1.0"
dependencies = [ dependencies = [
"bytes", "bytes",
"prost", "prost",
"prost-build",
"prost-derive", "prost-derive",
"prost-types", "prost-types",
"serde_json",
"tonic", "tonic",
"tonic-prost",
"tonic-prost-build", "tonic-prost-build",
] ]
@@ -1389,6 +1392,17 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "tonic-prost"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6c55a2d6a14174563de34409c9f92ff981d006f56da9c6ecd40d9d4a31500b0"
dependencies = [
"bytes",
"prost",
"tonic",
]
[[package]] [[package]]
name = "tonic-prost-build" name = "tonic-prost-build"
version = "0.14.3" version = "0.14.3"

View File

@@ -11,7 +11,8 @@ prost = "0.14.3"
tonic = "0.14.3" tonic = "0.14.3"
tracing = "0.1.44" tracing = "0.1.44"
tokio = { version = "1.49.0", features = ["full"] } tokio = { version = "1.49.0", features = ["full"] }
ed25519 = "3.0.0-rc.4"
ed25519-dalek = "3.0.0-pre.6"
chrono = { version = "0.4.43", features = ["serde"] } chrono = { version = "0.4.43", features = ["serde"] }
rand = "0.10.0" rand = "0.10.0"
uuid = "1.20.0" uuid = "1.20.0"

View File

@@ -9,6 +9,9 @@ prost.workspace = true
bytes = "1.11.1" bytes = "1.11.1"
prost-derive = "0.14.3" prost-derive = "0.14.3"
prost-types = { version = "0.14.3", features = ["chrono"] } prost-types = { version = "0.14.3", features = ["chrono"] }
tonic-prost = "0.14.3"
[build-dependencies] [build-dependencies]
prost-build = "0.14.3"
serde_json = "1"
tonic-prost-build = "0.14.3" tonic-prost-build = "0.14.3"

View File

@@ -1,9 +1,16 @@
use tonic_prost_build::configure; use tonic_prost_build::configure;
static PROTOBUF_DIR: &str = "../../../protobufs";
fn main() -> Result<(), Box<dyn std::error::Error>> { fn main() -> Result<(), Box<dyn std::error::Error>> {
configure() configure()
.proto_path("../../../protobufs") .compile_protos(
.compile_protos(&["../../../protobufs/auth.proto"], &["../../../protobufs"]) &[
format!("{}/arbiter.proto", PROTOBUF_DIR),
format!("{}/auth.proto", PROTOBUF_DIR),
],
&[PROTOBUF_DIR.to_string()],
)
.unwrap(); .unwrap();
Ok(()) Ok(())
} }

View File

@@ -1,14 +1,7 @@
pub fn add(left: u64, right: u64) -> u64 { pub mod proto {
left + right tonic::include_proto!("arbiter");
}
#[cfg(test)] pub mod auth {
mod tests { tonic::include_proto!("arbiter.auth");
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
} }
} }