%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
'use strict'; const common = require('../common'); if (!common.hasCrypto) common.skip('missing crypto'); const { Buffer } = require('buffer'); const assert = require('assert'); const { webcrypto } = require('crypto'); [ undefined, null, '', 1, {}, [], new Float32Array(1), new Float64Array(1), new DataView(new ArrayBuffer(1)), ].forEach((i) => { assert.throws( () => webcrypto.getRandomValues(i), { name: 'TypeMismatchError', code: 17 }, ); }); { const buf = new Uint8Array(0); webcrypto.getRandomValues(buf); } const intTypedConstructors = [ Int8Array, Int16Array, Int32Array, Uint8Array, Uint16Array, Uint32Array, Uint8ClampedArray, BigInt64Array, BigUint64Array, ]; for (const ctor of intTypedConstructors) { const buf = new ctor(10); const before = Buffer.from(buf.buffer).toString('hex'); webcrypto.getRandomValues(buf); const after = Buffer.from(buf.buffer).toString('hex'); assert.notStrictEqual(before, after); } { const buf = Buffer.alloc(10); const before = buf.toString('hex'); webcrypto.getRandomValues(buf); const after = buf.toString('hex'); assert.notStrictEqual(before, after); } { let kData; try { kData = Buffer.alloc(65536 + 1); } catch { // Ignore if error here. } if (kData !== undefined) { assert.throws(() => webcrypto.getRandomValues(kData), { code: 22 }); } }