Skip to content

Support passing array of private keys, or single private key to "signTransaction()" method #237

Open
@robertdavid010

Description

@robertdavid010

Currently the signTransaction() method uses rest parameters to get an array of private keys to be used for signing transaction inputs.

The method expects a corresponding private key for every transaction input at the same array index. However, since the rest parameter collects unassigned parameters into an array, it is not possible to dynamically/programatically set the number of private keys passed to the method.

https://github.com/bigchaindb/js-bigchaindb-driver/blob/master/src/transaction.js#L239

static signTransaction(transaction, ...privateKeys) {
    ...
    signedTx.inputs.forEach((input, index) => {
        const privateKey = privateKeys[index]
        ...
    }
}

Suggested improvement would be to support passing an array of private keys, as well as defaulting to using only the first private key, if only one is passed, to sign all inputs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions