@aws-amplify/auth
Version:
Auth category of aws-amplify
21 lines (19 loc) • 742 B
JavaScript
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRandomBytes = void 0;
const utils_1 = require("@aws-amplify/core/internals/utils");
const getBytesFromHex_1 = require("./getBytesFromHex");
/**
* 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 utils_1.WordArray().random(nBytes).toString();
return (0, getBytesFromHex_1.getBytesFromHex)(str);
};
exports.getRandomBytes = getRandomBytes;
//# sourceMappingURL=getRandomBytes.js.map
;