* addKey - Add a new key/signer pair to the HSM signer. * * @param {Object|String} key - An object with an xpub key, or an xpub as a string. * @param {Connection} connection - Authenticated connection to a specific HSM instance. * @returns {void}
(key, connection)
| 28 | * @returns {void} |
| 29 | */ |
| 30 | addKey(key, connection) { |
| 31 | const id = `${connection.baseUrl}-${connection.token || 'noauth'}` |
| 32 | let signer = this.signers[id] |
| 33 | if (!signer) { |
| 34 | signer = this.signers[id] = { |
| 35 | connection: connection, |
| 36 | xpubs: [] |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | signer.xpubs.push(typeof key == 'string' ? key : key.xpub) |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * sign - Sign a single transaction. |