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

@ -67,6 +67,7 @@ pub struct SigningError {
/// An error during encoding of key material.
impl SigningError {
#[cfg(any(feature = "secp256k1", feature = "rsa"))]
pub(crate) fn new<S: ToString>(msg: S) -> Self {
Self {
msg: msg.to_string(),
@ -74,6 +75,7 @@ impl SigningError {
}
}
#[cfg(feature = "rsa")]
pub(crate) fn source(self, source: impl Error + Send + Sync + 'static) -> Self {
Self {
source: Some(Box::new(source)),