New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@defichain/jellyfish-crypto

Package Overview
Dependencies
Maintainers
2
Versions
293
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@defichain/jellyfish-crypto - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

32

dist/bech32.d.ts

@@ -10,17 +10,17 @@ /// <reference types="node" />

export declare type HRP = 'df' | 'tf' | 'bcrt';
/**
* @param {Buffer} pubKey to format into bech32
* @param {'df'|'tf'|'bcrt'} hrp is the human readable part
* @param {number} version witness version, OP_0
* @return {string} bech32 encoded address
* @see https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki
*/
export declare function toBech32(pubKey: Buffer, hrp: HRP, version?: 0x00): string;
/**
* @param {string} address to decode from bech32
* @param {'df'|'tf'|'bcrt'} hrp is the human readable part
* @param {number} version witness version, OP_0
* @return {Buffer} hash160 of the pubkey
* @see https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki
*/
export declare function fromBech32(address: string, hrp?: HRP, version?: 0x00): Buffer;
export declare const Bech32: {
/**
* @param {Buffer} pubKey to format into bech32
* @param {'df'|'tf'|'bcrt'} hrp is the human readable part
* @param {number} [version=0x00] witness version, OP_0
* @return {string} bech32 encoded address
*/
fromPubKey(pubKey: Buffer, hrp: HRP, version?: 0x00): string;
/**
* @param {string} address to decode from bech32
* @param {'df'|'tf'|'bcrt'} hrp is the human readable part
* @param {number} [version] witness version, OP_0
* @return {Buffer} hash160 of the pubkey
*/
toPubKey(address: string, hrp?: HRP | undefined, version?: 0 | undefined): Buffer;
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fromBech32 = exports.toBech32 = void 0;
exports.Bech32 = void 0;
const bech32_1 = require("bech32");

@@ -9,3 +9,3 @@ const hash_1 = require("./hash");

* @param {'df'|'tf'|'bcrt'} hrp is the human readable part
* @param {number} version witness version, OP_0
* @param {number} [version=0x00] witness version, OP_0
* @return {string} bech32 encoded address

@@ -20,7 +20,6 @@ * @see https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki

}
exports.toBech32 = toBech32;
/**
* @param {string} address to decode from bech32
* @param {'df'|'tf'|'bcrt'} hrp is the human readable part
* @param {number} version witness version, OP_0
* @param {number} [version] witness version, OP_0
* @return {Buffer} hash160 of the pubkey

@@ -40,2 +39,21 @@ * @see https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki

}
exports.fromBech32 = fromBech32;
exports.Bech32 = {
/**
* @param {Buffer} pubKey to format into bech32
* @param {'df'|'tf'|'bcrt'} hrp is the human readable part
* @param {number} [version=0x00] witness version, OP_0
* @return {string} bech32 encoded address
*/
fromPubKey(pubKey, hrp, version = 0x00) {
return toBech32(pubKey, hrp, version);
},
/**
* @param {string} address to decode from bech32
* @param {'df'|'tf'|'bcrt'} hrp is the human readable part
* @param {number} [version] witness version, OP_0
* @return {Buffer} hash160 of the pubkey
*/
toPubKey(address, hrp, version) {
return fromBech32(address, hrp, version);
}
};

@@ -12,3 +12,3 @@ /// <reference types="node" />

/**
* @return Promise<Buffer> compressed public key
* @return {Promise<Buffer>} compressed public key
*/

@@ -18,7 +18,7 @@ publicKey: () => Promise<Buffer>;

* Allowed to fail if EllipticPair does not provide hardware key
* @return Promise<Buffer> privateKey
* @return {Promise<Buffer>} privateKey
*/
privateKey: () => Promise<Buffer>;
/**
* @param hash {Buffer} to sign
* @param {Buffer} hash to sign
* @return {Buffer} signature in DER format, SIGHASHTYPE not included

@@ -30,12 +30,14 @@ * @see https://tools.ietf.org/html/rfc6979

/**
* @param hash {Buffer} to verify with signature
* @param derSignature {Buffer} of the hash in encoded with DER, SIGHASHTYPE must not be included
* @return boolean validity of signature of the hash
* @param {Buffer} hash to verify with signature
* @param {Buffer} derSignature of the hash in encoded with DER, SIGHASHTYPE must not be included
* @return {boolean} validity of signature of the hash
*/
verify: (hash: Buffer, derSignature: Buffer) => Promise<boolean>;
}
/**
* @param buffer in little endian
* @return SECP256K1 EllipticPair
*/
export declare function getEllipticPairFromPrivateKey(buffer: Buffer): EllipticPair;
export declare const Elliptic: {
/**
* @param {Buffer} buffer in little endian
* @return {SECP256K1} EllipticPair
*/
fromPrivKey(buffer: Buffer): EllipticPair;
};

@@ -15,3 +15,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getEllipticPairFromPrivateKey = void 0;
exports.Elliptic = void 0;
const tiny_secp256k1_1 = __importDefault(require("tiny-secp256k1"));

@@ -64,4 +64,4 @@ const der_1 = require("./der");

/**
* @param buffer in little endian
* @return SECP256K1 EllipticPair
* @param {Buffer} buffer in little endian
* @return {SECP256K1} EllipticPair
*/

@@ -71,2 +71,10 @@ function getEllipticPairFromPrivateKey(buffer) {

}
exports.getEllipticPairFromPrivateKey = getEllipticPairFromPrivateKey;
exports.Elliptic = {
/**
* @param {Buffer} buffer in little endian
* @return {SECP256K1} EllipticPair
*/
fromPrivKey(buffer) {
return getEllipticPairFromPrivateKey(buffer);
}
};
/// <reference types="node" />
/**
* @param buffer to RIPEMD160(buffer)
* @param {Buffer} buffer to RIPEMD160(buffer)
*/
export declare function RIPEMD160(buffer: Buffer): Buffer;
/**
* @param buffer to SHA256(buffer)
* @param {Buffer} buffer to SHA256(buffer)
*/
export declare function SHA256(buffer: Buffer): Buffer;
/**
* @param buffer to RIPEMD160(SHA256(buffer))
* @param {Buffer} buffer to RIPEMD160(SHA256(buffer))
*/
export declare function HASH160(buffer: Buffer): Buffer;
/**
* @param buffer to SHA256(SHA256(buffer))
* @param {Buffer} buffer to SHA256(SHA256(buffer))
*/
export declare function dSHA256(buffer: Buffer): Buffer;

@@ -9,3 +9,3 @@ "use strict";

/**
* @param buffer to RIPEMD160(buffer)
* @param {Buffer} buffer to RIPEMD160(buffer)
*/

@@ -17,3 +17,3 @@ function RIPEMD160(buffer) {

/**
* @param buffer to SHA256(buffer)
* @param {Buffer} buffer to SHA256(buffer)
*/

@@ -25,3 +25,3 @@ function SHA256(buffer) {

/**
* @param buffer to RIPEMD160(SHA256(buffer))
* @param {Buffer} buffer to RIPEMD160(SHA256(buffer))
*/

@@ -33,3 +33,3 @@ function HASH160(buffer) {

/**
* @param buffer to SHA256(SHA256(buffer))
* @param {Buffer} buffer to SHA256(SHA256(buffer))
*/

@@ -36,0 +36,0 @@ function dSHA256(buffer) {

@@ -8,24 +8,26 @@ /// <reference types="node" />

}
/**
* @param {string} wifEncoded private key
* @param {number} version network to optionally validate
* @return DecodedWIF
* @throws Error invalid network version if version mismatch
*/
export declare function decode(wifEncoded: string, version?: number): DecodedWIF;
/**
* Get a EllipticPair from WIF encoded private key
*
* @param {string} wifEncoded private key
* @param {number} version network to optionally validate
* @return EllipticPair
* @throws Error invalid network version if version mismatch
*/
export declare function decodeAsEllipticPair(wifEncoded: string, version?: number): EllipticPair;
/**
* @param {number} version network version to encoded WIF with
* @param {Buffer} privKey to encode
* @return {string} encoded WIF
*/
export declare function encode(version: number, privKey: Buffer): string;
export declare const WIF: {
/**
* @param {string} wif private key
* @param {number} [version] network to optionally validate
* @return {DecodedWIF}
* @throws Error invalid network version if version mismatch
*/
decode(wif: string, version?: number | undefined): DecodedWIF;
/**
* @param {number} version network version to encoded WIF with
* @param {Buffer} privKey to encode
* @return {string} encoded WIF
*/
encode(version: number, privKey: Buffer): string;
/**
* Get a EllipticPair from WIF encoded private key
*
* @param {string} wif private key
* @param {number} [version] network to optionally validate
* @return EllipticPair
* @throws Error invalid network version if version mismatch
*/
asEllipticPair(wif: string, version?: number | undefined): EllipticPair;
};
export {};

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.encode = exports.decodeAsEllipticPair = exports.decode = void 0;
exports.WIF = void 0;
const wif_1 = __importDefault(require("wif"));

@@ -13,3 +13,3 @@ const elliptic_1 = require("./elliptic");

* @param {number} version network to optionally validate
* @return DecodedWIF
* @return {DecodedWIF}
* @throws Error invalid network version if version mismatch

@@ -20,3 +20,2 @@ */

}
exports.decode = decode;
/**

@@ -27,3 +26,3 @@ * Get a EllipticPair from WIF encoded private key

* @param {number} version network to optionally validate
* @return EllipticPair
* @return {EllipticPair}
* @throws Error invalid network version if version mismatch

@@ -33,5 +32,4 @@ */

const { privateKey } = decode(wifEncoded, version);
return elliptic_1.getEllipticPairFromPrivateKey(privateKey);
return elliptic_1.Elliptic.fromPrivKey(privateKey);
}
exports.decodeAsEllipticPair = decodeAsEllipticPair;
/**

@@ -45,2 +43,31 @@ * @param {number} version network version to encoded WIF with

}
exports.encode = encode;
exports.WIF = {
/**
* @param {string} wif private key
* @param {number} [version] network to optionally validate
* @return {DecodedWIF}
* @throws Error invalid network version if version mismatch
*/
decode(wif, version) {
return decode(wif, version);
},
/**
* @param {number} version network version to encoded WIF with
* @param {Buffer} privKey to encode
* @return {string} encoded WIF
*/
encode(version, privKey) {
return encode(version, privKey);
},
/**
* Get a EllipticPair from WIF encoded private key
*
* @param {string} wif private key
* @param {number} [version] network to optionally validate
* @return EllipticPair
* @throws Error invalid network version if version mismatch
*/
asEllipticPair(wif, version) {
return decodeAsEllipticPair(wif, version);
}
};
{
"private": false,
"name": "@defichain/jellyfish-crypto",
"version": "0.0.15",
"version": "0.0.16",
"description": "A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance on Bitcoin",

@@ -6,0 +6,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc