secret-stack
secret-stack copied to clipboard
docs — `seed` option
The tests show passing in an option seed to create --
var alice = create({ seed: seeds.alice })
https://github.com/ssb-js/secret-stack/blob/113efba0cfba73a6eebce8aa01b18d7d6ae5f3d2/test/server.js#L31
but I can't figure out what that is used for. Is it required?
Hi @nichoth, I do not believe this is required, if it's present it gets used, if not, no big deal and it seems like it really appears mainly in tests tbh.
Looks like it gets added to the config and can be found at config.seed. it looks to be consumed by ssb-keys when generating a new keypair. check the docs for the generate method here: https://github.com/ssb-js/ssb-keys/blob/fa7a30f3f8a6895dead4bd9b43fba288894d48bc/README.md#L109
i think it also gets used when generating keys in the secret-handshake toKeys method: https://github.com/auditdrivencrypto/secret-handshake/blob/7a465d19f9c36fa2bb2cf6f4e5271bbd68d2cd74/crypto.js#L187
thanks @austinfrey . So it is used to create the keys for ssb and also secret-handshake
Although it looks like you do need to pass in something as config. I made an example repo showing how to use this -- https://github.com/nichoth/ss-example/blob/main/index.js#L29 -- and if you call it without the seed option it throws an error:
/Users/nick/code/ss-example/node_modules/separator-escape/index.js:36
for(var i = 0; i < str.length; i++) {
^
TypeError: Cannot read properties of undefined (reading 'length')
@nichoth ~~correct, it can be an empty config object though I think: App({})~~
you might also try passing in keys App.({keys: ssbKey.loadOrCreate()})
- edit: i think you can do
seedsorkeys: ssbKeys.generate()or something like that. it seems you need one or the other, can't be empty.