JSPM

anacl

1.0.3-1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q30390F
  • License Unlicense

TweetNaCl.js fork for asynchronous PRNGs

Package Exports

  • anacl

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (anacl) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

anacl-js

Build Status

A TweetNaCl.js fork for asynchronous PRNGs.

The following methods which rely on the asynchronous PRNG are changed to return Promise:

  • nacl.randomBytes
  • nacl.box.keyPair
  • nacl.sign.keyPair

The followings are the default PRNGs used, depending on the platform anacl runs on:

  • window.crypto.getRandomValues (WebCrypto standard)
  • window.msCrypto.getRandomValues (Internet Explorer 11)
  • crypto.randomBytes (Node.js)
  • wx.getRandomValues (WeChat)

If the above are not available on the platform you are targeting, and you have a cryptographically-strong source of entropy, you can plug it in like this:

nacl.setPRNG(function(x, n) {
  // ... copy n random bytes into x, synchronously or asynchronously (return a promise) ...
});

Other than the above, check TweetNaCl.js for usage in general.