forked from ghe0/brain-mock
Integrating authendication
rename register_node to register_app_node
This commit is contained in:
parent
b22b08799b
commit
f1a527e22d
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -418,7 +418,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "detee-shared"
|
||||
version = "0.1.0"
|
||||
source = "git+ssh://git@gitea.detee.cloud/noormohammedb/detee-shared?branch=stable_01#fce57884937a4ec02acbf2f5b370ab879b1af657"
|
||||
source = "git+ssh://git@gitea.detee.cloud/noormohammedb/detee-shared?branch=stable_01#65bfa113a44251dd13e5d895014f4a773e367d2e"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"prost",
|
||||
|
14
src/grpc.rs
14
src/grpc.rs
@ -426,14 +426,14 @@ impl BrainAppCli for BrainAppCliMock {
|
||||
|
||||
#[tonic::async_trait]
|
||||
impl BrainAppDaemon for BrainAppDaemonMock {
|
||||
type RegisterNodeStream = Pin<Box<dyn Stream<Item = Result<AppContract, Status>> + Send>>;
|
||||
type RegisterAppNodeStream = Pin<Box<dyn Stream<Item = Result<AppContract, Status>> + Send>>;
|
||||
type BrainMessagesStream = Pin<Box<dyn Stream<Item = Result<BrainMessageApp, Status>> + Send>>;
|
||||
|
||||
async fn register_node(
|
||||
async fn register_app_node(
|
||||
&self,
|
||||
req: tonic::Request<RegisterAppNodeReq>,
|
||||
) -> Result<tonic::Response<Self::RegisterNodeStream>, Status> {
|
||||
let req_data = req.into_inner();
|
||||
) -> Result<tonic::Response<Self::RegisterAppNodeStream>, Status> {
|
||||
let req_data = check_sig_from_req(req)?;
|
||||
log::info!(
|
||||
"registering app node_key : {}, owner_key: {}",
|
||||
&req_data.node_pubkey,
|
||||
@ -569,6 +569,12 @@ impl PubkeyGetter for AirdropReq {
|
||||
}
|
||||
}
|
||||
|
||||
impl PubkeyGetter for RegisterAppNodeReq {
|
||||
fn get_pubkey(&self) -> Option<String> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn check_sig_from_req<T: std::fmt::Debug + PubkeyGetter>(req: Request<T>) -> Result<T, Status> {
|
||||
let time = match req.metadata().get("timestamp") {
|
||||
Some(t) => t.clone(),
|
||||
|
Loading…
Reference in New Issue
Block a user