@stacks/storage
Advanced tools
Comparing version 4.0.1 to 4.0.2-beta.0
import { BadPathError, Buffer, ConflictError, DoesNotExist, fetchPrivate, Logger, megabytesToBytes, NotEnoughProofError, PayloadTooLargeError, PreconditionFailedError, ValidationError, } from '@stacks/common'; | ||
import { compressPrivateKey, ecSign, getPublicKeyFromPrivate, hashSha256Sync, publicKeyToAddress, randomBytes, } from '@stacks/encryption'; | ||
import { script, Transaction } from 'bitcoinjs-lib'; | ||
import { compressPrivateKey, ecSign, getPublicKeyFromPrivate, hashSha256Sync, publicKeyToAddress, randomBytes, Signature, } from '@stacks/encryption'; | ||
import { TokenSigner } from 'jsontokens'; | ||
@@ -57,4 +56,3 @@ export const BLOCKSTACK_GAIA_HUB_LABEL = 'blockstack-gaia-hub-config'; | ||
const signatureBuffer = ecSign(digest, compressPrivateKey(signerKeyHex)); | ||
const signatureWithHash = script.signature.encode(signatureBuffer, Transaction.SIGHASH_NONE); | ||
const signature = signatureWithHash.toString('hex').slice(0, -2); | ||
const signature = Signature.fromCompact(signatureBuffer.toString('hex')).toDERHex(); | ||
const publickey = getPublicKeyFromPrivate(signerKeyHex); | ||
@@ -61,0 +59,0 @@ const token = Buffer.from(JSON.stringify({ publickey, signature })).toString('base64'); |
@@ -6,3 +6,2 @@ "use strict"; | ||
const encryption_1 = require("@stacks/encryption"); | ||
const bitcoinjs_lib_1 = require("bitcoinjs-lib"); | ||
const jsontokens_1 = require("jsontokens"); | ||
@@ -64,4 +63,3 @@ exports.BLOCKSTACK_GAIA_HUB_LABEL = 'blockstack-gaia-hub-config'; | ||
const signatureBuffer = (0, encryption_1.ecSign)(digest, (0, encryption_1.compressPrivateKey)(signerKeyHex)); | ||
const signatureWithHash = bitcoinjs_lib_1.script.signature.encode(signatureBuffer, bitcoinjs_lib_1.Transaction.SIGHASH_NONE); | ||
const signature = signatureWithHash.toString('hex').slice(0, -2); | ||
const signature = encryption_1.Signature.fromCompact(signatureBuffer.toString('hex')).toDERHex(); | ||
const publickey = (0, encryption_1.getPublicKeyFromPrivate)(signerKeyHex); | ||
@@ -68,0 +66,0 @@ const token = common_1.Buffer.from(JSON.stringify({ publickey, signature })).toString('base64'); |
{ | ||
"name": "@stacks/storage", | ||
"version": "4.0.1", | ||
"version": "4.0.2-beta.0", | ||
"description": "Stacks storage library", | ||
@@ -35,6 +35,5 @@ "author": "yknl <yukanliao@gmail.com>", | ||
"dependencies": { | ||
"@stacks/auth": "^4.0.0", | ||
"@stacks/auth": "^4.0.2-beta.0", | ||
"@stacks/common": "^4.0.1", | ||
"@stacks/encryption": "^4.0.1", | ||
"bitcoinjs-lib": "^5.2.0", | ||
"@stacks/encryption": "^4.0.2-beta.0", | ||
"jsontokens": "^3.0.0" | ||
@@ -66,3 +65,3 @@ }, | ||
"unpkg": "dist/umd/index.js", | ||
"gitHead": "2add622be6429d5d73559af12872eab0fb66b996" | ||
"gitHead": "f578a0d9f8e7afe9836c2ad48acd34951e30cf7d" | ||
} |
@@ -22,4 +22,4 @@ import { | ||
randomBytes, | ||
Signature, | ||
} from '@stacks/encryption'; | ||
import { script, Transaction } from 'bitcoinjs-lib'; | ||
import { TokenSigner } from 'jsontokens'; | ||
@@ -155,8 +155,5 @@ | ||
const signatureBuffer = ecSign(digest, compressPrivateKey(signerKeyHex)); | ||
const signatureWithHash = script.signature.encode(signatureBuffer, Transaction.SIGHASH_NONE); | ||
// We only want the DER encoding so use toDERHex provided by @noble/secp256k1 | ||
const signature = Signature.fromCompact(signatureBuffer.toString('hex')).toDERHex(); | ||
// We only want the DER encoding so remove the sighash version byte at the end. | ||
// See: https://github.com/bitcoinjs/bitcoinjs-lib/issues/1241#issuecomment-428062912 | ||
const signature = signatureWithHash.toString('hex').slice(0, -2); | ||
const publickey = getPublicKeyFromPrivate(signerKeyHex); | ||
@@ -163,0 +160,0 @@ const token = Buffer.from(JSON.stringify({ publickey, signature })).toString('base64'); |
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 too big to display
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
4
2942746
7102
1
+ Added@types/node@18.19.75(transitive)
- Removedbitcoinjs-lib@^5.2.0
- Removed@types/node@10.12.1818.19.74(transitive)
- Removedbech32@1.1.4(transitive)
- Removedbindings@1.5.0(transitive)
- Removedbip174@2.1.1(transitive)
- Removedbip32@2.0.6(transitive)
- Removedbip66@1.1.5(transitive)
- Removedbitcoin-ops@1.4.1(transitive)
- Removedbitcoinjs-lib@5.2.0(transitive)
- Removedbn.js@4.12.1(transitive)
- Removedbrorand@1.1.0(transitive)
- Removedbs58@4.0.1(transitive)
- Removedbs58check@2.1.2(transitive)
- Removedcipher-base@1.0.6(transitive)
- Removedcreate-hash@1.2.0(transitive)
- Removedcreate-hmac@1.1.7(transitive)
- Removedelliptic@6.6.1(transitive)
- Removedfile-uri-to-path@1.0.0(transitive)
- Removedhash-base@3.1.0(transitive)
- Removedhash.js@1.1.7(transitive)
- Removedhmac-drbg@1.0.1(transitive)
- Removedmd5.js@1.3.5(transitive)
- Removedmerkle-lib@2.0.10(transitive)
- Removedminimalistic-assert@1.0.1(transitive)
- Removedminimalistic-crypto-utils@1.0.1(transitive)
- Removednan@2.22.0(transitive)
- Removedpushdata-bitcoin@1.0.1(transitive)
- Removedrandombytes@2.1.0(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedripemd160@2.0.2(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedtiny-secp256k1@1.1.7(transitive)
- Removedtypeforce@1.18.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedwif@2.0.6(transitive)
Updated@stacks/auth@^4.0.2-beta.0