3.0.0 • Published 2 years ago

get-random-values v3.0.0

Weekly downloads
34,272
License
MIT
Repository
github
Last release
2 years 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-1753wp-saltstempkasportsbet-user-apptezos-sdk-moduletezsterviztercoin-utils@cocalc/util@cagen/x_client@payvo/sdk-arkkapil12tmp-scatterjs-corestromdao-businessobjectsssa-jssourcecred-gitcoin-demoturtlecoin-utilsturtlecoin-mnemonicstproecc_signature_librarytraaitt-utilstraaittplatform-utilstrufflex-core@ardenthq/sdk-ark@ardenthq/sdk-mainsail@avvio-reply/strobfs@badgifter/core@amaterasuomikami/ivalib@cardano-sdk/key-management@chainx/signer-connectoryealinkzentcash-utilszumcoin-utilswasm_exec-tswaves-nodejszjubca-scatterjs-core@findeth/hdnode@live-change/db@lemonneko/flow__cadence-parser@lithium-framework/huid@lyra/block-tools@lyra/form-builder@erasure/crypto-ipfs@eremyjay/web-server@eridanus-network/cli@mintlayer/entropy-generator@mchappell/wallet@monokle/validation@hypha-dao/ppp-client-api@hyper-hyper-space/core@iflb/ducts@iflb/ducts-client@rarible/tezos-sdk@radixdlt/radix-connect-webrtc@sanity/form-builder@scobru/crypto-ipfs@scatterjs/core@redesblock/mop.js@onflow/cadence-parser@nulink_network/nulink-sdk@smontero/ppp-client-api@smontero/ppp-idx-client-api@society633/ivalibmulti-tab-threadpoolmoncoin-utilsmeteor-nem-librarynash-utilsnashcash-utilsorbs-client-sdkpagesigner.jsowallet.jsobscure-utilsscatterjs-yta-corescatter-jsscatter-tsscatterjs-coreseed-passwordersepatreesanity-plugin-gridsanity-plugin-duplicate-array-itemsecure-random-octetsecure-random-uintnode-myjsencryptnode-jsencryptnode-jsencrypt-fixnode-passwordernme-librarynextfit
3.0.0

2 years ago

2.1.0

2 years ago

2.0.0

3 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

9 years ago

1.1.1

11 years ago

1.1.0

11 years ago

1.0.1

11 years ago

1.0.0

11 years ago