From 93a904d0ba8f85ce355aa373e407c16199f053fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Wed, 4 Aug 2021 08:21:42 +0200 Subject: [PATCH] crypto: implement webcrypto.randomUUID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs: https://wicg.github.io/uuid/ Refs: https://www.chromestatus.com/feature/5689159362543616 PR-URL: https://github.com/nodejs/node/pull/39648 Reviewed-By: James M Snell Reviewed-By: Benjamin Gruenbaum Reviewed-By: Tobias Nießen --- doc/api/webcrypto.md | 11 +++++++++++ lib/crypto.js | 2 +- lib/internal/crypto/webcrypto.js | 15 ++++++++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/doc/api/webcrypto.md b/doc/api/webcrypto.md index 8032dad898658b..799cfd56431e5e 100644 --- a/doc/api/webcrypto.md +++ b/doc/api/webcrypto.md @@ -361,6 +361,16 @@ filled with random values, and a reference to `typedArray` is returned. An error will be thrown if the given `typedArray` is larger than 65,536 bytes. +### `crypto.randomUUID()` + + +* Returns: {string} + +Generates a random [RFC 4122][] Version 4 UUID. The UUID is generated using a +cryptographic pseudorandom number generator. + ## Class: `CryptoKey`