core/: Introduce rsa feature flag to avoid ring dependency (#2860)

- Introduce `rsa` feature flag to `libp2p-core`.
- Expose `rsa` feature in `libp2p`.
- Add `rsa` feature to `libp2p` `default`.
This commit is contained in:
Alexander Shishenko
2022-09-07 09:16:22 +03:00
committed by GitHub
parent a40180c3d8
commit 8644c65a22
54 changed files with 145 additions and 58 deletions

View File

@ -613,6 +613,7 @@ mod tests {
struct TestKeypair(Keypair);
impl Arbitrary for TestKeypair {
#[cfg(feature = "rsa")]
fn arbitrary<G: Gen>(g: &mut G) -> Self {
let keypair = if g.gen() {
// Small enough to be inlined.
@ -624,6 +625,12 @@ mod tests {
};
TestKeypair(keypair)
}
#[cfg(not(feature = "rsa"))]
fn arbitrary<G: Gen>(_g: &mut G) -> Self {
// Small enough to be inlined.
TestKeypair(Keypair::generate_ed25519())
}
}
impl std::fmt::Debug for TestKeypair {