added function to encrypt tx key
This commit is contained in:
parent
721647e1f9
commit
a85de6f143
46
index.html
46
index.html
@ -11630,6 +11630,9 @@
|
|||||||
const WS = 'ws';
|
const WS = 'ws';
|
||||||
const DBName = "localbitcoinDBRemote";
|
const DBName = "localbitcoinDBRemote";
|
||||||
|
|
||||||
|
// MUST REMOVE FROM HERE. FETCH IT FROM A CONFIG FILE
|
||||||
|
const masterEncryptionKey = "rEmoVeMefRomHerE";
|
||||||
|
|
||||||
if(ENVR === 'LIVE') {
|
if(ENVR === 'LIVE') {
|
||||||
|
|
||||||
Object.defineProperty(localbitcoinplusplus, "RM_FLO_SENDING_ADDR", {
|
Object.defineProperty(localbitcoinplusplus, "RM_FLO_SENDING_ADDR", {
|
||||||
@ -12902,6 +12905,33 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
master_encrypt: function(msg='') {
|
||||||
|
try {
|
||||||
|
if(typeof msg !== 'string') {
|
||||||
|
msg = JSON.stringify(msg);
|
||||||
|
}
|
||||||
|
if(msg.length<1 || typeof masterEncryptionKey !== "string")
|
||||||
|
throw new Error("Invalid request");
|
||||||
|
|
||||||
|
return Crypto.AES.encrypt(msg, masterEncryptionKey);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
master_decrypt: function(encrypted_msg='') {
|
||||||
|
try {
|
||||||
|
if(encrypted_msg.length<1 || typeof masterEncryptionKey !== "string")
|
||||||
|
throw new Error("Invalid request");
|
||||||
|
|
||||||
|
return Crypto.AES.decrypt(encrypted_msg, masterEncryptionKey);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*Modified functions from https://github.com/tristanls/k-bucket */
|
/*Modified functions from https://github.com/tristanls/k-bucket */
|
||||||
@ -16100,14 +16130,13 @@
|
|||||||
i => i.id
|
i => i.id
|
||||||
);
|
);
|
||||||
let btc_private_key_shamirs_id = this_btc_pvt_key_shamirs_secret__id_array;
|
let btc_private_key_shamirs_id = this_btc_pvt_key_shamirs_secret__id_array;
|
||||||
let supernode_transaction_key = this_btc_tx_key;
|
let supernode_transaction_key = localbitcoinplusplus.actions.master_encrypt(this_btc_tx_key);
|
||||||
const system_btc_reserves_private_keys_object = {
|
const system_btc_reserves_private_keys_object = {
|
||||||
id: helper_functions.unique_id(),
|
id: helper_functions.unique_id(),
|
||||||
product: params.product,
|
product: params.product,
|
||||||
btc_address: params.btc_address,
|
btc_address: params.btc_address,
|
||||||
balance: null,
|
balance: null,
|
||||||
trader_flo_address:
|
trader_flo_address: params.trader_flo_address,
|
||||||
params.trader_flo_address,
|
|
||||||
btc_private_key_shamirs_id: btc_private_key_shamirs_id,
|
btc_private_key_shamirs_id: btc_private_key_shamirs_id,
|
||||||
supernode_transaction_key: supernode_transaction_key
|
supernode_transaction_key: supernode_transaction_key
|
||||||
};
|
};
|
||||||
@ -16920,7 +16949,8 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let transaction_key = btc_reserves.supernode_transaction_key;
|
let transaction_key = localbitcoinplusplus.actions
|
||||||
|
.master_decrypt(btc_reserves.supernode_transaction_key);
|
||||||
if (transaction_key.length > 0) {
|
if (transaction_key.length > 0) {
|
||||||
let btc_private_key = RM_WALLET.rebuild_private_key(
|
let btc_private_key = RM_WALLET.rebuild_private_key(
|
||||||
btc_pk_shares_array,
|
btc_pk_shares_array,
|
||||||
@ -17892,14 +17922,13 @@
|
|||||||
i => i.id
|
i => i.id
|
||||||
);
|
);
|
||||||
let btc_private_key_shamirs_id = this_btc_pvt_key_shamirs_secret__id_array;
|
let btc_private_key_shamirs_id = this_btc_pvt_key_shamirs_secret__id_array;
|
||||||
let supernode_transaction_key = this_btc_tx_key;
|
let supernode_transaction_key = localbitcoinplusplus.actions.master_encrypt(this_btc_tx_key);
|
||||||
const system_btc_reserves_private_keys_object = {
|
const system_btc_reserves_private_keys_object = {
|
||||||
id: helper_functions.unique_id(),
|
id: helper_functions.unique_id(),
|
||||||
product: params.product,
|
product: params.product,
|
||||||
btc_address: params.btc_address,
|
btc_address: params.btc_address,
|
||||||
balance: null,
|
balance: null,
|
||||||
trader_flo_address:
|
trader_flo_address: params.trader_flo_address,
|
||||||
params.trader_flo_address,
|
|
||||||
btc_private_key_shamirs_id: btc_private_key_shamirs_id,
|
btc_private_key_shamirs_id: btc_private_key_shamirs_id,
|
||||||
supernode_transaction_key: supernode_transaction_key
|
supernode_transaction_key: supernode_transaction_key
|
||||||
};
|
};
|
||||||
@ -18789,7 +18818,8 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let transaction_key = btc_reserves.supernode_transaction_key;
|
let transaction_key = localbitcoinplusplus.actions
|
||||||
|
.master_decrypt(btc_reserves.supernode_transaction_key);
|
||||||
if (transaction_key.length > 0) {
|
if (transaction_key.length > 0) {
|
||||||
let btc_private_key = RM_WALLET.rebuild_private_key(
|
let btc_private_key = RM_WALLET.rebuild_private_key(
|
||||||
btc_pk_shares_array,
|
btc_pk_shares_array,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user