Commit Graph

51 Commits

Author SHA1 Message Date
0e9d339bd2 ci: use workspace inheritance to enforce lints in all crates
Starting with nightly-2023-09-10, the `[lints]` section in `Cargo.toml` files is stable. Together with workspace inheritance, this can be used to declare all lints we want to enforce in a single place.

Resolves: #4484.

Pull-Request: #4575.
2023-10-09 02:20:46 +00:00
77149f08c4 fix(identity): correctly follow extract-expand for HKDF
As @mxinden pointed out in https://github.com/libp2p/rust-libp2p/pull/4554#discussion_r1344747938, we were not correctly following the HKDF steps of extract and expand.

Pull-Request: #4589.
2023-10-09 01:31:10 +00:00
60650d8b90 chore(identity): release version 0.2.4
`libp2p-identity` gets a special treatment in our workspace because it is the only crate that is a dependency of crates _outside_ the workspace, in particular `multiaddr`. We however also depend on `multiaddr` again in the workspace. As a result, we need to use `[patch.crates-io]` to replace the `libp2p-identity` version across the entire dependency tree. This however doesn't work well with `cargo semver-checks` as it doesn't copy over `[patch]` sections into its workspace where it does the docs building.

To fix the semver checks error, we need to release a new version of `libp2p-identity`.

Pull-Request: #4583.
2023-10-03 00:04:57 +00:00
ef1cd354d8 fix(identity): address clippy lint
Pull-Request: #4582.
2023-10-02 22:59:39 +00:00
90a9752dc7 deps: bump sha2 from 0.10.7 to 0.10.8
Pull-Request: #4579.
2023-10-02 09:03:11 +00:00
7f92cb0725 feat(quic): support stateless resets
Resolves #3419.

Pull-Request: #4554.
2023-10-02 00:28:32 +00:00
0df1a96e3c deps: bump base64 from 0.21.3 to 0.21.4
Pull-Request: #4479.
2023-09-11 23:32:09 +00:00
ac57f8df7e deps: bump multihash from 0.19.0 to 0.19.1
Pull-Request: #4474.
2023-09-11 08:59:07 +00:00
c1bccd5c1c deps: bump base64 from 0.21.2 to 0.21.3
Pull-Request: #4401.
2023-09-04 09:43:13 +00:00
c6984dd51d ci: do not tolerate rustc warnings in any job
Previously, only the clippy job was denying warnings. We have many other CI jobs that compile our library in all sorts of configurations. All of them should be free of warnings.

Pull-Request: #4384.
2023-08-25 10:14:01 +00:00
3bce9ebddf refactor(identity): fix clippy beta lint
From the lint documentation:

> If both `PartialOrd` and `Ord` are implemented, they must agree. This is commonly done by wrapping the result of `cmp` in `Some` for `partial_cmp`. Not doing this may silently introduce an error upon refactoring.

Pull-Request: #4379.
2023-08-24 06:01:19 +00:00
fb61697390 deps(identity): update ed25519-dalek to 2.0
Pull-Request: #4337.
2023-08-18 10:03:22 +02:00
ceccb8e9c0 chore: fix clippy
Pull-Request: #4267.
2023-07-31 05:53:53 +00:00
5499333ff3 fix(identity): use test fixture for ed25519
Use test fixture from https://github.com/libp2p/specs/pull/537/ for ed25519 roundtrip test.

Pull-Request: #4228.
2023-07-29 19:56:11 +00:00
f10f1a274a chore: prepare identity v0.2.2 and swarm v0.43.2
Pull-Request: #4256.
2023-07-26 13:59:01 +00:00
7f2ef013a8 feat(identity): implement from_protobuf_encoding for RSA keys
Add support for reading a libp2p RSA keypair from a Protobuf.

Pull-Request: #4193.
2023-07-24 19:03:04 +00:00
9bfa964147 deps: bump rmp-serde from 1.1.1 to 1.1.2
Pull-Request: #4237.
2023-07-24 11:50:11 +00:00
86fb960b69 chore(identity): prepare release for libp2p-identity 0.2.1
Pull-Request: #4128.
2023-06-27 18:45:58 +01:00
5c362fcab1 fix(identity): bump version
In https://github.com/libp2p/rust-libp2p/pull/4107, we forgot to bump the version of `libp2p-identity`.

Pull-Request: #4125.


  
Co-Authored-By: Thomas Eizinger <thomas@eizinger.io>
2023-06-27 08:13:34 +00:00
78510ede84 feat(identity): expose KeyType for PublicKey and Keypair
Resolves https://github.com/libp2p/rust-libp2p/issues/3649.

Pull-Request: #4107.


  
Co-Authored-By: Nick Pavlov <gurinderu@gmail.com>
  

  
Co-Authored-By: Thomas Eizinger <thomas@eizinger.io>
2023-06-26 17:53:23 +00:00
04b7668c55 deps: bump sha2 from 0.10.6 to 0.10.7
Pull-Request: #4088.
2023-06-20 13:10:43 +00:00
4532302917 refactor(identity): fix import warnings in keypair.rs
- Adding conditional `cfg` in `keypair.rs` imports.
- Adding `#[allow(unused_variables)]` on the top of the `sign` function.

Pull-Request: #4047.
2023-06-08 09:27:33 +00:00
59f073df82 chore(identity): remove "unreleased" from v0.2.0 changelog entry
Pull-Request: #4048.
2023-06-07 10:44:26 +00:00
0db9937ee5 feat: remove multiaddr dependency from libp2p-identity
Related: https://github.com/multiformats/rust-multiaddr/issues/73.
Depends-On: https://github.com/libp2p/rust-libp2p/pull/3514.

Pull-Request: #3656.
2023-06-06 17:27:13 +00:00
b73f7209c5 deps: bump bs58 from 0.4.0 to 0.5.0
Pull-Request: #3999.
2023-05-30 19:27:34 +00:00
34e1780498 deps: bump criterion from 0.4.0 to 0.5.1
Pull-Request: #4002.
2023-05-30 02:06:57 +00:00
c5dd0a2e14 deps: bump base64 from 0.21.0 to 0.21.2
Pull-Request: #3993.
2023-05-28 06:36:18 +00:00
4fdd83e42f fix(identity): remove unused file secp256r1.pk8
Introduced in https://github.com/libp2p/rust-libp2p/pull/3863/.

Pull-Request: #3950.
2023-05-16 05:31:30 +00:00
3cc6c7e080 feat(identity): remove deprecated items
Related: https://github.com/libp2p/rust-libp2p/issues/3647.

Pull-Request: #3928.
2023-05-15 11:39:54 +00:00
25958a2f8c feat(identity): make secp256k1::SecretKey::sign infallible
Previously, this function would return an error in case the provided digest is not of 32 bytes long. As per our [spec](https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md#secp256k1), we hash _all_ messages with SHA256 before signing, thus this error can never happen in practice.

This brings us one step closer to an infallible `Keypair::sign` which is now only fallible due to RSA signing. If we manage to fix that as well, constructors like `noise::Config::new` will become infallible.

Pull-Request: #3850.
2023-05-12 02:43:14 +00:00
14938043cf feat(identity): make Keypair and Publickey opaque
`Keypair` and `Publickey` are rendered opaque:
- `Keypair` is replaced by a private `KeyPairInner` enum that is encapsulated inside the `Keypair` `pub struct`
- `Publickey` is replaced by a private `PublickeyInner` enum that is encapsulated inside the `Publickey` `pub struct`

Resolves #3860.

Pull-Request: #3866.
2023-05-05 20:17:47 +00:00
b8411d173f feat(identity): allow importing and exporting secp256k1 keys
Related: #3681

Pull-Request: #3887.
2023-05-05 13:17:46 +00:00
1eb929b38a feat(identity): allow importing and exporting ECDSA keys
Implement encoding to/decoding from DER-encoded secret key document for `ecdsa::SecretKey`.
Implement encoding to/decoding from protobuf format for ECDSA keys.
Bump dependency `p256` from 0.12 to 0.13.
Bump dependency `sec1` from 0.3.0 to 0.7

Related: #3681.

Pull-Request: #3863.
2023-05-04 18:36:05 +00:00
996b5c8bd0 chore: leverage cargo's workspace inheritance
Previously, we would specify the version and path of our workspace dependencies in each of our crates. This is error prone as https://github.com/libp2p/rust-libp2p/pull/3658#discussion_r1153278072 for example shows. Problems like these happened in the past too.

There is no need for us to ever depend on a earlier version than the most current one in our crates. It thus makes sense that we manage this version in a single place.

Cargo supports a feature called "workspace inheritance" which allows us to share a dependency declaration across a workspace and inherit it with `{ workspace = true }`.

We do this for all our workspace dependencies and for the MSRV.

Resolves #3787.

Pull-Request: #3715.
2023-05-02 09:14:14 +00:00
d1fadc592d fix(identity): handle warnings related to feature flags
Some of the feature-flags weren't set correctly and thus produced warnings for unused code. We can fix this by using absolute paths instead of imports and allow `dead_code` for the error constructor. It might be possible to write a correct `cfg` for this as well but I think it will be very verbose, hence I didn't bother.

Pull-Request: #3859.
2023-05-01 14:10:37 +00:00
2d9ae3800f chore: prepare patch releases on top of v0.51.3
Note that this does not release v0.51.4, i.e. there is no patch release of the meta crate `libp2p`.

Pull-Request: #3854.
2023-05-01 02:56:32 +00:00
135942d319 chore: enforce unreachable_pub lint
The `unreachable_pub` lint makes us aware of uses of `pub` that are not actually reachable from the crate root. This is considered good because it means reading a `pub` somewhere means it is actually public API. Some of our crates are quite large and keeping their entire API surface in your head is difficult.

We should strive for most items being `pub(crate)`. This lint helps us enforce that.

Pull-Request: #3735.
2023-04-26 07:31:56 +00:00
13623b2da7 fix(identity): build with all features on docs.rs
Resolves #3810.

Pull-Request: #3828.
2023-04-25 14:06:54 +00:00
e6f9d49109 fix(identity): add From & Into for public keys
This patch removes the `version 0.2.0` for deprecations as libp2p-identity is only at `0.1.1` and this can be confusing to the reader.

It also adds `impl From<ed25519::PublicKey> for PublicKey` (et al.) so that `PublicKey::from(ed25519::PublicKey)` works.

Fixes https://github.com/libp2p/rust-libp2p/issues/3802.

Pull-Request: #3805.
2023-04-22 10:16:58 +00:00
058c2d85ec refactor(identity): follow naming conventions for conversion methods
This PR renames some method names that don't follow Rust naming conventions or behave differently from what the name suggests:
- Enforce "try" prefix on all methods that return `Result`.
- Enforce "encode" method name for methods that return encoded bytes.
- Enforce "to_bytes" method name for methods that return raw bytes.
- Enforce "decode" method name for methods that convert encoded key.
- Enforce "from_bytes" method name for methods that convert raw bytes.

Pull-Request: #3775.
2023-04-14 08:55:13 +00:00
06ea8cef7e deps: bump asn1_der from 0.7.5 to 0.7.6
Pull-Request: #3752.
2023-04-10 15:40:51 +00:00
6b6187bd1c fix(identity): remove prost dependency
Pull-Request: #3713.
2023-04-09 15:48:43 +00:00
95fa913923 deps: bump multiaddr from 0.17.0 to 0.17.1
Pull-Request: #3688.
2023-04-04 13:38:53 +00:00
d7396706d0 fix(changelog): Make release heading levels consistent
See `##` for release headings everywhere. This is consistent with markdown conventions of one `#` per document and in line with https://keepachangelog.com/.

See report in https://github.com/libp2p/rust-libp2p/issues/3531.

Pull-Request: #3561.
2023-03-30 21:04:01 +00:00
dfa7bd6b57 refactor: don't depend on multihash features
All we need from the multihash is for it to be a data structure that we pass around. We only ever use the identity "hasher" and the sha256 hasher. Those are easily implemented without depending the (fairly heavy) machinery in `multihash`.

Unfortunately, this patch by itself does not yet lighten our dependency tree because `multiaddr` activates those features unconditionally. I opened a companion PR for this: https://github.com/multiformats/rust-multiaddr/pull/77.

https://github.com/multiformats/rust-multiaddr/pull/77 is another breaking change and we are trying to delay those at the moment. However, it will (hopefully) land eventually which should then be much easier to implement.

Fixes #3276.

Pull-Request: #3514.
2023-03-30 17:47:35 +00:00
75f967f4da refactor(identity): leverage Copy impl for ed25519 public key
No need for function calls to `to_bytes` and `from_bytes` if the type is `Copy`.

Related: #3649.

Pull-Request: #3706.
2023-03-30 11:07:37 +00:00
bd0459121f deps: bump zeroize from 1.5.7 to 1.6.0
Pull-Request: #3685.
2023-03-29 12:07:18 +00:00
8f271caec3 chore(identity): prepare 0.1.1 release
As discussed in https://github.com/libp2p/rust-libp2p/pull/3626#pullrequestreview-1344657608.

Pull-Request: #3631.
2023-03-18 11:11:21 +00:00
14292c4758 feat(identity): add From impls for specific keypair types
Closes #3618.

Pull-Request: #3626.
2023-03-16 16:10:54 +00:00
873a90edbd fix(identity): remove prost-build from build deps
There's no `build.rs` and `build-dependency` is not needed

Pull-Request: #3619.
2023-03-16 09:55:42 +00:00