fix signing and validation
add timestamp to signed node info
This commit is contained in:
@@ -5,7 +5,7 @@ pub fn encode_signature(
|
||||
sig: &DHTSignature,
|
||||
builder: &mut veilid_capnp::ed25519_signature::Builder,
|
||||
) {
|
||||
if sig.valid {
|
||||
if !sig.valid {
|
||||
panic!("don't encode invalid signatures");
|
||||
}
|
||||
|
||||
|
@@ -12,6 +12,8 @@ pub fn encode_signed_node_info(
|
||||
let mut sig_builder = builder.reborrow().init_signature();
|
||||
encode_signature(&signed_node_info.signature, &mut sig_builder);
|
||||
|
||||
builder.reborrow().set_timestamp(signed_node_info.timestamp);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -32,5 +34,8 @@ pub fn decode_signed_node_info(
|
||||
.map_err(map_error_capnp_error!())?;
|
||||
let signature = decode_signature(&sig_reader);
|
||||
|
||||
SignedNodeInfo::new(node_info, NodeId::new(*node_id), signature).map_err(map_error_string!())
|
||||
let timestamp = reader.reborrow().get_timestamp();
|
||||
|
||||
SignedNodeInfo::new(node_info, NodeId::new(*node_id), signature, timestamp)
|
||||
.map_err(map_error_string!())
|
||||
}
|
||||
|
Reference in New Issue
Block a user