3.0.0 • Published 7 months ago

get-random-values v3.0.0

Weekly downloads
34,272
License
MIT
Repository
github
Last release
7 months ago

get-random-values

window.crypto.getRandomValues or window.msCrypto.getRandomValues or require('crypto').randomBytes or an Error.

Example

var getRandomValues = require('get-random-values');

var array = new Uint32Array(10);
getRandomValues(array);
// => [
// =>   183,
// =>   76,
// =>   18,
// =>   177,
// =>   73,
// =>   9,
// =>   50,
// =>   248,
// =>   216,
// =>   104
// => ]

Installation

$ npm install get-random-values

API

var getRandomValues = require('get-random-values');

getRandomValues(buf)

Fills integer-based TypedArray buf with cryptographically random numbers. Checks for and uses the first of the following:

  • window.crypto.getRandomValues
  • window.msCrypto.getRandomValues
  • Node.js crypto

If none of the above are available, then an Error is thrown.

Throws QuotaExceededError if buf.length > 65536 (even if Node.js crypto, which doesn't have that limit, is being used).

buf must be a Uint8Array if Node.js crypto is used, otherwise a TypeError will be thrown.

tezster2arisenid-core-testarisenidjs-trial-version2-corearisenidjs-version-two-corekapiltezkateztest1kapilteztest2kapilteztest3kapilkakapilttimikstimiks-cli@infinitebrahmanuniverse/nolb-get-r@getsafle/keyless-transactions-private@everything-registry/sub-chunk-1753@live-change/db@redesblock/mop.jssmc-util@radixdlt/radix-connect-webrtc@rarible/tezos-sdk@onflow/cadence-parsersanity-plugin-gridsanity-plugin-duplicate-array-item@smontero/ppp-idx-client-api@smontero/ppp-client-api@society633/ivalib@lyra/block-tools@lyra/form-builderraiblocks-js@mintlayer/entropy-generator@monokle/validation@mchappell/wallet@nulink_network/nulink-sdk@lemonneko/flow__cadence-parsersepatree@scatterjs/core@sanity/form-builder@scobru/crypto-ipfssourcecred-gitcoin-demosssa-jssportsbet-user-app@wmvm__/nem-library@wishknish/knishio-client-js@traaittplatform/traaittplatform-utilstezstertezos-sdk-module@truffle/core@trrxitte/traaitt-utils@trrxitte/traaittcash-utils@turtlecoin/mnemonics@turtlecoin/utilsreplit-cycles@payvo/sdk-arksecure-random-octetsecure-random-uintscatter-jsscatter-tsscatterjs-corescatterjs-yta-core@team11ingsw/twitter-litezumcoin-utilsstromdao-businessobjecttempkatmp-scatterjs-corefunctional-modelseztz-clifjandin-secure-math-randomget-random-values-esmmoncoin-utilsdbet-channels-backendmulti-tab-threadpoolderogold-utils@eremyjay/web-server@erasure/crypto-ipfs@eridanus-network/clinem-librarynencryptmantaray-jsmeteor-nem-librarygravit-apigscatterjs-corenode-jsencryptnode-jsencrypt-fixnode-laravel-queuenode-myjsencryptdicelangdicom-web-anonymizerdirectus-extension-websocket-subscribenash-utilsnashcash-utilsherenowhuawei-usb-donglehuawei-hilinkcuriositycoin-utilscrypto-shufflekryptokrona-utilshapi-web-monetizationkapil12owallet.js@iflb/ducts
3.0.0

7 months ago

2.1.0

1 year ago

2.0.0

2 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

8 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago