The docs say that both join() and leave() require keys to be 32 bytes, but it's buried in the docs and neither one complains if you give them a Buffer with a different length. They just aren't reliable. This enforces that 32 byte length, adds tests to make sure it's enforcing it, and gives a more helpful error message if you don't abide by that restriction.
I ran into a whole bunch of weird issues when trying to port multiserver-dht from discovery-swarm to Hyperswarm. Turns out a lot of the problems I was running into were due to Hyperswarm expecting a 32 byte key but not complaining if a shorter one was passed to it, which was quite unlike how discovery-swarm worked. Basically independently discovered and encountered the problem in #11.
The docs say that both join() and leave() require keys to be 32 bytes, but it's buried in the docs and neither one complains if you give them a Buffer with a different length. They just aren't reliable. This enforces that 32 byte length, adds tests to make sure it's enforcing it, and gives a more helpful error message if you don't abide by that restriction.
I ran into a whole bunch of weird issues when trying to port multiserver-dht from discovery-swarm to Hyperswarm. Turns out a lot of the problems I was running into were due to Hyperswarm expecting a 32 byte key but not complaining if a shorter one was passed to it, which was quite unlike how discovery-swarm worked. Basically independently discovered and encountered the problem in #11.