Socket
Book a DemoInstallSign in
Socket

seco-rw

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

seco-rw

A handy wrapper for reading/writing [secure containers](https://github.com/ExodusMovement/secure-container). Caches the file's `blobKey` & `metadata` to avoid expensive scrypt operations.

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
2
Created
Source

seco-rw

A handy wrapper for reading/writing secure containers. Caches the file's blobKey & metadata to avoid expensive scrypt operations.

Usage

import createSecoRW from 'seco-rw'

const somefile = createSecoRW('somefile.seco', 'opensesame', {
  appName: 'Exodus',
  appVersion: '1.0.0'
})

await somefile.write('Hello World!')
await somefile.read().toString('utf8')
// -> Hello World!

createSecoRW(file, passphrase, header)

  • file (String) Path to the secure-container
  • passphrase (String | Buffer) Passphrase for the secure-container
  • header (Object) Data to write to the secure-container header
    • appName (String) Name of your app
    • appVersion (String) Your app's version number

write(data)

  • data (String | Buffer) Data to write to the file

Returns a Promise that resolves when the file has been written.

read()

Returns a Promise, resolving to a Buffer of the file data.

destroy()

Destroys the instance and zero-fills the internal cache buffer. Future calls to read() or write() will error out.

If you are using a Buffer passphrase, you may also want to call .fill(0) to zero-fill that too.

License

MIT

FAQs

Package last updated on 29 Mar 2017

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