-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(scripts): add MACI key generation script
- Add generateMaciKeys.js script - Update package.json with new script command - Update .gitignore to exclude maci-keys directory
- Loading branch information
1 parent
05e621b
commit 1ae8ad1
Showing
3 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
if (!fs.existsSync(outputDir)) { | ||
fs.mkdirSync(outputDir, { recursive: true }); | ||
} | ||
|
||
const outputFile = path.join(outputDir, 'maci-keys.json'); | ||
fs.writeFileSync(outputFile, JSON.stringify(keys, null, 2)); | ||
|
||
console.log('MACI keys generated and saved to:', outputFile); | ||
} | ||
|
||
generateMaciKeys(); |