Access to a secure random source in a browser. `Math.random` is not acceptable for cryptographic operations. This module exports a consistent interface for modern browsers.
npm install @aws-crypto/random-source-browserAccess to a secure random source in a browser.Math.random is not acceptable for cryptographic operations.
This module exports a consistent interface for modern browsers.
``
import {randomValues, randomValuesOnly} from '@aws-crypto/random-source-browser'
const seedData2 = await randomValues(16);
const seedData1 = await randomValuesOnly(16);
`
Some browsers only implement crypto.getRandomValues and not crypto.subtle.randomValues
If you need to have access to both, you should use . But ifrandomValuesOnly
you want to use some cryptographic fallback like MSRCrypto
is the preferred function.
npm test`