feat: add auth service

sneaked in to help with server development
This commit is contained in:
əlemi 2024-02-01 17:54:36 +01:00
parent 164e9887b8
commit 1ee185b5ec
3 changed files with 26 additions and 5 deletions

View file

@ -1,7 +1,7 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure()
// .build_client(cfg!(feature = "client"))
//.build_server(cfg!(feature = "server")) // FIXME if false, build fails????
// .build_server(cfg!(feature = "server")) // FIXME if false, build fails????
// .build_transport(cfg!(feature = "transport"))
.compile(
&[
@ -11,9 +11,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"proto/workspace.proto",
"proto/buffer_service.proto",
"proto/cursor_service.proto",
"proto/workspace_service.proto"
"proto/workspace_service.proto",
"proto/auth_service.proto",
],
&["proto"]
&["proto"],
)?;
Ok(())
}
}

19
proto/auth_service.proto Normal file
View file

@ -0,0 +1,19 @@
syntax = "proto2";
package auth_service;
// authenticates users, issuing tokens
service Auth {
// send credentials and join a workspace
rpc Login (WorkspaceJoinRequest) returns (Token);
}
message Token {
required string token = 1;
}
message WorkspaceJoinRequest {
required string workspace_id = 1;
required string username = 2;
required string password = 3;
}

View file

@ -173,7 +173,8 @@ pub mod proto {
pub mod buffer_service { tonic::include_proto!("buffer_service"); }
pub mod cursor_service { tonic::include_proto!("cursor_service"); }
pub mod workspace_service { tonic::include_proto!("workspace_service"); }
pub mod auth_service { tonic::include_proto!("auth_service"); }
}
pub use errors::Error;
pub use errors::Result;
pub use errors::Result;