-
Notifications
You must be signed in to change notification settings - Fork 7
Adding keypair generation to cli.ts #353
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ Backend CLI, currently providing 3 commands for user management: | |
| import { Command } from 'commander'; | ||
| import { SequelizeAdapter } from 'casbin-sequelize-adapter'; | ||
| import { newEnforcer } from 'casbin'; | ||
| import { curve } from '@dedis/kyber'; | ||
|
|
||
| const program = new Command(); | ||
|
|
||
|
|
@@ -65,4 +66,15 @@ program | |
| console.log('Permissions removed successfully!'); | ||
| }); | ||
|
|
||
| program | ||
| .command('keygen') | ||
| .description('Create a new keypair for the .env') | ||
| .action(() => { | ||
| const ed25519 = curve.newCurve('edwards25519'); | ||
| const priv = ed25519.scalar().pick(); | ||
| const pub = ed25519.point().mul(priv); | ||
| console.log(`PRIVATE_KEY=${priv}`); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it normal to simply print them instead of saving them where they are needed?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The goal here is to create the values that are needed for the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe add a line saying "please make sure to store this somewhere" as people might indeed expect the values to also be written to a file
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added an output, but now it won't be usable in scripts anymore... |
||
| console.log(`PUBLIC_KEY=${pub}`); | ||
| }); | ||
|
|
||
| program.parse(); | ||
Uh oh!
There was an error while loading. Please reload this page.