@stacks/storage 4.3.9-pr.5a56f1a.0 → 4.3.9-pr.8b59774.0
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 +3 -3
- package/dist/esm/hub.js.map +1 -1
- package/dist/esm/storage.js +3 -3
- package/dist/esm/storage.js.map +1 -1
- package/dist/hub.js +2 -2
- package/dist/hub.js.map +1 -1
- package/dist/storage.js +2 -2
- package/dist/storage.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +6 -6
- package/src/hub.ts +3 -3
- package/src/storage.ts +2 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacks/storage",
|
|
3
|
-
"version": "4.3.9-pr.
|
|
3
|
+
"version": "4.3.9-pr.8b59774.0",
|
|
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": "^4.3.9-pr.
|
|
24
|
-
"@stacks/common": "^4.3.9-pr.
|
|
25
|
-
"@stacks/encryption": "^4.3.9-pr.
|
|
26
|
-
"@stacks/network": "^4.3.9-pr.
|
|
23
|
+
"@stacks/auth": "^4.3.9-pr.8b59774.0",
|
|
24
|
+
"@stacks/common": "^4.3.9-pr.8b59774.0",
|
|
25
|
+
"@stacks/encryption": "^4.3.9-pr.8b59774.0",
|
|
26
|
+
"@stacks/network": "^4.3.9-pr.8b59774.0",
|
|
27
27
|
"base64-js": "^1.5.1",
|
|
28
28
|
"jsontokens": "^4.0.1"
|
|
29
29
|
},
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"bugs": {
|
|
61
61
|
"url": "https://github.com/blockstack/blockstack.js/issues"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "8b59774bd6f35e52cafba48d6c3c6eb7d96dfa82"
|
|
64
64
|
}
|
package/src/hub.ts
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
ecSign,
|
|
18
18
|
getPublicKeyFromPrivate,
|
|
19
19
|
hashSha256Sync,
|
|
20
|
-
|
|
20
|
+
publicKeyToBtcAddress,
|
|
21
21
|
randomBytes,
|
|
22
22
|
Signature,
|
|
23
23
|
} from '@stacks/encryption';
|
|
@@ -215,7 +215,7 @@ export async function connectToGaiaHub(
|
|
|
215
215
|
const hubInfo = await response.json();
|
|
216
216
|
const readURL = hubInfo.read_url_prefix;
|
|
217
217
|
const token = makeV1GaiaAuthToken(hubInfo, challengeSignerHex, gaiaHubUrl, associationToken);
|
|
218
|
-
const address =
|
|
218
|
+
const address = publicKeyToBtcAddress(getPublicKeyFromPrivate(challengeSignerHex));
|
|
219
219
|
return {
|
|
220
220
|
url_prefix: readURL,
|
|
221
221
|
max_file_upload_size_megabytes: hubInfo.max_file_upload_size_megabytes,
|
|
@@ -241,7 +241,7 @@ export async function getBucketUrl(
|
|
|
241
241
|
const responseText = await response.text();
|
|
242
242
|
const responseJSON = JSON.parse(responseText);
|
|
243
243
|
const readURL = responseJSON.read_url_prefix;
|
|
244
|
-
const address =
|
|
244
|
+
const address = publicKeyToBtcAddress(getPublicKeyFromPrivate(appPrivateKey));
|
|
245
245
|
const bucketUrl = `${readURL}${address}/`;
|
|
246
246
|
return bucketUrl;
|
|
247
247
|
}
|
package/src/storage.ts
CHANGED
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
eciesGetJsonStringLength,
|
|
15
15
|
EncryptionOptions,
|
|
16
16
|
getPublicKeyFromPrivate,
|
|
17
|
-
publicKeyToAddress,
|
|
18
17
|
publicKeyToBtcAddress,
|
|
19
18
|
signECDSA,
|
|
20
19
|
verifyECDSA,
|
|
@@ -349,7 +348,7 @@ export class Storage {
|
|
|
349
348
|
);
|
|
350
349
|
throw err;
|
|
351
350
|
}
|
|
352
|
-
const signerAddress =
|
|
351
|
+
const signerAddress = publicKeyToBtcAddress(publicKey);
|
|
353
352
|
if (gaiaAddress !== signerAddress)
|
|
354
353
|
throw new SignatureVerificationError(
|
|
355
354
|
`Signer pubkey address (${signerAddress}) doesn't match gaia address (${gaiaAddress})`
|
|
@@ -421,7 +420,7 @@ export class Storage {
|
|
|
421
420
|
const signature = sigObject.signature;
|
|
422
421
|
const signerPublicKey = sigObject.publicKey;
|
|
423
422
|
const cipherText = sigObject.cipherText;
|
|
424
|
-
const signerAddress =
|
|
423
|
+
const signerAddress = publicKeyToBtcAddress(signerPublicKey);
|
|
425
424
|
|
|
426
425
|
if (!signerPublicKey || !cipherText || !signature) {
|
|
427
426
|
throw new SignatureVerificationError(
|