Skip to content
Permalink
Browse files

Correctly handle unknown identity schemes

  • Loading branch information
AgeManning committed Nov 5, 2019
1 parent 5524325 commit 9c3c996a93e2779e2f347272aee9910278714f7e
Showing with 11 additions and 8 deletions.
  1. +5 −5 misc/enr/Cargo.toml
  2. +6 −3 misc/enr/src/lib.rs
@@ -6,12 +6,12 @@ edition = "2018"

[dependencies]
libp2p-core = { version = "0.12.0", path = "../../core" }
rlp = "0.3.0"
log = "0.4"
libsecp256k1 = "0.2.2"
rlp = "0.4.3"
log = "0.4.8"
libsecp256k1 = "0.3.1"
sha3 = "0.8.2"
bs58 = "0.2.2"
bs58 = "0.3.0"
base64 = "0.10.1"
rand = "0.6.5"
rand = "0.7.2"
serde = { version = "1.0.93", optional = true }
hex = "0.4.0"
@@ -272,7 +272,8 @@ impl Enr {
Some(ref id) if id == "v4" => {
enr_pubkey.verify_v4(&self.rlp_content(), &self.signature)
}
_ => unimplemented!(),
// unsupported identity schemes
_ => false,
}
}

@@ -445,7 +446,8 @@ impl Enr {
Some(ref id) if id == "v4" => enr_keypair
.sign_v4(&self.rlp_content())
.map_err(|_| EnrError::SigningError)?,
_ => unimplemented!(),
// other identity schemes are unsupported
_ => return Err(EnrError::SigningError),
}
};
Ok(())
@@ -621,7 +623,8 @@ impl EnrBuilder {
"v4" => enr_keypair
.sign_v4(&self.rlp_content())
.map_err(|_| EnrError::SigningError),
_ => unimplemented!(),
// unsupported identity schemes
_ => Err(EnrError::SigningError),
}
}

0 comments on commit 9c3c996

Please sign in to comment.
You can’t perform that action at this time.