@stacks/storage 6.17.0 → 6.17.1-pr.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stacks/storage",
3
- "version": "6.17.0",
3
+ "version": "6.17.1-pr.1+40ab5b98",
4
4
  "description": "Stacks storage library",
5
5
  "license": "MIT",
6
6
  "author": "Hiro Systems PBC (https://hiro.so)",
@@ -20,10 +20,10 @@
20
20
  "typecheck:watch": "npm run typecheck -- --watch"
21
21
  },
22
22
  "dependencies": {
23
- "@stacks/auth": "^6.17.0",
24
- "@stacks/common": "^6.16.0",
25
- "@stacks/encryption": "^6.17.0",
26
- "@stacks/network": "^6.17.0",
23
+ "@stacks/auth": "^6.17.1-pr.1+40ab5b98",
24
+ "@stacks/common": "^6.17.1-pr.1+40ab5b98",
25
+ "@stacks/encryption": "^6.17.1-pr.1+40ab5b98",
26
+ "@stacks/network": "^6.17.1-pr.1+40ab5b98",
27
27
  "base64-js": "^1.5.1",
28
28
  "jsontokens": "^4.0.1"
29
29
  },
@@ -55,5 +55,5 @@
55
55
  "bugs": {
56
56
  "url": "https://github.com/blockstack/blockstack.js/issues"
57
57
  },
58
- "gitHead": "626e1ca12e300838504dc35b32bfae7a0ebfe109"
58
+ "gitHead": "40ab5b98107cd9058e6c78b2aa3ed5c8e26e06a4"
59
59
  }
package/src/hub.ts CHANGED
@@ -9,11 +9,11 @@ import {
9
9
  NotEnoughProofError,
10
10
  PayloadTooLargeError,
11
11
  PreconditionFailedError,
12
+ PRIVATE_KEY_BYTES_COMPRESSED,
12
13
  utf8ToBytes,
13
14
  ValidationError,
14
15
  } from '@stacks/common';
15
16
  import {
16
- compressPrivateKey,
17
17
  ecSign,
18
18
  getPublicKeyFromPrivate,
19
19
  hashSha256Sync,
@@ -21,7 +21,7 @@ import {
21
21
  randomBytes,
22
22
  Signature,
23
23
  } from '@stacks/encryption';
24
- import { createFetchFn, FetchFn } from '@stacks/network';
24
+ import { createFetchFn, FetchFn } from '@stacks/common';
25
25
  import { fromByteArray } from 'base64-js';
26
26
  import { TokenSigner } from 'jsontokens';
27
27
 
@@ -151,7 +151,9 @@ function makeLegacyAuthToken(challengeText: string, signerKeyHex: string): strin
151
151
  }
152
152
  if (parsedChallenge[0] === 'gaiahub' && parsedChallenge[3] === 'blockstack_storage_please_sign') {
153
153
  const digest = hashSha256Sync(utf8ToBytes(challengeText));
154
- const signatureBytes = ecSign(digest, compressPrivateKey(signerKeyHex));
154
+ const compressedPrivateKey =
155
+ signerKeyHex.length === PRIVATE_KEY_BYTES_COMPRESSED * 2 ? signerKeyHex : `${signerKeyHex}01`;
156
+ const signatureBytes = ecSign(digest, compressedPrivateKey);
155
157
  // We only want the DER encoding so use toDERHex provided by @noble/secp256k1
156
158
  const signature = Signature.fromCompact(bytesToHex(signatureBytes)).toDERHex();
157
159
 
package/src/storage.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { lookupProfile, NAME_LOOKUP_PATH, UserSession } from '@stacks/auth';
2
2
  import {
3
- BLOCKSTACK_DEFAULT_GAIA_HUB_URL,
4
3
  DoesNotExist,
4
+ GAIA_URL,
5
5
  GaiaHubError,
6
6
  getGlobalObject,
7
7
  InvalidStateError,
@@ -18,7 +18,7 @@ import {
18
18
  signECDSA,
19
19
  verifyECDSA,
20
20
  } from '@stacks/encryption';
21
- import { createFetchFn, FetchFn } from '@stacks/network';
21
+ import { createFetchFn, FetchFn } from '@stacks/common';
22
22
  import { FileContentLoader } from './fileContentLoader';
23
23
  import {
24
24
  connectToGaiaHub,
@@ -804,7 +804,7 @@ export class Storage {
804
804
  }
805
805
 
806
806
  if (!userData.hubUrl) {
807
- userData.hubUrl = BLOCKSTACK_DEFAULT_GAIA_HUB_URL;
807
+ userData.hubUrl = GAIA_URL;
808
808
  }
809
809
 
810
810
  const gaiaConfig = await connectToGaiaHub(