@stacks/storage 4.0.1-beta.1 → 4.0.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/hub.js +2 -4
- package/dist/esm/hub.js.map +1 -1
- package/dist/hub.js +1 -3
- package/dist/hub.js.map +1 -1
- package/dist/polyfill/index.js +4 -5
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +5 -6
- package/src/hub.ts +3 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacks/storage",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2-beta.1",
|
|
4
4
|
"description": "Stacks storage library",
|
|
5
5
|
"author": "yknl <yukanliao@gmail.com>",
|
|
6
6
|
"homepage": "https://blockstack.org",
|
|
@@ -32,10 +32,9 @@
|
|
|
32
32
|
"url": "https://github.com/blockstack/blockstack.js/issues"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@stacks/auth": "^4.0.
|
|
36
|
-
"@stacks/common": "^4.0.
|
|
37
|
-
"@stacks/encryption": "^4.0.
|
|
38
|
-
"bitcoinjs-lib": "^5.2.0",
|
|
35
|
+
"@stacks/auth": "^4.0.0",
|
|
36
|
+
"@stacks/common": "^4.0.2-beta.1",
|
|
37
|
+
"@stacks/encryption": "^4.0.1",
|
|
39
38
|
"jsontokens": "^3.0.0"
|
|
40
39
|
},
|
|
41
40
|
"devDependencies": {
|
|
@@ -62,5 +61,5 @@
|
|
|
62
61
|
"browser": "dist/polyfill/index.js",
|
|
63
62
|
"umd:main": "dist/umd/index.js",
|
|
64
63
|
"unpkg": "dist/umd/index.js",
|
|
65
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "0f65e5b363986e830faaf8050c9b3c7aa30e4924"
|
|
66
65
|
}
|
package/src/hub.ts
CHANGED
|
@@ -19,8 +19,8 @@ import {
|
|
|
19
19
|
hashSha256Sync,
|
|
20
20
|
publicKeyToAddress,
|
|
21
21
|
randomBytes,
|
|
22
|
+
Signature,
|
|
22
23
|
} from '@stacks/encryption';
|
|
23
|
-
import { script, Transaction } from 'bitcoinjs-lib';
|
|
24
24
|
import { TokenSigner } from 'jsontokens';
|
|
25
25
|
|
|
26
26
|
/**
|
|
@@ -151,11 +151,8 @@ function makeLegacyAuthToken(challengeText: string, signerKeyHex: string): strin
|
|
|
151
151
|
if (parsedChallenge[0] === 'gaiahub' && parsedChallenge[3] === 'blockstack_storage_please_sign') {
|
|
152
152
|
const digest = hashSha256Sync(Buffer.from(challengeText));
|
|
153
153
|
const signatureBuffer = ecSign(digest, compressPrivateKey(signerKeyHex));
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
// We only want the DER encoding so remove the sighash version byte at the end.
|
|
157
|
-
// See: https://github.com/bitcoinjs/bitcoinjs-lib/issues/1241#issuecomment-428062912
|
|
158
|
-
const signature = signatureWithHash.toString('hex').slice(0, -2);
|
|
154
|
+
// We only want the DER encoding so use toDERHex provided by @noble/secp256k1
|
|
155
|
+
const signature = Signature.fromCompact(signatureBuffer.toString('hex')).toDERHex();
|
|
159
156
|
|
|
160
157
|
const publickey = getPublicKeyFromPrivate(signerKeyHex);
|
|
161
158
|
const token = Buffer.from(JSON.stringify({ publickey, signature })).toString('base64');
|