npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sodium-up

v0.4.0

Published

Convenience wrapper around sodium-universal

Downloads

9

Readme

sodium-up

Build Status

Convenience wrapper around sodium-universal

Usage

var sodium = require('sodium-up')

var random = sodium.randombytes_buf(Buffer.allocUnsafe(16))

API

WIP

See sodium-native for complete documentation.

sodium.randombytes_*

var output = sodium.randombytes_buf(output)

output can either be a Buffer or integer length. Will return output

sodium.crypto_sign_*

Constants:

  • sodium.crypto_sign_SEEDBYTES
  • sodium.crypto_sign_PUBLICKEYBYTES
  • sodium.crypto_sign_SECRETKEYBYTES
  • sodium.crypto_sign_BYTES

var {publicKey, secretKey} = crypto_sign_seed_keypair([publicKey, secretKey], seed)

publicKey and secretKey are optional, but can be Buffer or integer length. Defaults to Buffer of sodium.crypto_sign_PUBLICKEYBYTES and sodium.crypto_sign_SECRETKEYBYTES length. Will return and object with {publicKey, secretKey}

var {publicKey, secretKey} = crypto_sign_keypair([publicKey, secretKey])

publicKey and secretKey are optional, but can be Buffer or integer length. Defaults to Buffer of sodium.crypto_sign_PUBLICKEYBYTES and sodium.crypto_sign_SECRETKEYBYTES length. Will return and object with {publicKey, secretKey}

var signedMessage = crypto_sign([signedMessage], message, secretKey)

signedMessage is optional, but can be Buffer or integer length. Defaults to Buffer of sodium.crypto_sign_BYTES length. Will return signedMessage

var boolOrBuf = crypto_sign_open([message], signedMessage, publicKey)

message is optional, but can be Buffer or integer length. Defaults to Buffer of signedMessage.length - sodium.crypto_sign_BYTES length. Will return false if the signature is invalid or message otherwise

var signature = crypto_sign_detached([signature], message, secretKey)

signature is optional, but can be Buffer or integer length. Defaults to Buffer of sodium.crypto_sign_BYTES length. Will return signature

var bool = crypto_sign_verify_detached(signature, message, publicKey)

Alias to sodium-native#crypto_sign_verify_detached

sodium.crypto_generichash_*

Constants:

  • sodium.crypto_generichash_PRIMITIVE
  • sodium.crypto_generichash_BYTES_MIN
  • sodium.crypto_generichash_BYTES_MAX
  • sodium.crypto_generichash_BYTES
  • sodium.crypto_generichash_KEYBYTES_MIN
  • sodium.crypto_generichash_KEYBYTES_MAX
  • sodium.crypto_generichash_KEYBYTES

var output = crypto_generichash([output], input, [key])

output is optional, but can be Buffer or integer length. Defaults to Buffer of sodium.crypto_generichash_BYTES length. Will return output

Examples of input permutations:

sodium.crypto_generichash(input)
sodium.crypto_generichash(input, key)
sodium.crypto_generichash(output, input, null)
sodium.crypto_generichash(null, input, key)
sodium.crypto_generichash(null, input, null)

var instance = crypto_generichash_instance([key], [outputLength])

sodium-native#crypto_generichash_instance wrapped in an object so .update() and .final() can be overridden.

var instance = instance.update(input)

Will return instance for easy chaining

var output = instance.final([output])

output is optional, but can be Buffer of outputLength or longer. Defaults to Buffer of outputLength length. Will return output

sodium.crypto_pwhash_*

Constants:

  • sodium.crypto_pwhash_ALG_DEFAULT
  • sodium.crypto_pwhash_BYTES_MIN
  • sodium.crypto_pwhash_BYTES_MAX
  • sodium.crypto_pwhash_PASSWD_MIN
  • sodium.crypto_pwhash_PASSWD_MAX
  • sodium.crypto_pwhash_SALTBYTES
  • sodium.crypto_pwhash_STRBYTES
  • sodium.crypto_pwhash_STRPREFIX
  • sodium.crypto_pwhash_OPSLIMIT_MIN
  • sodium.crypto_pwhash_OPSLIMIT_MAX
  • sodium.crypto_pwhash_MEMLIMIT_MIN
  • sodium.crypto_pwhash_MEMLIMIT_MAX
  • sodium.crypto_pwhash_OPSLIMIT_INTERACTIVE
  • sodium.crypto_pwhash_MEMLIMIT_INTERACTIVE
  • sodium.crypto_pwhash_OPSLIMIT_MODERATE
  • sodium.crypto_pwhash_MEMLIMIT_MODERATE
  • sodium.crypto_pwhash_OPSLIMIT_SENSITIVE
  • sodium.crypto_pwhash_MEMLIMIT_SENSITIVE
  • sodium.crypto_pwhash_PRIMITIVE

var output = sodium.crypto_pwhash([output], password, salt, opslimit, memlimit, algorithm)

output can either be a Buffer or integer length. Will return output

var output = sodium.crypto_pwhash_str([output], password, opslimit, memlimit)

output is optional, but can be Buffer or integer length. Defaults to Buffer of sodium.crypto_pwhash_STRBYTES length. Will return output

var bool = sodium.crypto_pwhash_str_verify(str, password)

Alias to sodium-native#crypto_pwhash_str_verify

Install

npm install sodium-up

License

ISC