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

@stacks/storage

Package Overview
Dependencies
Maintainers
0
Versions
657
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stacks/storage - npm Package Compare versions

Comparing version 6.17.0 to 7.0.0-next.70

2

dist/esm/hub.d.ts

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

import { FetchFn } from '@stacks/network';
import { FetchFn } from '@stacks/common';
export declare const BLOCKSTACK_GAIA_HUB_LABEL = "blockstack-gaia-hub-config";

@@ -3,0 +3,0 @@ export interface GaiaHubConfig {

@@ -1,4 +0,4 @@

import { BadPathError, bytesToHex, ConflictError, DoesNotExist, Logger, megabytesToBytes, NotEnoughProofError, PayloadTooLargeError, PreconditionFailedError, utf8ToBytes, ValidationError, } from '@stacks/common';
import { compressPrivateKey, ecSign, getPublicKeyFromPrivate, hashSha256Sync, publicKeyToBtcAddress, randomBytes, Signature, } from '@stacks/encryption';
import { createFetchFn } from '@stacks/network';
import { BadPathError, bytesToHex, ConflictError, DoesNotExist, Logger, megabytesToBytes, NotEnoughProofError, PayloadTooLargeError, PreconditionFailedError, PRIVATE_KEY_BYTES_COMPRESSED, utf8ToBytes, ValidationError, } from '@stacks/common';
import { ecSign, getPublicKeyFromPrivate, hashSha256Sync, publicKeyToBtcAddress, randomBytes, Signature, } from '@stacks/encryption';
import { createFetchFn } from '@stacks/common';
import { fromByteArray } from 'base64-js';

@@ -57,3 +57,4 @@ import { TokenSigner } from 'jsontokens';

const digest = hashSha256Sync(utf8ToBytes(challengeText));
const signatureBytes = ecSign(digest, compressPrivateKey(signerKeyHex));
const compressedPrivateKey = signerKeyHex.length === PRIVATE_KEY_BYTES_COMPRESSED * 2 ? signerKeyHex : `${signerKeyHex}01`;
const signatureBytes = ecSign(digest, compressedPrivateKey);
const signature = Signature.fromCompact(bytesToHex(signatureBytes)).toDERHex();

@@ -60,0 +61,0 @@ const publickey = getPublicKeyFromPrivate(signerKeyHex);

import { UserSession } from '@stacks/auth';
import { EncryptionOptions } from '@stacks/encryption';
import { FetchFn } from '@stacks/network';
import { FetchFn } from '@stacks/common';
import { GaiaHubConfig } from './hub';

@@ -5,0 +5,0 @@ export interface PutFileOptions extends EncryptionOptions {

import { lookupProfile, NAME_LOOKUP_PATH } from '@stacks/auth';
import { BLOCKSTACK_DEFAULT_GAIA_HUB_URL, DoesNotExist, getGlobalObject, InvalidStateError, megabytesToBytes, PayloadTooLargeError, SignatureVerificationError, utf8ToBytes, } from '@stacks/common';
import { DoesNotExist, GAIA_URL, getGlobalObject, InvalidStateError, megabytesToBytes, PayloadTooLargeError, SignatureVerificationError, utf8ToBytes, } from '@stacks/common';
import { eciesGetJsonStringLength, getPublicKeyFromPrivate, publicKeyToBtcAddress, signECDSA, verifyECDSA, } from '@stacks/encryption';
import { createFetchFn } from '@stacks/network';
import { createFetchFn } from '@stacks/common';
import { FileContentLoader } from './fileContentLoader';

@@ -440,3 +440,3 @@ import { connectToGaiaHub, deleteFromGaiaHub, getBlockstackErrorFromResponse, getBucketUrl, getFullReadUrl, uploadToGaiaHub, } from './hub';

if (!userData.hubUrl) {
userData.hubUrl = BLOCKSTACK_DEFAULT_GAIA_HUB_URL;
userData.hubUrl = GAIA_URL;
}

@@ -443,0 +443,0 @@ const gaiaConfig = await connectToGaiaHub(userData.hubUrl, userData.appPrivateKey, userData.gaiaAssociationToken);

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

import { FetchFn } from '@stacks/network';
import { FetchFn } from '@stacks/common';
export declare const BLOCKSTACK_GAIA_HUB_LABEL = "blockstack-gaia-hub-config";

@@ -3,0 +3,0 @@ export interface GaiaHubConfig {

@@ -6,7 +6,7 @@ "use strict";

const encryption_1 = require("@stacks/encryption");
const network_1 = require("@stacks/network");
const common_2 = require("@stacks/common");
const base64_js_1 = require("base64-js");
const jsontokens_1 = require("jsontokens");
exports.BLOCKSTACK_GAIA_HUB_LABEL = 'blockstack-gaia-hub-config';
async function uploadToGaiaHub(filename, contents, hubConfig, contentType = 'application/octet-stream', newFile = true, etag, dangerouslyIgnoreEtag, fetchFn = (0, network_1.createFetchFn)()) {
async function uploadToGaiaHub(filename, contents, hubConfig, contentType = 'application/octet-stream', newFile = true, etag, dangerouslyIgnoreEtag, fetchFn = (0, common_2.createFetchFn)()) {
common_1.Logger.debug(`uploadToGaiaHub: uploading ${filename} to ${hubConfig.server}`);

@@ -37,3 +37,3 @@ const headers = {

exports.uploadToGaiaHub = uploadToGaiaHub;
async function deleteFromGaiaHub(filename, hubConfig, fetchFn = (0, network_1.createFetchFn)()) {
async function deleteFromGaiaHub(filename, hubConfig, fetchFn = (0, common_2.createFetchFn)()) {
common_1.Logger.debug(`deleteFromGaiaHub: deleting ${filename} from ${hubConfig.server}`);

@@ -65,3 +65,4 @@ const response = await fetchFn(`${hubConfig.server}/delete/${hubConfig.address}/${filename}`, {

const digest = (0, encryption_1.hashSha256Sync)((0, common_1.utf8ToBytes)(challengeText));
const signatureBytes = (0, encryption_1.ecSign)(digest, (0, encryption_1.compressPrivateKey)(signerKeyHex));
const compressedPrivateKey = signerKeyHex.length === common_1.PRIVATE_KEY_BYTES_COMPRESSED * 2 ? signerKeyHex : `${signerKeyHex}01`;
const signatureBytes = (0, encryption_1.ecSign)(digest, compressedPrivateKey);
const signature = encryption_1.Signature.fromCompact((0, common_1.bytesToHex)(signatureBytes)).toDERHex();

@@ -92,3 +93,3 @@ const publickey = (0, encryption_1.getPublicKeyFromPrivate)(signerKeyHex);

}
async function connectToGaiaHub(gaiaHubUrl, challengeSignerHex, associationToken, fetchFn = (0, network_1.createFetchFn)()) {
async function connectToGaiaHub(gaiaHubUrl, challengeSignerHex, associationToken, fetchFn = (0, common_2.createFetchFn)()) {
common_1.Logger.debug(`connectToGaiaHub: ${gaiaHubUrl}/hub_info`);

@@ -109,3 +110,3 @@ const response = await fetchFn(`${gaiaHubUrl}/hub_info`);

exports.connectToGaiaHub = connectToGaiaHub;
async function getBucketUrl(gaiaHubUrl, appPrivateKey, fetchFn = (0, network_1.createFetchFn)()) {
async function getBucketUrl(gaiaHubUrl, appPrivateKey, fetchFn = (0, common_2.createFetchFn)()) {
const response = await fetchFn(`${gaiaHubUrl}/hub_info`);

@@ -112,0 +113,0 @@ const responseText = await response.text();

import { UserSession } from '@stacks/auth';
import { EncryptionOptions } from '@stacks/encryption';
import { FetchFn } from '@stacks/network';
import { FetchFn } from '@stacks/common';
import { GaiaHubConfig } from './hub';

@@ -5,0 +5,0 @@ export interface PutFileOptions extends EncryptionOptions {

@@ -7,3 +7,3 @@ "use strict";

const encryption_1 = require("@stacks/encryption");
const network_1 = require("@stacks/network");
const common_2 = require("@stacks/common");
const fileContentLoader_1 = require("./fileContentLoader");

@@ -104,3 +104,3 @@ const hub_1 = require("./hub");

}
async getFileContents(path, app, username, zoneFileLookupURL, forceText, fetchFn = (0, network_1.createFetchFn)()) {
async getFileContents(path, app, username, zoneFileLookupURL, forceText, fetchFn = (0, common_2.createFetchFn)()) {
const opts = { app, username, zoneFileLookupURL };

@@ -371,3 +371,3 @@ const readUrl = await this.getFileUrl(path, opts);

}
async listFilesLoop(hubConfig, page, callCount, fileCount, callback, fetchFn = (0, network_1.createFetchFn)()) {
async listFilesLoop(hubConfig, page, callCount, fileCount, callback, fetchFn = (0, common_2.createFetchFn)()) {
if (callCount > 65536) {

@@ -446,3 +446,3 @@ throw new Error('Too many entries to list');

if (!userData.hubUrl) {
userData.hubUrl = common_1.BLOCKSTACK_DEFAULT_GAIA_HUB_URL;
userData.hubUrl = common_1.GAIA_URL;
}

@@ -449,0 +449,0 @@ const gaiaConfig = await (0, hub_1.connectToGaiaHub)(userData.hubUrl, userData.appPrivateKey, userData.gaiaAssociationToken);

{
"name": "@stacks/storage",
"version": "6.17.0",
"version": "7.0.0-next.70+0adf46c4",
"description": "Stacks storage library",

@@ -23,6 +23,6 @@ "license": "MIT",

"dependencies": {
"@stacks/auth": "^6.17.0",
"@stacks/common": "^6.16.0",
"@stacks/encryption": "^6.17.0",
"@stacks/network": "^6.17.0",
"@stacks/auth": "^7.0.0-next.70+0adf46c4",
"@stacks/common": "^7.0.0-next.70+0adf46c4",
"@stacks/encryption": "^7.0.0-next.70+0adf46c4",
"@stacks/network": "^7.0.0-next.70+0adf46c4",
"base64-js": "^1.5.1",

@@ -59,3 +59,3 @@ "jsontokens": "^4.0.1"

},
"gitHead": "626e1ca12e300838504dc35b32bfae7a0ebfe109"
"gitHead": "0adf46c4eadac85f234140dc2df0e5d06b0ca775"
}

@@ -12,2 +12,3 @@ import {

PreconditionFailedError,
PRIVATE_KEY_BYTES_COMPRESSED,
utf8ToBytes,

@@ -17,3 +18,2 @@ ValidationError,

import {
compressPrivateKey,
ecSign,

@@ -26,3 +26,3 @@ getPublicKeyFromPrivate,

} from '@stacks/encryption';
import { createFetchFn, FetchFn } from '@stacks/network';
import { createFetchFn, FetchFn } from '@stacks/common';
import { fromByteArray } from 'base64-js';

@@ -157,3 +157,5 @@ import { TokenSigner } from 'jsontokens';

const digest = hashSha256Sync(utf8ToBytes(challengeText));
const signatureBytes = ecSign(digest, compressPrivateKey(signerKeyHex));
const compressedPrivateKey =
signerKeyHex.length === PRIVATE_KEY_BYTES_COMPRESSED * 2 ? signerKeyHex : `${signerKeyHex}01`;
const signatureBytes = ecSign(digest, compressedPrivateKey);
// We only want the DER encoding so use toDERHex provided by @noble/secp256k1

@@ -160,0 +162,0 @@ const signature = Signature.fromCompact(bytesToHex(signatureBytes)).toDERHex();

import { lookupProfile, NAME_LOOKUP_PATH, UserSession } from '@stacks/auth';
import {
BLOCKSTACK_DEFAULT_GAIA_HUB_URL,
DoesNotExist,
GAIA_URL,
GaiaHubError,

@@ -21,3 +21,3 @@ getGlobalObject,

} from '@stacks/encryption';
import { createFetchFn, FetchFn } from '@stacks/network';
import { createFetchFn, FetchFn } from '@stacks/common';
import { FileContentLoader } from './fileContentLoader';

@@ -808,3 +808,3 @@ import {

if (!userData.hubUrl) {
userData.hubUrl = BLOCKSTACK_DEFAULT_GAIA_HUB_URL;
userData.hubUrl = GAIA_URL;
}

@@ -811,0 +811,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 too big to display

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