Skip to content

Commit

Permalink
getRandomValues: clarify security (#32804)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Mar 23, 2024
1 parent 1f954d6 commit 286883f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions files/en-us/web/api/crypto/getrandomvalues/index.md
Expand Up @@ -43,9 +43,7 @@ Note that `typedArray` is modified in-place, and no copy is made.

## Usage notes

Don't use `getRandomValues()` to generate encryption keys.
Instead, use the {{domxref("SubtleCrypto.generateKey", "generateKey()")}} method.
There are a few reasons for this; for example, `getRandomValues()` is not guaranteed to be running in a secure context.
Prefer the {{domxref("SubtleCrypto.generateKey", "generateKey()")}} method for key generation, which is guaranteed to be running in a secure context.

There is no minimum degree of entropy mandated by the Web Cryptography specification.
User agents are instead urged to provide the best entropy they can when generating random numbers,
Expand Down

0 comments on commit 286883f

Please sign in to comment.