signMessage = async (key, data) => {
  if (!key) {
    throw new Error('No signing key given')
  }

  if (!data) {
    throw new Error('Given input data was undefined')
  }

  if (!(data instanceof Uint8Array)) {
    data = typeof data === 'string' ? uint8ArrayFromString(data) : new Uint8Array(data)
  }

  return uint8ArrayToString(await key.sign(data), 'base16')
}
Signs data using a key pair.
@param {Secp256k1PrivateKey} key The key to use for signing data.
@param {string|Uint8Array} data The data to sign.
@return {string} A signature.
@throws No signing key given if no key is provided.
@throws Given input data was undefined if no data is provided.
@static
@private