wip messages handling
This commit is contained in:
@@ -45,7 +45,7 @@ pub fn formatPubKey(crypto_pair: CryptographicSignature) -> String {
|
||||
///
|
||||
/// takes a serialized message and adds the signature using the private key
|
||||
///
|
||||
pub fn sign_message(crypto_pair: CryptographicSignature, message: Vec<u8>) -> Vec<u8> {
|
||||
pub fn sign_message(crypto_pair: &CryptographicSignature, message: &Vec<u8>) -> Vec<u8> {
|
||||
let length_bytes: [u8; 2] = message[5..7]
|
||||
.try_into()
|
||||
.expect("slice with incorrect length");
|
||||
@@ -105,7 +105,7 @@ mod tests {
|
||||
let crypto_pair = CryptographicSignature::new(username.clone());
|
||||
let handshake = HandshakeMessage::hello(0, 12, username);
|
||||
let ser = handshake.serialize();
|
||||
let signed_message = sign_message(crypto_pair, ser.clone());
|
||||
let signed_message = sign_message(&crypto_pair, &ser);
|
||||
println!("unsigned_message: {:?}", ser);
|
||||
println!("signed_message: {:?}", signed_message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user