-
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
base: dev
Are you sure you want to change the base?
Changes from 3 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,25 @@ | ||||||
import { genKeypair } from "maci-crypto"; | ||||||
|
||||||
import { promises as fs } from "fs"; | ||||||
import * as path from "path"; | ||||||
|
||||||
async function generateMaciKeys(): Promise<void> { | ||||||
const { privKey, pubKey } = genKeypair(); | ||||||
|
||||||
const keys = { | ||||||
privateKey: privKey.toString(), | ||||||
publicKey: pubKey.toString(), | ||||||
}; | ||||||
|
||||||
const outputDir = path.resolve(__dirname, "..", "maci-keys"); | ||||||
try { | ||||||
await fs.access(outputDir); | ||||||
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
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. And the same change for other 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. @0xmad done can you check |
||||||
} catch (error) { | ||||||
await fs.mkdir(outputDir, { recursive: true }); | ||||||
} | ||||||
|
||||||
const outputFile = path.resolve(outputDir, "maci-keys.json"); | ||||||
await fs.writeFile(outputFile, JSON.stringify(keys, null, 2)); | ||||||
} | ||||||
|
||||||
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.