UNPKG

@aws-amplify/auth

Version:
19 lines (16 loc) 591 B
import { WordArray } from '@aws-amplify/core/internals/utils'; import { getBytesFromHex } from './getBytesFromHex.mjs'; // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 /** * Returns a Uint8Array with a sequence of random nBytes * * @param {number} nBytes * @returns {Uint8Array} fixed-length sequence of random bytes */ const getRandomBytes = (nBytes) => { const str = new WordArray().random(nBytes).toString(); return getBytesFromHex(str); }; export { getRandomBytes }; //# sourceMappingURL=getRandomBytes.mjs.map