| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9c41247 commit d62fe31
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4051,6 +4051,17 @@ const { | |||
| 4051 | 4051 | console.log(getHashes()); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...] | |
| 4052 | 4052 | ``` | |
| 4053 | 4053 | ||
| 4054 | + ### `crypto.getRandomValues(typedArray)` | ||
| 4055 | + | ||
| 4056 | + <!-- YAML | ||
| 4057 | + added: REPLACEME | ||
| 4058 | + --> | ||
| 4059 | + | ||
| 4060 | + * `typedArray` {Buffer|TypedArray|DataView|ArrayBuffer} | ||
| 4061 | + * Returns: {Buffer|TypedArray|DataView|ArrayBuffer} Returns `typedArray`. | ||
| 4062 | + | ||
| 4063 | + A convenient alias for [`crypto.webcrypto.getRandomValues()`][]. | ||
| 4064 | + | ||
| 4054 | 4065 | ### `crypto.hkdf(digest, ikm, salt, info, keylen, callback)` | |
| 4055 | 4066 | ||
| 4056 | 4067 | <!-- YAML | |
@@ -5230,6 +5241,16 @@ additional properties can be passed: | |||
| 5230 | 5241 | ||
| 5231 | 5242 | If the `callback` function is provided this function uses libuv's threadpool. | |
| 5232 | 5243 | ||
| 5244 | + ### `crypto.subtle` | ||
| 5245 | + | ||
| 5246 | + <!-- YAML | ||
| 5247 | + added: REPLACEME | ||
| 5248 | + --> | ||
| 5249 | + | ||
| 5250 | + * Type: {SubtleCrypto} | ||
| 5251 | + | ||
| 5252 | + A convenient alias for [`crypto.webcrypto.subtle`][]. | ||
| 5253 | + | ||
| 5233 | 5254 | ### `crypto.timingSafeEqual(a, b)` | |
| 5234 | 5255 | ||
| 5235 | 5256 | <!-- YAML | |
@@ -5945,6 +5966,8 @@ See the [list of SSL OP Flags][] for details. | |||
| 5945 | 5966 | [`crypto.randomBytes()`]: #cryptorandombytessize-callback | |
| 5946 | 5967 | [`crypto.randomFill()`]: #cryptorandomfillbuffer-offset-size-callback | |
| 5947 | 5968 | [`crypto.scrypt()`]: #cryptoscryptpassword-salt-keylen-options-callback | |
| 5969 | + [`crypto.webcrypto.getRandomValues()`]: webcrypto.md#cryptogetrandomvaluestypedarray | ||
| 5970 | + [`crypto.webcrypto.subtle`]: webcrypto.md#class-subtlecrypto | ||
| 5948 | 5971 | [`decipher.final()`]: #decipherfinaloutputencoding | |
| 5949 | 5972 | [`decipher.update()`]: #decipherupdatedata-inputencoding-outputencoding | |
| 5950 | 5973 | [`diffieHellman.setPublicKey()`]: #diffiehellmansetpublickeypublickey-encoding | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -119,11 +119,16 @@ const { | |||
| 119 | 119 | getHashes, | |
| 120 | 120 | setDefaultEncoding, | |
| 121 | 121 | setEngine, | |
| 122 | - lazyRequire, | ||
| 123 | 122 | secureHeapUsed, | |
| 124 | 123 | } = require('internal/crypto/util'); | |
| 125 | 124 | const Certificate = require('internal/crypto/certificate'); | |
| 126 | 125 | ||
| 126 | + let webcrypto; | ||
| 127 | + function lazyWebCrypto() { | ||
| 128 | + webcrypto ??= require('internal/crypto/webcrypto'); | ||
| 129 | + return webcrypto; | ||
| 130 | + } | ||
| 131 | + | ||
| 127 | 132 | // These helper functions are needed because the constructors can | |
| 128 | 133 | // use new, in which case V8 cannot inline the recursive constructor call | |
| 129 | 134 | function createHash(algorithm, options) { | |
@@ -284,7 +289,22 @@ ObjectDefineProperties(module.exports, { | |||
| 284 | 289 | webcrypto: { | |
| 285 | 290 | configurable: false, | |
| 286 | 291 | enumerable: true, | |
| 287 | - get() { return lazyRequire('internal/crypto/webcrypto').crypto; } | ||
| 292 | + get() { return lazyWebCrypto().crypto; }, | ||
| 293 | + set: undefined, | ||
| 294 | + }, | ||
| 295 | + | ||
| 296 | + subtle: { | ||
| 297 | + configurable: false, | ||
| 298 | + enumerable: true, | ||
| 299 | + get() { return lazyWebCrypto().crypto.subtle; }, | ||
| 300 | + set: undefined, | ||
| 301 | + }, | ||
| 302 | + | ||
| 303 | + getRandomValues: { | ||
| 304 | + configurable: false, | ||
| 305 | + enumerable: true, | ||
| 306 | + get() { return lazyWebCrypto().crypto.getRandomValues; }, | ||
| 307 | + set: undefined, | ||
| 288 | 308 | }, | |
| 289 | 309 | ||
| 290 | 310 | // Aliases for randomBytes are deprecated. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments