RangerMauve / hyper-sdk

Make your own hyper apps!
https://www.youtube.com/watch?v=HyHk4aImd_I&list=PL7sG5SCUNyeYx8wnfMOUpsh7rM_g0w_cu&index=20
MIT License
290 stars 46 forks source link

Hypercore constructor not respecting key argument #9

Closed DeltaF1 closed 5 years ago

DeltaF1 commented 5 years ago

Expected behaviour:

Passing in the key attribute of a generated hypercore to the contructor should produce another hypercore with the same key

Actual behaviour:

A new random key-pair is generated

Environment:

Ubuntu on Windows Subsystem for Linux, node v10.16.0

Steps to reproduce:

> const {Hypercore} = require('dat-sdk')();
undefined
> remote = Hypercore('23e2ea2ce9e4ecf32df8b0cb8bbf951ce95f828a0ae2a56c76f051697b590a21');
Hypercore(
  key: null
  discoveryKey: null
  opened: false
  sparse: false
  writable: false
  length: 0
  byteLength: 0
  peers: 0
)
> remote.key
<Buffer 76 7e 79 b2 22 92 56 b2 64 b3 88 88 2c 5f 4a 7b b6 f0 70 67 be 06 fa 81 aa 27 a2 08 47 cb e9 41>
RangerMauve commented 5 years ago

Would you mind testing again with the latest version of the SDK inside master?

You can do so by calling npm i -s datproject/sdk.

I just tried adding a unit test for this case and it seemed to be working.

RangerMauve commented 5 years ago

Does this still happen for you?