diff --git a/README.md b/README.md index b0a6cab..907697f 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,7 @@ The sync version is NOT RECOMMENDED since it won't use workers and thus it
Promise.<(Buffer|Uint8Array)>
Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
+Since version 3.0.0 this is an async function and a new randBitsSync function has been added. If you are migrating from version 2 call randBitsSync instead.
Buffer
| Uint8Array
Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
@@ -363,8 +364,11 @@ Returns a cryptographically secure random integer between [min,max] ### randBits(bitLength, [forceLength]) ⇒Promise.<(Buffer\|Uint8Array)>
Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
+Since version 3.0.0 this is an async function and a new randBitsSync function has been added. If you are migrating from version 2 call randBitsSync instead.
+
**Kind**: global function
**Returns**: Promise.<(Buffer\|Uint8Array)>
- A Promise that resolves to a Buffer/UInt8Array (Node.js/Browser) filled with cryptographically secure random bits
+**Since**: 3.0.0
| Param | Type | Default | Description |
| --- | --- | --- | --- |
@@ -378,6 +382,7 @@ Secure random bits for both node and browsers. Node version uses crypto.randomFi
**Kind**: global function
**Returns**: Buffer
\| Uint8Array
- A Buffer/UInt8Array (Node.js/Browser) filled with cryptographically secure random bits
+**Since**: 3.0.0
| Param | Type | Default | Description |
| --- | --- | --- | --- |
diff --git a/lib/index.browser.bundle.mod.js b/lib/index.browser.bundle.mod.js
index 8a40d9a..049ab72 100644
--- a/lib/index.browser.bundle.mod.js
+++ b/lib/index.browser.bundle.mod.js
@@ -348,6 +348,8 @@ function randBetween (max, min = 1n) {
/**
* Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
*
+ * Since version 3.0.0 this is an async function and a new randBitsSync function has been added. If you are migrating from version 2 call randBitsSync instead.
+ * @since 3.0.0
* @param {number} bitLength The desired number of random bits
* @param {boolean} [forceLength = false] If we want to force the output to have a specific bit length. It basically forces the msb to be 1
*
@@ -375,7 +377,7 @@ async function randBits (bitLength, forceLength = false) {
/**
* Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
- *
+ * @since 3.0.0
* @param {number} bitLength The desired number of random bits
* @param {boolean} [forceLength = false] If we want to force the output to have a specific bit length. It basically forces the msb to be 1
*
diff --git a/lib/index.browser.mod.js b/lib/index.browser.mod.js
index 869e4e7..babab63 100644
--- a/lib/index.browser.mod.js
+++ b/lib/index.browser.mod.js
@@ -140,6 +140,8 @@ function randBetween (max, min = 1n) {
/**
* Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
*
+ * Since version 3.0.0 this is an async function and a new randBitsSync function has been added. If you are migrating from version 2 call randBitsSync instead.
+ * @since 3.0.0
* @param {number} bitLength The desired number of random bits
* @param {boolean} [forceLength = false] If we want to force the output to have a specific bit length. It basically forces the msb to be 1
*
@@ -167,7 +169,7 @@ async function randBits (bitLength, forceLength = false) {
/**
* Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
- *
+ * @since 3.0.0
* @param {number} bitLength The desired number of random bits
* @param {boolean} [forceLength = false] If we want to force the output to have a specific bit length. It basically forces the msb to be 1
*
diff --git a/lib/index.node.js b/lib/index.node.js
index 7de794d..f5331ae 100644
--- a/lib/index.node.js
+++ b/lib/index.node.js
@@ -158,6 +158,8 @@ function randBetween (max, min = 1n) {
/**
* Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
*
+ * Since version 3.0.0 this is an async function and a new randBitsSync function has been added. If you are migrating from version 2 call randBitsSync instead.
+ * @since 3.0.0
* @param {number} bitLength The desired number of random bits
* @param {boolean} [forceLength = false] If we want to force the output to have a specific bit length. It basically forces the msb to be 1
*
@@ -185,7 +187,7 @@ async function randBits (bitLength, forceLength = false) {
/**
* Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
- *
+ * @since 3.0.0
* @param {number} bitLength The desired number of random bits
* @param {boolean} [forceLength = false] If we want to force the output to have a specific bit length. It basically forces the msb to be 1
*
diff --git a/src/js/index.js b/src/js/index.js
index 891dd11..713e7a7 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -181,6 +181,8 @@ export function randBetween (max, min = 1n) {
/**
* Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
*
+ * Since version 3.0.0 this is an async function and a new randBitsSync function has been added. If you are migrating from version 2 call randBitsSync instead.
+ * @since 3.0.0
* @param {number} bitLength The desired number of random bits
* @param {boolean} [forceLength = false] If we want to force the output to have a specific bit length. It basically forces the msb to be 1
*
@@ -208,7 +210,7 @@ export async function randBits (bitLength, forceLength = false) {
/**
* Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
- *
+ * @since 3.0.0
* @param {number} bitLength The desired number of random bits
* @param {boolean} [forceLength = false] If we want to force the output to have a specific bit length. It basically forces the msb to be 1
*
diff --git a/types/index.d.ts b/types/index.d.ts
index d399980..6fb6a41 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -135,6 +135,8 @@ export function randBetween(max: bigint, min?: bigint): bigint;
/**
* Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
*
+ * Since version 3.0.0 this is an async function and a new randBitsSync function has been added. If you are migrating from version 2 call randBitsSync instead.
+ * @since 3.0.0
* @param {number} bitLength The desired number of random bits
* @param {boolean} [forceLength = false] If we want to force the output to have a specific bit length. It basically forces the msb to be 1
*
@@ -143,7 +145,7 @@ export function randBetween(max: bigint, min?: bigint): bigint;
export function randBits(bitLength: number, forceLength?: boolean): Promise