Initial Commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
const ethers = require("ethers");
|
||||
const fs = require("fs-extra");
|
||||
require("dotenv").config();
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY);
|
||||
const encryptedJsonKey = await wallet.encrypt(
|
||||
process.env.PRIVATE_KEY_PASSWORD,
|
||||
process.env.PRIVATE_KEY,
|
||||
);
|
||||
console.log(encryptedJsonKey);
|
||||
fs.writeFileSync("./.encryptedKey.json", encryptedJsonKey);
|
||||
} catch (error) {
|
||||
console.error("Error during encryption or file write:", error);
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user