feat(auth): add authentication protocol definitions and build configuration

- Add TokenClaims message for JWT payload structure with user id, issuer, timestamps, and scopes
- Implement IssueTokenRequest/Response for creating access and refresh tokens with TTL support
- Create RefreshTokenRequest/Response for token rotation functionality
- Define RevokeTokenRequest/Response with support for single token or user-wide revocation
- Add VerifyTokenRequest/Response for validating JWT tokens with detailed claims information
- Implement signing key distribution system with GetSigningKeysRequest/Response
- Create TokenService gRPC service with IssueToken, RefreshToken, RevokeToken, VerifyToken, and GetSigningKeys methods
- Add build.rs configuration to compile proto files using tonic_prost_build
- Include channel, channel_settings, member, and permission protocol definitions for IM services
- Generate Rust code bindings through pb/core.rs and pb/im.rs modules
This commit is contained in:
zhenyi
2026-06-10 23:45:40 +08:00
commit 06e8ee96a5
43 changed files with 9671 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
use std::sync::Arc;
use imks::engine::server::EngineConfig;
use imks::socket::server::SocketServer;
fn main() {
tracing_subscriber::fmt()
.with_env_filter(
tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("info")),
)
.init();
let config = EngineConfig::default();
let socket_server = Arc::new(SocketServer::new(config));
let addr = "0.0.0.0:3000";
tracing::info!("Starting Socket.IO server on {}", addr);
tokio::runtime::Runtime::new()
.expect("Failed to create Tokio runtime")
.block_on(async {
let namespace = socket_server.of("/");
namespace
.on_connect(|socket, _auth| {
tracing::info!(
"Socket {} connected (engine: {})",
socket.sid,
socket.engine_sid
);
Ok(())
})
.await;
socket_server.run_http(addr).await.expect("Server error");
});
}