-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvault.js
32 lines (29 loc) · 864 Bytes
/
vault.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
const axios = require('axios');
const PropertiesReader = require('properties-reader');
const properties = PropertiesReader("config/config.properties");
async function savePrivate(public, private) {
const vaultAddress = properties.get("vaultClientApi");
console.log("vault address: ", vaultAddress)
try {
axios.post(vaultAddress, {
network: "tron",
public: public,
private: private
});
} catch (ex) {
console.log(ex);
}
}
async function getPrivate(public) {
const vaultAddress = properties.get("vaultClientApi");
try {
privateKey = await axios.get(vaultAddress, {params: {"network": "tron", "public": public}});
return privateKey.data;
} catch (ex) {
console.log(ex);
return null;
}
}
module.exports = {
savePrivate, getPrivate
}