ChainSafe / discv5

A Typescript implementation of the Discv5 protocol
Apache License 2.0
28 stars 15 forks source link

feat: use ethereum-cryptography for enr crypto #285

Closed wemeetagain closed 7 months ago

wemeetagain commented 7 months ago

In order to make @chainsafe/enr more usable as a standalone library, we'd like to remove its heavy dependency bcrypto and replace it with something more suitable for cross-environment usage, ethereum-cryptography.

For @chainsafe/discv5, which already uses bcrypto, we can continue to use its enr crypto. This PR adds a side effect of switching enr crypto to use bcrypto when importing from @chainsfafe/discv5.

For users of @chainsafe/discv5 who would like to use ethereum-cryptography for enr crypto, you can always override the enr crypto like so:

import {setV4Crypto, defaultCrypto} from "@chainsafe/enr";

setV4Crypto(defaultCrypto)