Fix sig
This commit is contained in:
@@ -101,10 +101,9 @@ impl UserConnections {
|
|||||||
&mut socket,
|
&mut socket,
|
||||||
&ClientMethod::Initialized {
|
&ClientMethod::Initialized {
|
||||||
public_key: crate::signature::to_string(&server.key.verifying_key()),
|
public_key: crate::signature::to_string(&server.key.verifying_key()),
|
||||||
signature: server
|
signature: crate::signature::to_string_sig(&server.key.sign(
|
||||||
.key
|
format!("{server_timestamp}@{hostname}@{public_key_string}").as_bytes(),
|
||||||
.sign(format!("{timestamp}@{hostname}@{public_key_string}").as_bytes())
|
)),
|
||||||
.to_string(),
|
|
||||||
|
|
||||||
timestamp: server_timestamp,
|
timestamp: server_timestamp,
|
||||||
hostname,
|
hostname,
|
||||||
|
|||||||
@@ -41,3 +41,7 @@ pub fn from_string_sig(signature: &str) -> anyhow::Result<Signature> {
|
|||||||
.map_err(|_| anyhow::anyhow!("Invalid public key"))?,
|
.map_err(|_| anyhow::anyhow!("Invalid public key"))?,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn to_string_sig(signature: &Signature) -> String {
|
||||||
|
bs58::encode(signature.to_bytes()).into_string()
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user