Socket
Socket
Sign inDemoInstall

wormhole-crypto

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wormhole-crypto - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

44

lib/transform-stream.js

@@ -47,8 +47,32 @@ /* eslint-env browser */

this.reader = readable.getReader()
this.progressMade = false // reset on each pull
this.wrappedController = null
}
async start (controller) {
this.wrappedController = {
enqueue: (value) => {
this.progressMade = true
controller.enqueue(value)
},
error: (reason) => {
this.progressMade = true
if (!(reason instanceof Error)) {
reason = new Error(`stream errored; reason: ${reason}`)
}
controller.error(reason)
this.reader.cancel(reason).catch(() => {})
this.rejectDone(reason)
},
terminate: () => {
this.progressMade = true
controller.close()
this.reader.cancel(new Error('stream terminated')).catch(() => {})
this.resolveDone()
}
}
if (this.transformer.start) {
try {
await this.transformer.start(controller)
await this.transformer.start(this.wrappedController)
} catch (err) {

@@ -62,12 +86,5 @@ this.rejectDone(err)

async pull (controller) {
let enqueued = false
const wrappedController = {
enqueue (d) {
enqueued = true
controller.enqueue(d)
}
}
this.progressMade = false
// eslint-disable-next-line no-unmodified-loop-condition
while (!enqueued) {
while (!this.progressMade) {
try {

@@ -77,3 +94,3 @@ const data = await this.reader.read()

if (this.transformer.flush) {
await this.transformer.flush(controller)
await this.transformer.flush(this.wrappedController)
}

@@ -85,8 +102,9 @@ controller.close()

if (this.transformer.transform) {
await this.transformer.transform(data.value, wrappedController)
await this.transformer.transform(data.value, this.wrappedController)
} else {
wrappedController.enqueue(data.value)
this.wrappedController.enqueue(data.value)
}
} catch (err) {
this.rejectDone(err)
this.reader.cancel(err).catch(() => {})
throw err

@@ -93,0 +111,0 @@ }

{
"name": "wormhole-crypto",
"description": "Streaming encryption for Wormhole.app, based on Encrypted Content-Encoding for HTTP (RFC 8188)",
"version": "0.3.0",
"version": "0.3.1",
"author": {

@@ -6,0 +6,0 @@ "name": "Socket Inc",

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