-
Notifications
You must be signed in to change notification settings - Fork 153
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
feat(scripts): add MACI key generation script #1869
Changes from 2 commits
1ae8ad1
9cc4a09
4d38399
176b575
e5995a2
84ad290
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 | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,24 @@ | ||||||
const { genKeypair } = require("maci-crypto"); | ||||||
const fs = require("fs"); | ||||||
const path = require("path"); | ||||||
|
||||||
function generateMaciKeys() { | ||||||
const { privKey, pubKey } = genKeypair(); | ||||||
|
||||||
const keys = { | ||||||
privateKey: privKey.toString(), | ||||||
publicKey: pubKey.toString(), | ||||||
}; | ||||||
|
||||||
const outputDir = path.join(__dirname, "..", "maci-keys"); | ||||||
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.
Suggested change
|
||||||
if (!fs.existsSync(outputDir)) { | ||||||
fs.mkdirSync(outputDir, { recursive: true }); | ||||||
} | ||||||
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. Use async version here |
||||||
|
||||||
const outputFile = path.join(outputDir, "maci-keys.json"); | ||||||
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.
Suggested change
|
||||||
fs.writeFileSync(outputFile, JSON.stringify(keys, null, 2)); | ||||||
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 same with async |
||||||
|
||||||
console.log("MACI keys generated and saved to:", outputFile); | ||||||
} | ||||||
|
||||||
generateMaciKeys(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use typescript