@@ -6,14 +6,15 @@ if (!common.hasCrypto)
66common . skip ( 'missing crypto' ) ;
77
88const assert = require ( 'assert' ) ;
9- const { subtle, getRandomValues } = require ( 'crypto' ) . webcrypto ;
9+ const { webcrypto } = require ( 'crypto' ) ;
10+ const { subtle } = webcrypto ;
1011
1112// This is only a partial test. The WebCrypto Web Platform Tests
1213// will provide much greater coverage.
1314
1415// Test Encrypt/Decrypt RSA-OAEP
1516{
16- const buf = getRandomValues ( new Uint8Array ( 50 ) ) ;
17+ const buf = webcrypto . getRandomValues ( new Uint8Array ( 50 ) ) ;
1718
1819async function test ( ) {
1920const ec = new TextEncoder ( ) ;
@@ -44,8 +45,8 @@ const { subtle, getRandomValues } = require('crypto').webcrypto;
4445
4546// Test Encrypt/Decrypt AES-CTR
4647{
47- const buf = getRandomValues ( new Uint8Array ( 50 ) ) ;
48- const counter = getRandomValues ( new Uint8Array ( 16 ) ) ;
48+ const buf = webcrypto . getRandomValues ( new Uint8Array ( 50 ) ) ;
49+ const counter = webcrypto . getRandomValues ( new Uint8Array ( 16 ) ) ;
4950
5051async function test ( ) {
5152const key = await subtle . generateKey ( {
@@ -71,8 +72,8 @@ const { subtle, getRandomValues } = require('crypto').webcrypto;
7172
7273// Test Encrypt/Decrypt AES-CBC
7374{
74- const buf = getRandomValues ( new Uint8Array ( 50 ) ) ;
75- const iv = getRandomValues ( new Uint8Array ( 16 ) ) ;
75+ const buf = webcrypto . getRandomValues ( new Uint8Array ( 50 ) ) ;
76+ const iv = webcrypto . getRandomValues ( new Uint8Array ( 16 ) ) ;
7677
7778async function test ( ) {
7879const key = await subtle . generateKey ( {
@@ -98,8 +99,8 @@ const { subtle, getRandomValues } = require('crypto').webcrypto;
9899
99100// Test Encrypt/Decrypt AES-GCM
100101{
101- const buf = getRandomValues ( new Uint8Array ( 50 ) ) ;
102- const iv = getRandomValues ( new Uint8Array ( 12 ) ) ;
102+ const buf = webcrypto . getRandomValues ( new Uint8Array ( 50 ) ) ;
103+ const iv = webcrypto . getRandomValues ( new Uint8Array ( 12 ) ) ;
103104
104105async function test ( ) {
105106const key = await subtle . generateKey ( {
0 commit comments