hypercore-protocol / hypercore-next

Hypercore 10 is an append only log with multi-writer primitives built in.
MIT License
150 stars 15 forks source link

Error `Hypercore key should be 32 bytes` reduces the usefulness of custom `opts.crypto` #49

Closed Nuhvi closed 2 years ago

Nuhvi commented 2 years ago

Checking for a 32 bytes publicKey makes is it impossible to use secp256k1 compressed publicKey https://github.com/hypercore-protocol/hypercore-next/blob/master/index.js#L35

Possible solution:

    if (!opts.crypto && key && key.byteLength !== 32) {
      throw new Error('Hypercore key should be 32 bytes')
    }
mafintosh commented 2 years ago

Yea good solution, wanna PR?

Nuhvi commented 2 years ago

On it.