68 Commits

Author SHA1 Message Date
Mike Voronov
7af4af1e3e bump version 2023-12-18 17:06:11 +03:00
Ivan Boldyrev
3e824d9639 Merge branch 'master' into rand-feature 2023-10-17 12:22:29 +04:00
Thomas Eizinger
ce91c1c22c
chore: apply clippy lints to public API
By default, clippy doesn't suggest changes if it would break the public API. Whilst a sensible default, it makes us miss certain opportunities to follow conventions correctly. When a new lint is added, we can always temporarily allow it and make a change in the next breaking release but I think it is better to be aware of the lint than having it automatically silenced.

Pull-Request: #4653.
2023-10-16 21:57:36 +00:00
Ivan Boldyrev
c9077117f0 Remove a comment 2023-10-10 11:12:42 +04:00
Ivan Boldyrev
fedbb60d71 Merge branch 'master' into rand-feature 2023-10-09 13:17:40 +04:00
Binston Sukhael Cardoza
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
Thomas Eizinger
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
Ivan Boldyrev
d68fe13e98
Update identity/CHANGELOG.md
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2023-10-06 22:24:47 +07:00
Ivan Boldyrev
4e9419c59c
Format identity/Cargo.toml
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2023-10-06 20:56:19 +07:00
Ivan Boldyrev
8d9881d965 ed25519 feature doens't depend on rand directly 2023-10-05 20:41:05 +04:00
Ivan Boldyrev
4fe58a1a3b libp2p-identity version bump 2023-10-05 18:27:30 +04:00
Ivan Boldyrev
ea1a136ab9 Merge branch 'master' into rand-feature 2023-10-03 22:38:09 +04:00
Ivan Boldyrev
2fe25c725c Restore a comment with doctest 2023-10-03 21:56:26 +04:00
Ivan Boldyrev
866cc1a21a identity doesn't have rand as default 2023-10-03 21:54:32 +04:00
Thomas Eizinger
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
Thomas Eizinger
ef1cd354d8
fix(identity): address clippy lint
Pull-Request: #4582.
2023-10-02 22:59:39 +00:00
Ivan Boldyrev
11de754832 Merge branch 'master' into rand-feature 2023-10-02 16:56:11 +04:00
Ivan Boldyrev
6c03b8c6ae Merge branch 'master' into rand-feature 2023-10-02 16:36:16 +04:00
dependabot[bot]
90a9752dc7
deps: bump sha2 from 0.10.7 to 0.10.8
Pull-Request: #4579.
2023-10-02 09:03:11 +00:00
João Oliveira
7f92cb0725
feat(quic): support stateless resets
Resolves #3419.

Pull-Request: #4554.
2023-10-02 00:28:32 +00:00
Ivan Boldyrev
4143eafbff Make ed25519-dalek's rand_core feature optional
It has to be enabled by rand feature only.
2023-09-26 14:24:19 +04:00
dependabot[bot]
0df1a96e3c
deps: bump base64 from 0.21.3 to 0.21.4
Pull-Request: #4479.
2023-09-11 23:32:09 +00:00
dependabot[bot]
ac57f8df7e
deps: bump multihash from 0.19.0 to 0.19.1
Pull-Request: #4474.
2023-09-11 08:59:07 +00:00
dependabot[bot]
c1bccd5c1c
deps: bump base64 from 0.21.2 to 0.21.3
Pull-Request: #4401.
2023-09-04 09:43:13 +00:00
Thomas Eizinger
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
Thomas Eizinger
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
Ivan Boldyrev
79b3bdd79f Merge branch 'master' into rand-feature 2023-08-19 23:17:06 +04:00
Ivan Boldyrev
9f69eabaaf feat(identity)!: make rand optional
Some restricted environments lack proper random source, and `getrandom` crate
fails to compile.  However, random sources is needed only for random key
generation which is not always required.

This change introduces `rand` feature flag that is gate to all the
functionality that requires `rand` crate.
2023-08-19 23:02:31 +04:00
João Oliveira
fb61697390
deps(identity): update ed25519-dalek to 2.0
Pull-Request: #4337.
2023-08-18 10:03:22 +02:00
João Oliveira
ceccb8e9c0
chore: fix clippy
Pull-Request: #4267.
2023-07-31 05:53:53 +00:00
Max Inden
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
Max Inden
f10f1a274a
chore: prepare identity v0.2.2 and swarm v0.43.2
Pull-Request: #4256.
2023-07-26 13:59:01 +00:00
Max Inden
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
dependabot[bot]
9bfa964147
deps: bump rmp-serde from 1.1.1 to 1.1.2
Pull-Request: #4237.
2023-07-24 11:50:11 +00:00
Thomas Eizinger
86fb960b69
chore(identity): prepare release for libp2p-identity 0.2.1
Pull-Request: #4128.
2023-06-27 18:45:58 +01:00
Thomas Eizinger
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
Nick
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
dependabot[bot]
04b7668c55
deps: bump sha2 from 0.10.6 to 0.10.7
Pull-Request: #4088.
2023-06-20 13:10:43 +00:00
Thomas Coratger
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
Max Inden
59f073df82
chore(identity): remove "unreleased" from v0.2.0 changelog entry
Pull-Request: #4048.
2023-06-07 10:44:26 +00:00
Thomas Eizinger
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
dependabot[bot]
b73f7209c5
deps: bump bs58 from 0.4.0 to 0.5.0
Pull-Request: #3999.
2023-05-30 19:27:34 +00:00
dependabot[bot]
34e1780498
deps: bump criterion from 0.4.0 to 0.5.1
Pull-Request: #4002.
2023-05-30 02:06:57 +00:00
dependabot[bot]
c5dd0a2e14
deps: bump base64 from 0.21.0 to 0.21.2
Pull-Request: #3993.
2023-05-28 06:36:18 +00:00
Max Inden
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
Thomas Coratger
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
Thomas Eizinger
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
Thomas Coratger
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
DrHuangMHT
b8411d173f
feat(identity): allow importing and exporting secp256k1 keys
Related: #3681

Pull-Request: #3887.
2023-05-05 13:17:46 +00:00
DrHuangMHT
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