Socket
Socket
Sign inDemoInstall

secretkey-encryption

Package Overview
Dependencies
2
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    secretkey-encryption

Encryption for secret keys.


Version published
Weekly downloads
7
Maintainers
1
Created
Weekly downloads
 

Readme

Source

secretkey-encryption

Encryption for secret keys that are generated by NaCl.

The secret key is encrypted by deriving a key from the supplied password using scrypt-async and then using that derived key to encrypt the secret key with TweetNaCl.js's secretbox function.

API

All arrays of bytes are Uint8Arrays.

encryptSecretKey (password, secretKey, [logN], [r])

Arguments

  • password - string or array of bytes
  • secretKey - array of bytes
  • logN (optional) - CPU/memory cost parameter (1 to 31). Defaults to 16.
  • r (optional) - block size parameter. Defaults to 8.
  • callback

Returns a promise, which when successful, resolves with an object containing the following properties

  • encryptedSecretKey - array of bytes
  • salt - 32 random bytes
  • nonce - 24 random bytes
  • logN
  • blockSize

decryptEncryptedSecretKey (password, encryptedSecretKeyBundle)

Arguments

  • password - string or array of bytes
  • encryptedSecretKeyBundle - an object with parameters { encryptedSecretKey, salt, nonce, logN, blockSize }

Returns a promise

  • that on successful decryption of the encrypted key, resolves with the secretKey (as an array of bytes)
  • otherwise is rejected with a message (string)

Keywords

FAQs

Last updated on 05 Jun 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc