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

@transcend-io/penumbra

Package Overview
Dependencies
Maintainers
6
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@transcend-io/penumbra

Crypto streams for the browser.

  • 1.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.8K
increased by33.55%
Maintainers
6
Weekly downloads
 
Created
Source

Usage

Display an encrypted file

// Decrypt and display text
getDecryptedContent(fileUrl, key, iv, authTag, 'text/plain')
  .then(decryptedText => {
    document.getElementById('my-paragraph').innerText = decryptedText;
  });

// Decrypt and display media
getDecryptedContent(url, key, iv, authTag, 'image/jpeg')
  .then(imageSrc => {
    document.getElementById('my-img').src = imageSrc;
  });

Download an encrypted file

downloadEncryptedFile(
  `https://s3-us-west-2.amazonaws.com/bencmbrook/africa.topo.json.enc`,
  key,
  iv,
  authTag,
  {
    fileName: 'myFile.json', // optional values
    progressEventName: 'download-progress' // defaults to the url
  }
);

Download Progress Event Emitter

You can listen to a download progress event. The event type is the same as the url parameter

window.addEventListener(url, e => {
  console.log(`${e.detail}% done`);
});

Note: this feature requires the Content-Length response header to be exposed. This works by adding Access-Control-Expose-Headers: Content-Length to the response header (read more here and here)

On Amazon S3, this means adding the following line to your bucket policy, inside the <CORSRule> block:

<ExposeHeader>Content-Length</ExposeHeader>

Keywords

FAQs

Package last updated on 03 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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