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

hyperdrive

Package Overview
Dependencies
Maintainers
5
Versions
273
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperdrive - npm Package Compare versions

Comparing version 11.6.3 to 11.7.0

41

index.js

@@ -10,2 +10,4 @@ const Hyperbee = require('hyperbee')

const safetyCatch = require('safety-catch')
const crypto = require('hypercore-crypto')
const Hypercore = require('hypercore')
const { BLOCK_NOT_AVAILABLE } = require('hypercore-errors')

@@ -15,2 +17,4 @@

const [BLOBS] = crypto.namespace('hyperdrive', 1)
module.exports = class Hyperdrive extends ReadyResource {

@@ -44,2 +48,23 @@ constructor (corestore, key, opts = {}) {

_generateBlobsManifest () {
const m = this.db.core.manifest
if (m.version < 1 || this.db.core.core.compat) return null
const signers = []
for (const s of m.signers) {
const namespace = crypto.hash([BLOBS, this.core.key, s.namespace])
signers.push({ ...s, namespace })
}
return {
version: m.version,
hash: 'blake2b',
allowPatch: m.allowPatch,
quorum: m.quorum,
signers,
prologue: null // TODO: could be configurable through the header still...
}
}
get id () {

@@ -132,3 +157,4 @@ return this.core.id

const blobsKey = header.metadata && header.metadata.contentFeed.subarray(0, 32)
const contentKey = header.metadata && header.metadata.contentFeed && header.metadata.contentFeed.subarray(0, 32)
const blobsKey = contentKey || Hypercore.key(this._generateBlobsManifest())
if (!blobsKey || blobsKey.length < 32) throw new Error('Invalid or no Blob store key set')

@@ -140,3 +166,4 @@

onwait: this._onwait,
encryptionKey: this.encryptionKey
encryptionKey: this.encryptionKey,
keyPair: (!contentKey && this.db.core.writable) ? this.db.core.keyPair : null
})

@@ -168,8 +195,11 @@ await blobsCore.ready()

if (this.db.core.writable && !this.blobs) {
const m = this._generateBlobsManifest()
const blobsCore = this.corestore.get({
name: this.db.core.id + '/blobs', // simple trick to avoid blobs clashing if no namespace is provided...
manifest: m,
name: m ? null : this.db.core.id + '/blobs', // simple trick to avoid blobs clashing if no namespace is provided...
cache: false,
onwait: this._onwait,
encryptionKey: this.encryptionKey,
compat: this.db.core.core.compat
compat: this.db.core.core.compat,
keyPair: (m && this.db.core.writable) ? this.db.core.keyPair : null
})

@@ -179,4 +209,5 @@ await blobsCore.ready()

this.blobs = new Hyperblobs(blobsCore)
getBee(this.db).metadata.contentFeed = this.blobs.core.key
if (!m) getBee(this.db).metadata.contentFeed = this.blobs.core.key
this.emit('blobs', this.blobs)

@@ -183,0 +214,0 @@ this.emit('content-key', blobsCore.key)

5

package.json
{
"name": "hyperdrive",
"version": "11.6.3",
"version": "11.7.0",
"description": "Hyperdrive is a secure, real-time distributed file system",

@@ -26,2 +26,3 @@ "main": "index.js",

"hyperblobs": "^2.3.0",
"hypercore": "^10.33.0",
"hypercore-errors": "^1.0.0",

@@ -40,3 +41,3 @@ "is-options": "^1.0.2",

"corestore": "^6.8.1",
"hypercore-crypto": "^3.2.1",
"hypercore-crypto": "^3.4.0",
"hyperdht": "^6.6.0",

@@ -43,0 +44,0 @@ "hyperswarm": "^4.0.0",

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