Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
JavaScript component for private keys, public keys, and addresess for crypto currencies such as Bitcoin, Litecoin, and Dogecoin
JavaScript component for private keys, public keys, and addresess for crypto currencies such as Bitcoin, Litecoin, and Dogecoin.
This module provides a convenient way to compute all of the relevant crypto currency details of private keys, public keys, and addresses. It inherits from ECKey and adds the utility of coinstring.
npm install --save coinkey
(TODO)
Constructor function.
Array
, Uint8Array
, or a Buffer
. If not passed, one will be randomlyl generated.mainnet
.var CoinKey = require('coinkey');
var secureRandom = require('secure-random');
var bytes = secureRandom(32); //https://github.com/jprichardson/secure-random
var key1 = new ECKey(bytes);
var key2 = ECKey(bytes); //<--- can also use without "new"
var compressedKey = new ECKey(bytes, true);
Inherited from ECKey. eckey.compressed
Inherited from ECKey. eckey.privateKey
Inherited from ECKey. eckey.privateExportKey
Get the private WIF (Wallet Import Format).
var CoinKey = require('coinkey');
var conv = require('binstring');
var privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd";
//Bitcoin WIF
var key = new CoinKey(conv(privateKeyHex, {in: 'hex', out: 'buffer'}), false);
console.log(key.privateWif) // => 5Hx15HFGyep2CfPxsJKe2fXJsCVn5DEiyoeGGF6JZjGbTRnqfiD
//Litecoin WIF
var key = new CoinKey(conv(privateKeyHex, {in: 'hex', out: 'buffer'}), false, {private: 0xB0, public: 0x30});
console.log(key.privateWif) // => 6uFjYQnot5Gtg3HpP87bp4JUpg4FH1gkkV3RyS7LHBbD9Hpt1na
Inherited from ECKey. eckey.publicKey
Get the public address.
var CoinKey = require('coinkey');
var conv = require('binstring');
var privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd";
//Bitcoin Address
var key = new CoinKey(conv(privateKeyHex, {in: 'hex', out: 'buffer'}), false);
console.log(key.publicAddress) // => 16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS
//Litecoin Address
var key = new CoinKey(conv(privateKeyHex, {in: 'hex', out: 'buffer'}), false, {private: 0xB0, public: 0x30});
console.log(key.publicAddress) // => 16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS
Alias: pubKeyHash
Get the public hash i.e. the ripemd160(sha256(publicKey))
var CoinKey = require('coinkey');
var conv = require('binstring');
var privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd";
var key = new CoinKey(conv(privateKeyHex, {in: 'hex', out: 'buffer'}), false);
console.log(key.publicHash.toString('hex')) // => 3c176e659bea0f29a3e9bf7880c112b1b31b4dc8
console.log(key.publKeyHash.toString('hex')) // => 3c176e659bea0f29a3e9bf7880c112b1b31b4dc8
var keyCompressed = CoinKey(conv(privateKeyHex, {in: 'hex', out: 'buffer'}), true);
console.log(key.publicHash.toString('hex')) // => a1c2f92a9dacbd2991c3897724a93f338e44bdc1
console.log(key.publKeyHash.toString('hex')) // => a1c2f92a9dacbd2991c3897724a93f338e44bdc1
Inherited from ECKey. eckey.publicPoint
Returns the string representation of the private key.
FAQs
JavaScript component for private keys, public keys, and addresess for crypto currencies such as Bitcoin, Litecoin, and Dogecoin
The npm package coinkey receives a total of 11,404 weekly downloads. As such, coinkey popularity was classified as popular.
We found that coinkey demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.