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

Key management / signing #26

Open
crypto-coder opened this issue Oct 4, 2018 · 4 comments
Open

Key management / signing #26

crypto-coder opened this issue Oct 4, 2018 · 4 comments
Labels
fix-pending a fix is available, pending merge to master

Comments

@crypto-coder
Copy link
Contributor

crypto-coder commented Oct 4, 2018

Making a general suggestions that we include a convenience feature in the NPM package for managing aliased pub-priv keypairs in a file, that can be loaded and used to sign transactions. Functions would include things like:

Create new KeyPair: myNode.createKeyPair( alias, add_to_keystore=true );
Get Public Key by Alias: myNode.getPublicKey( alias );
Sign a transaction: myNode.signTransaction( alias, DeployData );

The current API provides the ability to dynamically generate a keypair and sign text.

const seed = randomBytes(32);
const pair1 = keyPair(seed);

console.log('public key:', pair1.publicKey());
console.log('signature:', pair1.signTextHex('hello world'));

We can use this internally, but if we want to reuse these generated keys, we will need a way to persist, and retrieve them later. Since this NPM package will be used for backend applications, there are some situations where reused keys will need to either be passed into the NPM package, or managed internally by the NPM package.

Do we have a preference?

@dckc
Copy link
Collaborator

dckc commented Oct 4, 2018

Is there a handy precedent in the ethereum world or something?

I'm hesitant to take responsibility for secure storage of private keys. Libraries that do it typically do special memory mapping stuff to keep the keys out of swap space and such. But I suppose we're already taking on the relevant risks with pair1.signTextHex('hello world'). Meanwhile... atomic file updates in a cross-platform fashion seems like another challenge.

When I made a dApp using RChain-API that needed a key store, I made it part of an overall object persistence mechanism in that app: https://github.com/dckc/rchain-dbr/blob/master/o2r/gateway/server/keyPair.js

The only other experience that comes to mind is with using Desktop keychain stuff (freedesktop secret service over dbus https://github.com/dckc/finquick/blob/master/desktop/server/main.js#L108 ).

@JoshOrndorff
Copy link
Contributor

I'm not convinced that keys and signing are in scope for this project at all. There are good general-purpose key management tools that Dan mentioned (although someone would have to provide integration), and RChain specific ones like RSign.

@dckc
Copy link
Collaborator

dckc commented Jan 14, 2019

#57 heads in this direction in an rclient sub-project.

@dckc dckc added the fix-pending a fix is available, pending merge to master label Apr 15, 2019
@dckc
Copy link
Collaborator

dckc commented Apr 15, 2019

I'm inclined to close this based on the key management support in rclient, but rclient isn't part of the travis testing and such (except the flow check, which is almost an accident).

Thoughts?

  • declare victory based on what we have now
    • if it breaks, put more work into tests then
  • wait until it's a 1st class part of the tests to declare victory
  • move secretStore.js up from rclient/src into src
  • other?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix-pending a fix is available, pending merge to master
Projects
None yet
Development

No branches or pull requests

3 participants