mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 04:05:52 +00:00
style: run eslint formatter
This commit is contained in:
@@ -26,11 +26,7 @@ function generateSeed(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hash(message): number[] {
|
function hash(message): number[] {
|
||||||
return hashjs
|
return hashjs.sha512().update(message).digest().slice(0, 32)
|
||||||
.sha512()
|
|
||||||
.update(message)
|
|
||||||
.digest()
|
|
||||||
.slice(0, 32)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const secp256k1 = {
|
const secp256k1 = {
|
||||||
@@ -44,10 +40,7 @@ const secp256k1 = {
|
|||||||
const prefix = '00'
|
const prefix = '00'
|
||||||
|
|
||||||
const privateKey =
|
const privateKey =
|
||||||
prefix +
|
prefix + derivePrivateKey(entropy, options).toString(16, 64).toUpperCase()
|
||||||
derivePrivateKey(entropy, options)
|
|
||||||
.toString(16, 64)
|
|
||||||
.toUpperCase()
|
|
||||||
|
|
||||||
const publicKey = bytesToHex(
|
const publicKey = bytesToHex(
|
||||||
Secp256k1.keyFromPrivate(privateKey.slice(2))
|
Secp256k1.keyFromPrivate(privateKey.slice(2))
|
||||||
|
|||||||
@@ -17,15 +17,9 @@ function hexToBytes(a): number[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function computePublicKeyHash(publicKeyBytes: Buffer): Buffer {
|
function computePublicKeyHash(publicKeyBytes: Buffer): Buffer {
|
||||||
const hash256 = hashjs
|
const hash256 = hashjs.sha256().update(publicKeyBytes).digest()
|
||||||
.sha256()
|
|
||||||
.update(publicKeyBytes)
|
|
||||||
.digest()
|
|
||||||
|
|
||||||
const hash160 = hashjs
|
const hash160 = hashjs.ripemd160().update(hash256).digest()
|
||||||
.ripemd160()
|
|
||||||
.update(hash256)
|
|
||||||
.digest()
|
|
||||||
return Buffer.from(hash160)
|
return Buffer.from(hash160)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user