Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs — seed option #76

Open
nichoth opened this issue Feb 6, 2022 · 4 comments
Open

docs — seed option #76

nichoth opened this issue Feb 6, 2022 · 4 comments

Comments

@nichoth
Copy link
Contributor

nichoth commented Feb 6, 2022

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?

@austinfrey
Copy link

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

@nichoth
Copy link
Contributor Author

nichoth commented Feb 7, 2022

thanks @austinfrey . So it is used to create the keys for ssb and also secret-handshake

@nichoth
Copy link
Contributor Author

nichoth commented Feb 7, 2022

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')

@austinfrey
Copy link

austinfrey commented Feb 7, 2022

@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 seeds or keys: ssbKeys.generate() or something like that. it seems you need one or the other, can't be empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants