From 181d08250c8567b64488b9b41f295e85e87b62a2 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 21 Dec 2021 10:38:26 -0800 Subject: [PATCH 1/3] crypto: alias webcrypto.subtle and webcrypto.getRandomValues on crypto The aliases allow code written to assume that `crypto.subtle` and `crypto.getRandomValues()` exist on the `crypto` global to just work. Signed-off-by: James M Snell --- doc/api/crypto.md | 22 ++++++++++++++++++++++ lib/crypto.js | 23 +++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 593e469952ad89..89e17dd44ed771 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -4015,6 +4015,17 @@ const { console.log(getHashes()); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...] ``` +### `crypto.getRandomValues(typedArray)` + + + +* `typedArray` {Buffer|TypedArray|DataView|ArrayBuffer} +* Returns: {Buffer|TypedArray|DataView|ArrayBuffer} Returns `typedArray`. + +A convenient alias for [`crypto.webcrypto.getRandomValues()`][]. + ### `crypto.hkdf(digest, ikm, salt, info, keylen, callback)` + +* Type: {SubtleCrypto} + +A convenient alias for `crypto.webcrypto.subtle`. + ### `crypto.timingSafeEqual(a, b)`