mirror of
https://github.com/bigchaindb/js-bigchaindb-driver.git
synced 2024-11-24 11:01:28 +01:00
Merge pull request #1 from robertdavid010/robertdavid010-patch-1
Add support for single and array of private keys
This commit is contained in:
commit
84dd243912
@ -231,12 +231,13 @@ export default class Transaction {
|
||||
* @returns {Object} The signed version of `transaction`.
|
||||
*/
|
||||
static signTransaction(transaction, ...privateKeys) {
|
||||
privateKeys = Array.isArray(privatekeys[0]) ? privateKeys[0]: privateKeys;
|
||||
const signedTx = clone(transaction)
|
||||
const serializedTransaction =
|
||||
Transaction.serializeTransactionIntoCanonicalString(transaction)
|
||||
|
||||
signedTx.inputs.forEach((input, index) => {
|
||||
const privateKey = privateKeys[index]
|
||||
const privateKey = privateKeys[index] || privateKeys[0]
|
||||
const privateKeyBuffer = Buffer.from(base58.decode(privateKey))
|
||||
|
||||
const transactionUniqueFulfillment = input.fulfills ? serializedTransaction
|
||||
|
Loading…
Reference in New Issue
Block a user