Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stacks/encryption

Package Overview
Dependencies
Maintainers
5
Versions
644
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stacks/encryption - npm Package Compare versions

Comparing version 6.14.1-pr.a4893189.3 to 6.14.1-pr.ecaf4b42.23

1

dist/aesCipher.d.ts

@@ -0,1 +1,2 @@

/// <reference types="node" />
type NodeCryptoCreateCipher = typeof import('crypto').createCipheriv;

@@ -2,0 +3,0 @@ type NodeCryptoCreateDecipher = typeof import('crypto').createDecipheriv;

@@ -0,1 +1,2 @@

/// <reference types="node" />
export declare function isSubtleCryptoAvailable(): boolean;

@@ -2,0 +3,0 @@ export declare function isNodeCryptoAvailable<T>(withFeature: (nodeCrypto: typeof import('crypto')) => boolean | T): false | T;

@@ -0,1 +1,2 @@

/// <reference types="node" />
type NodeCryptoCreateCipher = typeof import('crypto').createCipheriv;

@@ -2,0 +3,0 @@ type NodeCryptoCreateDecipher = typeof import('crypto').createDecipheriv;

@@ -0,1 +1,2 @@

/// <reference types="node" />
export declare function isSubtleCryptoAvailable(): boolean;

@@ -2,0 +3,0 @@ export declare function isNodeCryptoAvailable<T>(withFeature: (nodeCrypto: typeof import('crypto')) => boolean | T): false | T;

9

dist/esm/keys.d.ts

@@ -0,1 +1,2 @@

import { PrivateKey } from '@stacks/common';
export declare function makeECPrivateKey(): string;

@@ -9,5 +10,5 @@ export declare function base58CheckDecode(btcAddress: string): {

export declare function publicKeyToBtcAddress(publicKey: string | Uint8Array, version?: number): string;
export declare function getPublicKeyFromPrivate(privateKey: string | Uint8Array): string;
export declare function ecSign(messageHash: Uint8Array, hexPrivateKey: string | Uint8Array): Uint8Array;
export declare function isValidPrivateKey(privateKey: string | Uint8Array): boolean;
export declare function compressPrivateKey(privateKey: string | Uint8Array): Uint8Array;
export declare function getPublicKeyFromPrivate(privateKey: PrivateKey): string;
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 { bytesToHex, concatBytes, hexToBytes, privateKeyToBytes, PRIVATE_KEY_COMPRESSED_LENGTH, readUInt8, } from '@stacks/common';
import { PRIVATE_KEY_COMPRESSED_LENGTH, bytesToHex, concatBytes, hexToBytes, privateKeyToBytes, readUInt8, } from '@stacks/common';
import base58 from 'bs58';

@@ -50,4 +50,4 @@ import { hashRipemd160 } from './hashRipemd160';

}
export function ecSign(messageHash, hexPrivateKey) {
return signSync(messageHash, privateKeyToBytes(hexPrivateKey).slice(0, 32), {
export function ecSign(messageHash, privateKey) {
return signSync(messageHash, privateKeyToBytes(privateKey).slice(0, 32), {
der: false,

@@ -54,0 +54,0 @@ });

@@ -0,1 +1,2 @@

/// <reference types="node" />
export type Pbkdf2Digests = 'sha512' | 'sha256';

@@ -2,0 +3,0 @@ export interface Pbkdf2 {

@@ -0,1 +1,2 @@

/// <reference types="node" />
type NodeCryptoCreateHash = typeof import('crypto').createHash;

@@ -2,0 +3,0 @@ export interface Sha2Hash {

@@ -0,1 +1,2 @@

import { PrivateKey } from '@stacks/common';
export declare function makeECPrivateKey(): string;

@@ -9,5 +10,5 @@ export declare function base58CheckDecode(btcAddress: string): {

export declare function publicKeyToBtcAddress(publicKey: string | Uint8Array, version?: number): string;
export declare function getPublicKeyFromPrivate(privateKey: string | Uint8Array): string;
export declare function ecSign(messageHash: Uint8Array, hexPrivateKey: string | Uint8Array): Uint8Array;
export declare function isValidPrivateKey(privateKey: string | Uint8Array): boolean;
export declare function compressPrivateKey(privateKey: string | Uint8Array): Uint8Array;
export declare function getPublicKeyFromPrivate(privateKey: PrivateKey): string;
export declare function ecSign(messageHash: Uint8Array, privateKey: PrivateKey): Uint8Array;
export declare function isValidPrivateKey(privateKey: PrivateKey): boolean;
export declare function compressPrivateKey(privateKey: PrivateKey): Uint8Array;

@@ -62,4 +62,4 @@ "use strict";

exports.getPublicKeyFromPrivate = getPublicKeyFromPrivate;
function ecSign(messageHash, hexPrivateKey) {
return (0, secp256k1_1.signSync)(messageHash, (0, common_1.privateKeyToBytes)(hexPrivateKey).slice(0, 32), {
function ecSign(messageHash, privateKey) {
return (0, secp256k1_1.signSync)(messageHash, (0, common_1.privateKeyToBytes)(privateKey).slice(0, 32), {
der: false,

@@ -66,0 +66,0 @@ });

@@ -0,1 +1,2 @@

/// <reference types="node" />
export type Pbkdf2Digests = 'sha512' | 'sha256';

@@ -2,0 +3,0 @@ export interface Pbkdf2 {

@@ -0,1 +1,2 @@

/// <reference types="node" />
type NodeCryptoCreateHash = typeof import('crypto').createHash;

@@ -2,0 +3,0 @@ export interface Sha2Hash {

{
"name": "@stacks/encryption",
"version": "6.14.1-pr.a4893189.3+a4893189",
"version": "6.14.1-pr.ecaf4b42.23+ecaf4b42",
"description": "Encryption utilities for Stacks",

@@ -26,3 +26,3 @@ "license": "MIT",

"@scure/bip39": "1.1.0",
"@stacks/common": "^6.14.1-pr.a4893189.3+a4893189",
"@stacks/common": "^6.14.1-pr.ecaf4b42.23+ecaf4b42",
"@types/node": "^18.0.4",

@@ -36,3 +36,4 @@ "base64-js": "^1.5.1",

"@peculiar/webcrypto": "^1.1.6",
"@stacks/transactions": "^6.14.1-pr.a4893189.3+a4893189",
"@stacks/network": "^6.14.1-pr.ecaf4b42.23+ecaf4b42",
"@stacks/transactions": "^6.14.1-pr.ecaf4b42.23+ecaf4b42",
"@types/bs58check": "^2.1.0",

@@ -72,3 +73,3 @@ "@types/elliptic": "^6.4.12",

},
"gitHead": "a4893189a27769f6c43f46439e6df9312cfa0329"
"gitHead": "ecaf4b42365c5626d4cd7da1a0cf18423783bcac"
}

@@ -5,2 +5,4 @@ import { hmac } from '@noble/hashes/hmac';

import {
PRIVATE_KEY_COMPRESSED_LENGTH,
PrivateKey,
bytesToHex,

@@ -10,3 +12,2 @@ concatBytes,

privateKeyToBytes,
PRIVATE_KEY_COMPRESSED_LENGTH,
readUInt8,

@@ -101,3 +102,3 @@ } from '@stacks/common';

*/
export function getPublicKeyFromPrivate(privateKey: string | Uint8Array): string {
export function getPublicKeyFromPrivate(privateKey: PrivateKey): string {
const privateKeyBytes = privateKeyToBytes(privateKey);

@@ -111,4 +112,4 @@ // for backwards compatibility we always return a compressed public key, regardless of private key mode

*/
export function ecSign(messageHash: Uint8Array, hexPrivateKey: string | Uint8Array) {
return signSync(messageHash, privateKeyToBytes(hexPrivateKey).slice(0, 32), {
export function ecSign(messageHash: Uint8Array, privateKey: PrivateKey) {
return signSync(messageHash, privateKeyToBytes(privateKey).slice(0, 32), {
der: false,

@@ -121,3 +122,3 @@ });

*/
export function isValidPrivateKey(privateKey: string | Uint8Array): boolean {
export function isValidPrivateKey(privateKey: PrivateKey): boolean {
return utils.isValidPrivateKey(privateKeyToBytes(privateKey));

@@ -129,3 +130,3 @@ }

*/
export function compressPrivateKey(privateKey: string | Uint8Array): Uint8Array {
export function compressPrivateKey(privateKey: PrivateKey): Uint8Array {
const privateKeyBytes = privateKeyToBytes(privateKey);

@@ -132,0 +133,0 @@

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 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 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 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 not supported yet

Sorry, the diff of this file is too big to display

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

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