holepunchto / hyperdrive

Hyperdrive is a secure, real time distributed file system
Apache License 2.0
1.86k stars 134 forks source link

Unable to open existing hyperdrive with keypair #260

Closed mjp0 closed 1 year ago

mjp0 commented 4 years ago

I'm unable to open existing hyperdrive with keypair generated by hypercore-crypto. According to @mafintosh this is a regression.

const hyperdrive = require('hyperdrive')
const crypto = require('hypercore-crypto')
const keyPair = crypto.keyPair()

const d1 = hyperdrive('./test', keyPair.publicKey.toString('hex'), { keyPair })
d1.ready(() => {
  d1.close()
  const d2 = hyperdrive('./test', keyPair.publicKey.toString('hex'), { keyPair })
  d2.ready(() => {
    console.log(d2.writable) // should be true
  })
})
mafintosh commented 4 years ago

I did some probing on this yesterday and note that the first archive here is not writable as well (d1) so we prob loose the keypair somewhere or we don't support it anymore due corestore upgrades

dpaez commented 4 years ago

I think we are having this same issue on the p2pcommons SDK while we are trying to update to the latest hyperdrive version (we are also using it together with mirror-folder).

I've added a skipped test from hyperdrive codebase to @geut/hyperdrive-promise, this test reflects the same case that @markopolojarvi is exposing above. https://github.com/geut/hyperdrive-promise/pull/10/files#diff-e2686e2925145c11799d638b2f4706dcR106