You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import cryptoRandomString from 'crypto-random-string';
82
80
83
81
cryptoRandomString({length: 10});
84
82
//=> '2cf05d94db'
85
83
```
86
84
*/
87
-
(options: cryptoRandomString.Options): string;
85
+
(options: Options): string;
88
86
89
87
/**
90
88
Asynchronously generate a [cryptographically strong](https://en.wikipedia.org/wiki/Strong_cryptography) random string.
91
89
90
+
For most use-cases, there's really no good reason to use this async version. From the Node.js docs:
91
+
92
+
> The `crypto.randomBytes()` method will not complete until there is sufficient entropy available. This should normally never take longer than a few milliseconds. The only time when generating the random bytes may conceivably block for a longer period of time is right after boot, when the whole system is still low on entropy.
93
+
94
+
In general, anything async comes with some overhead on it's own.
95
+
92
96
@returns A promise which resolves to a randomized string.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@@ -50,6 +50,12 @@ Returns a randomized string. [Hex](https://en.wikipedia.org/wiki/Hexadecimal) by
50
50
51
51
Returns a promise which resolves to a randomized string. [Hex](https://en.wikipedia.org/wiki/Hexadecimal) by default.
52
52
53
+
For most use-cases, there's really no good reason to use this async version. From the Node.js docs:
54
+
55
+
> The `crypto.randomBytes()` method will not complete until there is sufficient entropy available. This should normally never take longer than a few milliseconds. The only time when generating the random bytes may conceivably block for a longer period of time is right after boot, when the whole system is still low on entropy.
56
+
57
+
In general, anything async comes with some overhead on it's own.
0 commit comments