ssbc / secret-stack

connect peers to each other using secret-handshakes
MIT License
90 stars 19 forks source link

enforce config.keys in TS and log an error when no keys are provided #67

Open austinfrey opened 3 years ago

austinfrey commented 3 years ago

reference: https://github.com/ssb-js/secret-stack/issues/59

mixmix commented 3 years ago

That latest seed commit is interesting, and I'd recommend pulling it out of this branch and putting it in another pr. This is because it's different feature, and so putting it in here forces us to wait til two features are discussed and reviewed. If they were separate we can review and merge faster (they're also not dependent).

Reviewing that seed change I would ask :

  1. is this needed? (what's the problem you're experiencing that motivates this)
  2. What happens when keys and seed are present?
austinfrey commented 3 years ago

@mixmix Looking at this again, I think I was getting some wires crossed. It appeared to me that passing in a seed would not populate an id or publicKey at the secret-stack level, but it clearly does. I've backed out the changes where the seed overwrites the config.keys value but I did keep a check to make sure one or the other is present.

I tried to update the Config type to require either a set of keys OR a seed, I'm not confident it's the right solution as I'm pretty green when it comes to typescript.

mixmix commented 3 years ago

I'm green too. I think it would be good to get @staltz to help complete this. I would also defer to his opinions if they conflict with anything I've said as he knows this code better than me.

Appreciate you putting energy into this 🍉🦋