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@cagen/x_client@payvo/sdk-arkkapil12huawei-hilinkhuawei-usb-donglegscatterjs-coreherenowhapi-web-monetizationmantaray-jskryptokrona-utils@vvv-interactive/nftanvil@wfalcon/cadence-parser@webdollar/node-webdollar@wmvm__/nem-library@truffle/core@trrxitte/traaittcash-utils@trrxitte/traaitt-utils@turtlecoin/mnemonics@turtlecoin/utils@traaittplatform/traaittplatform-utilsastrarachne-ui@cocalc/util@amaterasuomikami/ivalibtmp-scatterjs-corestromdao-businessobjectsssa-jssourcecred-gitcoin-demoturtlecoin-utilsturtlecoin-mnemonicstproecc_signature_librarytraaitt-utilstraaittplatform-utilstrufflex-core@badgifter/core@cardano-sdk/key-management@chainx/signer-connectoryealinkzentcash-utilszumcoin-utilswasm_exec-tswaves-nodejszjubca-scatterjs-core@live-change/db@lemonneko/flow__cadence-parser@lithium-framework/huid@sanity/form-builder@scobru/crypto-ipfs@scatterjs/core@redesblock/mop.jsmulti-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-librarynextfitnencryptnem-librarynem-libraynode-laravel-queue
3.0.0

2 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

10 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