@stacks/encryption
Advanced tools
Comparing version 6.14.1-next.38 to 6.14.1-next.63
@@ -21,3 +21,2 @@ export type CipherTextEncoding = 'hex' | 'base64'; | ||
export declare function hmacSha256(key: Uint8Array, content: Uint8Array): Uint8Array; | ||
export declare function getHexFromBN(bnInput: bigint): string; | ||
export declare function getBytesFromBN(bnInput: bigint): Uint8Array; | ||
@@ -24,0 +23,0 @@ export declare function getCipherObjectWrapper(opts: { |
@@ -100,3 +100,3 @@ "use strict"; | ||
else { | ||
throw new Error('Generated a > 32-byte BN for encryption. Failing.'); | ||
throw new Error('Generated a > 32-byte bigint for encryption. Failing.'); | ||
} | ||
@@ -103,0 +103,0 @@ } |
@@ -21,3 +21,2 @@ export type CipherTextEncoding = 'hex' | 'base64'; | ||
export declare function hmacSha256(key: Uint8Array, content: Uint8Array): Uint8Array; | ||
export declare function getHexFromBN(bnInput: bigint): string; | ||
export declare function getBytesFromBN(bnInput: bigint): Uint8Array; | ||
@@ -24,0 +23,0 @@ export declare function getCipherObjectWrapper(opts: { |
@@ -95,3 +95,3 @@ import { hmac } from '@noble/hashes/hmac'; | ||
else { | ||
throw new Error('Generated a > 32-byte BN for encryption. Failing.'); | ||
throw new Error('Generated a > 32-byte bigint for encryption. Failing.'); | ||
} | ||
@@ -98,0 +98,0 @@ } |
@@ -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-next.38+3d92cc71", | ||
"version": "6.14.1-next.63+95d4e196", | ||
"description": "Encryption utilities for Stacks", | ||
@@ -26,4 +26,3 @@ "license": "MIT", | ||
"@scure/bip39": "1.1.0", | ||
"@stacks/common": "^6.14.1-next.38+3d92cc71", | ||
"@types/node": "^18.0.4", | ||
"@stacks/common": "^6.14.1-next.63+95d4e196", | ||
"base64-js": "^1.5.1", | ||
@@ -36,6 +35,7 @@ "bs58": "^5.0.0", | ||
"@peculiar/webcrypto": "^1.1.6", | ||
"@stacks/network": "^6.14.1-next.38+3d92cc71", | ||
"@stacks/transactions": "^6.14.1-next.38+3d92cc71", | ||
"@stacks/network": "^6.14.1-next.63+95d4e196", | ||
"@stacks/transactions": "^6.14.1-next.63+95d4e196", | ||
"@types/bs58check": "^2.1.0", | ||
"@types/elliptic": "^6.4.12", | ||
"@types/node": "^18.0.4", | ||
"@types/sha.js": "^2.4.0", | ||
@@ -71,3 +71,3 @@ "bitcoinjs-lib": "^5.2.0", | ||
}, | ||
"gitHead": "3d92cc71fbdc199225fd71111e890ac55ae28022" | ||
"gitHead": "95d4e196cce6322c4cf7f2435ebc25a85e320498" | ||
} |
@@ -206,3 +206,3 @@ import { hmac } from '@noble/hashes/hmac'; | ||
* The result string is zero padded and always 64 characters in length. | ||
* @ignore | ||
* @ignore @internal | ||
*/ | ||
@@ -219,3 +219,3 @@ export function getHexFromBN(bnInput: bigint): string { | ||
} else { | ||
throw new Error('Generated a > 32-byte BN for encryption. Failing.'); | ||
throw new Error('Generated a > 32-byte bigint for encryption. Failing.'); | ||
} | ||
@@ -222,0 +222,0 @@ } |
@@ -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 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
8
665222
15
3878
- Removed@types/node@^18.0.4