Skip to content

Commit

Permalink
refactor(iroh-net): unify key handling (#1373)
Browse files Browse the repository at this point in the history
## Description

Moves all keys being used to `ed25519` keys, and only converts them to
`crypto_box` keys only when needed.

### Breaking Changes

- This is a breaking change to the derp protocol, as now only `ed25519`
keys are sent over the wire.
- The encrypted packets also changed, as first the sealed message and
then the nonce is now sent
- All configs and cli options now use `secret_key` not `keypair` or
`private_key`
- MSRV from `1.66` to `1.67` due to updated dependencies
- `PeerId` is removed in favor of just using `PublicKey` directly
 
## Notes & open questions

- [x] This is more expensive as the conversions are not cached at the
moment, we should do so either in this PR or in a follow up.
- [x] Depends on RustCrypto/nacl-compat#137 as
otherwise the upgrade of `ed25519` breaks the code.

## Caching

There is a performance benefit to caching, so for public key we always
cache the `crypto_box::PublicKey`, and for `SecretKey`s we cache using
`OnceCell`.

---------

Co-authored-by: Diva M <[email protected]>
  • Loading branch information
dignifiedquire and divagant-martian authored Aug 21, 2023
1 parent 57a2dee commit 8b73323
Show file tree
Hide file tree
Showing 55 changed files with 1,585 additions and 1,394 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
RUST_BACKTRACE: 1
RUSTFLAGS: -Dwarnings
RUSTDOCFLAGS: -Dwarnings
MSRV: "1.66"
MSRV: "1.67"

jobs:
build_and_test_nix:
Expand Down Expand Up @@ -276,7 +276,7 @@ jobs:
# TODO: We have a bunch of platform-dependent code so should
# probably run this job on the full platofrm matrix
- name: clippy check (all features)
run: cargo clippy --workspace --all-features --all-targets
run: cargo clippy --workspace --all-features --all-targets --bins --tests --benches

- name: clippy check (no features)
run: cargo clippy --workspace --no-default-features --lib --bins --tests
Expand Down
Loading

0 comments on commit 8b73323

Please sign in to comment.