Make sure to validate that we have the key for the given address

This commit is contained in:
Thomas Eizinger 2021-06-25 13:26:56 +10:00
parent 6b72108681
commit 0a69eb5866
No known key found for this signature in database
GPG key ID: 651AC83A6C6C8B96

View file

@ -78,6 +78,10 @@ impl Transport for TorConfig {
let onion_bytes = key.public().get_onion_address().get_raw_bytes();
let onion_port = onion.port();
if onion.hash() != &onion_bytes {
return Err(TransportError::MultiaddrNotSupported(addr));
}
let localhost_tcp_random_port_addr = format!("/ip4/127.0.0.1/tcp/{}", onion_port).as_str()
.parse()
.expect("always a valid multiaddr");