-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerate_keys.js
49 lines (39 loc) · 1.76 KB
/
generate_keys.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Import classes etc.
import { Keys } from "./modules/keys.js";
async function main(){
//List of keys we want to generate
let keys = ['Admin Key', 'Supply Key', 'Pause Key', 'Freeze Key', 'Wipe Key'];
//Fair Warning
console.log('*****************************************');
console.log('* Save this information somewhere safe! *');
console.log('*****************************************');
//Iterate over the array and generate keys for each item
asyncForEach(keys, async (key) => {
//Title
console.log('*****************************************');
console.log('* Information for: ' + key);
console.log('*****************************************');
//Generate New Key Pair
let credentials = Keys.generateKeys();
const phrase = (await credentials).phrase;
const publicKey = (await credentials).public;
const privateKey = (await credentials).private;
const EVMpublicKey = (await credentials).EVMpublic;
const EVMprivateKey = (await credentials).EVMprivate;
const EVMAddress = (await credentials).EVMAddress;
//Credentials - Only logged here, store safely please.
console.log('New mnemonic phrase: ' + phrase);
console.log('New private key: ' + privateKey);
console.log('New public key: ' + publicKey);
console.log('New public EVM key: ' + EVMpublicKey);
console.log('New private EVM key: ' + EVMprivateKey);
console.log('New EVM Address: ' + EVMAddress);
console.log('');
});
}
async function asyncForEach(array, callback) {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array);
}
}
main();