How to use the bsv/message.sign function in bsv

To help you get started, we’ve selected a few bsv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github libitx / preserve-cli / lib / commands / dns.js View on Github external
displayDNS(argv) {
    const address   = process.env.ADDRESS,
          privKey   = bsv.PrivateKey.fromWIF(process.env.PRIVATE),
          hostname  = argv.hostname,
          signature = Message.sign(argv.hostname, privKey);

    console.log( '\n' + chalk.gray('Host:\t'), chalk.white(hostname) )
    console.log( chalk.gray('Type:\t'), chalk.white('CNAME') )
    console.log( chalk.gray('Data:\t'), chalk.white('dns.preserve.bitpaste.app') )

    console.log( '\n' + chalk.gray('Host:\t'), chalk.white(`id._bsv.${ hostname }`) )
    console.log( chalk.gray('Type:\t'), chalk.white('TXT') )
    console.log( chalk.gray('Data:\t'), chalk.white(`a=${ address }; s=${ signature }`) )

    console.log('\n  🌐', 'View site at:', chalk.blue.bold('http://'+hostname))
  }
}