feat: initial schema
This commit is contained in:
23
protobufs/arbiter.proto
Normal file
23
protobufs/arbiter.proto
Normal 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);
|
||||
}
|
||||
@@ -11,22 +11,17 @@ message AuthChallengeRequest {
|
||||
message AuthChallenge {
|
||||
bytes pubkey = 1;
|
||||
bytes nonce = 2;
|
||||
google.protobuf.Timestamp minted = 3;
|
||||
google.protobuf.Timestamp minted = 3 ;
|
||||
}
|
||||
|
||||
message AuthChallengeSolution {
|
||||
AuthChallenge challenge = 1;
|
||||
AuthChallenge challenge = 1 ;
|
||||
bytes signature = 2;
|
||||
}
|
||||
|
||||
message AuthResponse {
|
||||
string token = 1;
|
||||
string refresh_token = 2;
|
||||
google.protobuf.Timestamp expires_at = 3;
|
||||
google.protobuf.Timestamp refresh_expires_at = 4;
|
||||
}
|
||||
|
||||
service AuthService {
|
||||
rpc GetChallenge(AuthChallengeRequest) returns (AuthChallenge);
|
||||
rpc SubmitSolution(AuthChallengeSolution) returns (AuthResponse);
|
||||
}
|
||||
google.protobuf.Timestamp expires_at = 3 ;
|
||||
google.protobuf.Timestamp refresh_expires_at = 4 ;
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package arbiter.evm;
|
||||
14
server/Cargo.lock
generated
14
server/Cargo.lock
generated
@@ -40,9 +40,12 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"prost",
|
||||
"prost-build",
|
||||
"prost-derive",
|
||||
"prost-types",
|
||||
"serde_json",
|
||||
"tonic",
|
||||
"tonic-prost",
|
||||
"tonic-prost-build",
|
||||
]
|
||||
|
||||
@@ -1389,6 +1392,17 @@ dependencies = [
|
||||
"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]]
|
||||
name = "tonic-prost-build"
|
||||
version = "0.14.3"
|
||||
|
||||
@@ -11,7 +11,8 @@ prost = "0.14.3"
|
||||
tonic = "0.14.3"
|
||||
tracing = "0.1.44"
|
||||
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"] }
|
||||
rand = "0.10.0"
|
||||
uuid = "1.20.0"
|
||||
|
||||
@@ -9,6 +9,9 @@ prost.workspace = true
|
||||
bytes = "1.11.1"
|
||||
prost-derive = "0.14.3"
|
||||
prost-types = { version = "0.14.3", features = ["chrono"] }
|
||||
tonic-prost = "0.14.3"
|
||||
|
||||
[build-dependencies]
|
||||
prost-build = "0.14.3"
|
||||
serde_json = "1"
|
||||
tonic-prost-build = "0.14.3"
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
use tonic_prost_build::configure;
|
||||
|
||||
static PROTOBUF_DIR: &str = "../../../protobufs";
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
configure()
|
||||
.proto_path("../../../protobufs")
|
||||
.compile_protos(&["../../../protobufs/auth.proto"], &["../../../protobufs"])
|
||||
.compile_protos(
|
||||
&[
|
||||
format!("{}/arbiter.proto", PROTOBUF_DIR),
|
||||
format!("{}/auth.proto", PROTOBUF_DIR),
|
||||
],
|
||||
&[PROTOBUF_DIR.to_string()],
|
||||
)
|
||||
.unwrap();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
pub fn add(left: u64, right: u64) -> u64 {
|
||||
left + right
|
||||
}
|
||||
pub mod proto {
|
||||
tonic::include_proto!("arbiter");
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = add(2, 2);
|
||||
assert_eq!(result, 4);
|
||||
pub mod auth {
|
||||
tonic::include_proto!("arbiter.auth");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user