@stacks/encryption
Advanced tools
Comparing version 6.14.1-pr.44 to 6.14.1-pr.64
@@ -12,3 +12,1 @@ import { PrivateKey } from '@stacks/common'; | ||
export declare function ecSign(messageHash: Uint8Array, privateKey: PrivateKey): Uint8Array; | ||
export declare function isValidPrivateKey(privateKey: PrivateKey): boolean; | ||
export declare function compressPrivateKey(privateKey: PrivateKey): Uint8Array; |
import { hmac } from '@noble/hashes/hmac'; | ||
import { sha256 } from '@noble/hashes/sha256'; | ||
import { getPublicKey as nobleGetPublicKey, signSync, utils } from '@noble/secp256k1'; | ||
import { PRIVATE_KEY_COMPRESSED_LENGTH, bytesToHex, concatBytes, hexToBytes, privateKeyToBytes, readUInt8, } from '@stacks/common'; | ||
import { bytesToHex, concatBytes, hexToBytes, privateKeyToBytes, readUInt8, } from '@stacks/common'; | ||
import base58 from 'bs58'; | ||
@@ -55,11 +55,2 @@ import { hashRipemd160 } from './hashRipemd160'; | ||
} | ||
export function isValidPrivateKey(privateKey) { | ||
return utils.isValidPrivateKey(privateKeyToBytes(privateKey)); | ||
} | ||
export function compressPrivateKey(privateKey) { | ||
const privateKeyBytes = privateKeyToBytes(privateKey); | ||
return privateKeyBytes.length == PRIVATE_KEY_COMPRESSED_LENGTH | ||
? privateKeyBytes | ||
: concatBytes(privateKeyBytes, new Uint8Array([1])); | ||
} | ||
//# sourceMappingURL=keys.js.map |
@@ -12,3 +12,1 @@ import { PrivateKey } from '@stacks/common'; | ||
export declare function ecSign(messageHash: Uint8Array, privateKey: PrivateKey): Uint8Array; | ||
export declare function isValidPrivateKey(privateKey: PrivateKey): boolean; | ||
export declare function compressPrivateKey(privateKey: PrivateKey): Uint8Array; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.compressPrivateKey = exports.isValidPrivateKey = exports.ecSign = exports.getPublicKeyFromPrivate = exports.publicKeyToBtcAddress = exports.base58CheckEncode = exports.base58Encode = exports.base58CheckDecode = exports.makeECPrivateKey = void 0; | ||
exports.ecSign = exports.getPublicKeyFromPrivate = exports.publicKeyToBtcAddress = exports.base58CheckEncode = exports.base58Encode = exports.base58CheckDecode = exports.makeECPrivateKey = void 0; | ||
const hmac_1 = require("@noble/hashes/hmac"); | ||
@@ -69,13 +69,2 @@ const sha256_1 = require("@noble/hashes/sha256"); | ||
exports.ecSign = ecSign; | ||
function isValidPrivateKey(privateKey) { | ||
return secp256k1_1.utils.isValidPrivateKey((0, common_1.privateKeyToBytes)(privateKey)); | ||
} | ||
exports.isValidPrivateKey = isValidPrivateKey; | ||
function compressPrivateKey(privateKey) { | ||
const privateKeyBytes = (0, common_1.privateKeyToBytes)(privateKey); | ||
return privateKeyBytes.length == common_1.PRIVATE_KEY_COMPRESSED_LENGTH | ||
? privateKeyBytes | ||
: (0, common_1.concatBytes)(privateKeyBytes, new Uint8Array([1])); | ||
} | ||
exports.compressPrivateKey = compressPrivateKey; | ||
//# sourceMappingURL=keys.js.map |
{ | ||
"name": "@stacks/encryption", | ||
"version": "6.14.1-pr.44+08a1cf37", | ||
"version": "6.14.1-pr.64+bbe6c9a4", | ||
"description": "Encryption utilities for Stacks", | ||
@@ -26,3 +26,3 @@ "license": "MIT", | ||
"@scure/bip39": "1.1.0", | ||
"@stacks/common": "^6.14.1-pr.44+08a1cf37", | ||
"@stacks/common": "^6.14.1-pr.64+bbe6c9a4", | ||
"base64-js": "^1.5.1", | ||
@@ -35,4 +35,4 @@ "bs58": "^5.0.0", | ||
"@peculiar/webcrypto": "^1.1.6", | ||
"@stacks/network": "^6.14.1-pr.44+08a1cf37", | ||
"@stacks/transactions": "^6.14.1-pr.44+08a1cf37", | ||
"@stacks/network": "^6.14.1-pr.64+bbe6c9a4", | ||
"@stacks/transactions": "^6.14.1-pr.64+bbe6c9a4", | ||
"@types/bs58check": "^2.1.0", | ||
@@ -71,3 +71,3 @@ "@types/elliptic": "^6.4.12", | ||
}, | ||
"gitHead": "08a1cf370cc436ac37b859da38786a30646defe1" | ||
"gitHead": "bbe6c9a41ac22d4d98a997634b964408357fa1de" | ||
} |
@@ -5,3 +5,2 @@ import { hmac } from '@noble/hashes/hmac'; | ||
import { | ||
PRIVATE_KEY_COMPRESSED_LENGTH, | ||
PrivateKey, | ||
@@ -115,19 +114,1 @@ bytesToHex, | ||
} | ||
/** | ||
* @ignore | ||
*/ | ||
export function isValidPrivateKey(privateKey: PrivateKey): boolean { | ||
return utils.isValidPrivateKey(privateKeyToBytes(privateKey)); | ||
} | ||
/** | ||
* @ignore | ||
*/ | ||
export function compressPrivateKey(privateKey: PrivateKey): Uint8Array { | ||
const privateKeyBytes = privateKeyToBytes(privateKey); | ||
return privateKeyBytes.length == PRIVATE_KEY_COMPRESSED_LENGTH | ||
? privateKeyBytes // leave compressed | ||
: concatBytes(privateKeyBytes, new Uint8Array([1])); // compress | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
665214
3878
+ Added@types/node@18.19.65(transitive)
- Removed@types/node@18.19.66(transitive)