@@ -80,7 +80,7 @@ async function digest(algorithm, data) {
8080
8181 algorithm = normalizeAlgorithm ( algorithm , 'digest' ) ;
8282
83- return ReflectApply ( asyncDigest , this , [ algorithm , data ] ) ;
83+ return await ReflectApply ( asyncDigest , this , [ algorithm , data ] ) ;
8484}
8585
8686function randomUUID ( ) {
@@ -210,13 +210,13 @@ async function deriveBits(algorithm, baseKey, length = null) {
210210 case 'X448' :
211211 // Fall through
212212 case 'ECDH' :
213- return require ( 'internal/crypto/diffiehellman' )
213+ return await require ( 'internal/crypto/diffiehellman' )
214214 . ecdhDeriveBits ( algorithm , baseKey , length ) ;
215215 case 'HKDF' :
216- return require ( 'internal/crypto/hkdf' )
216+ return await require ( 'internal/crypto/hkdf' )
217217 . hkdfDeriveBits ( algorithm , baseKey , length ) ;
218218 case 'PBKDF2' :
219- return require ( 'internal/crypto/pbkdf2' )
219+ return await require ( 'internal/crypto/pbkdf2' )
220220 . pbkdf2DeriveBits ( algorithm , baseKey , length ) ;
221221 }
222222 throw lazyDOMException ( 'Unrecognized algorithm name' , 'NotSupportedError' ) ;
@@ -327,12 +327,12 @@ async function exportKeySpki(key) {
327327 case 'RSA-PSS' :
328328 // Fall through
329329 case 'RSA-OAEP' :
330- return require ( 'internal/crypto/rsa' )
330+ return await require ( 'internal/crypto/rsa' )
331331 . rsaExportKey ( key , kWebCryptoKeyFormatSPKI ) ;
332332 case 'ECDSA' :
333333 // Fall through
334334 case 'ECDH' :
335- return require ( 'internal/crypto/ec' )
335+ return await require ( 'internal/crypto/ec' )
336336 . ecExportKey ( key , kWebCryptoKeyFormatSPKI ) ;
337337 case 'Ed25519' :
338338 // Fall through
@@ -341,7 +341,7 @@ async function exportKeySpki(key) {
341341 case 'X25519' :
342342 // Fall through
343343 case 'X448' :
344- return require ( 'internal/crypto/cfrg' )
344+ return await require ( 'internal/crypto/cfrg' )
345345 . cfrgExportKey ( key , kWebCryptoKeyFormatSPKI ) ;
346346 default :
347347 return undefined ;
@@ -355,12 +355,12 @@ async function exportKeyPkcs8(key) {
355355 case 'RSA-PSS' :
356356 // Fall through
357357 case 'RSA-OAEP' :
358- return require ( 'internal/crypto/rsa' )
358+ return await require ( 'internal/crypto/rsa' )
359359 . rsaExportKey ( key , kWebCryptoKeyFormatPKCS8 ) ;
360360 case 'ECDSA' :
361361 // Fall through
362362 case 'ECDH' :
363- return require ( 'internal/crypto/ec' )
363+ return await require ( 'internal/crypto/ec' )
364364 . ecExportKey ( key , kWebCryptoKeyFormatPKCS8 ) ;
365365 case 'Ed25519' :
366366 // Fall through
@@ -369,7 +369,7 @@ async function exportKeyPkcs8(key) {
369369 case 'X25519' :
370370 // Fall through
371371 case 'X448' :
372- return require ( 'internal/crypto/cfrg' )
372+ return await require ( 'internal/crypto/cfrg' )
373373 . cfrgExportKey ( key , kWebCryptoKeyFormatPKCS8 ) ;
374374 default :
375375 return undefined ;
@@ -381,7 +381,7 @@ async function exportKeyRawPublic(key) {
381381 case 'ECDSA' :
382382 // Fall through
383383 case 'ECDH' :
384- return require ( 'internal/crypto/ec' )
384+ return await require ( 'internal/crypto/ec' )
385385 . ecExportKey ( key , kWebCryptoKeyFormatRaw ) ;
386386 case 'Ed25519' :
387387 // Fall through
@@ -390,7 +390,7 @@ async function exportKeyRawPublic(key) {
390390 case 'X25519' :
391391 // Fall through
392392 case 'X448' :
393- return require ( 'internal/crypto/cfrg' )
393+ return await require ( 'internal/crypto/cfrg' )
394394 . cfrgExportKey ( key , kWebCryptoKeyFormatRaw ) ;
395395 default :
396396 return undefined ;
@@ -682,7 +682,7 @@ async function wrapKey(format, key, wrappingKey, algorithm) {
682682 }
683683 }
684684
685- return cipherOrWrap (
685+ return await cipherOrWrap (
686686 kWebCryptoCipherEncrypt ,
687687 algorithm ,
688688 wrappingKey ,
@@ -787,19 +787,19 @@ async function signVerify(algorithm, key, data, signature) {
787787 case 'RSA-PSS' :
788788 // Fall through
789789 case 'RSASSA-PKCS1-v1_5' :
790- return require ( 'internal/crypto/rsa' )
790+ return await require ( 'internal/crypto/rsa' )
791791 . rsaSignVerify ( key , data , algorithm , signature ) ;
792792 case 'ECDSA' :
793- return require ( 'internal/crypto/ec' )
793+ return await require ( 'internal/crypto/ec' )
794794 . ecdsaSignVerify ( key , data , algorithm , signature ) ;
795795 case 'Ed25519' :
796796 // Fall through
797797 case 'Ed448' :
798798 // Fall through
799- return require ( 'internal/crypto/cfrg' )
799+ return await require ( 'internal/crypto/cfrg' )
800800 . eddsaSignVerify ( key , data , algorithm , signature ) ;
801801 case 'HMAC' :
802- return require ( 'internal/crypto/mac' )
802+ return await require ( 'internal/crypto/mac' )
803803 . hmacSignVerify ( key , data , algorithm , signature ) ;
804804 }
805805 throw lazyDOMException ( 'Unrecognized algorithm name' , 'NotSupportedError' ) ;
@@ -824,7 +824,7 @@ async function sign(algorithm, key, data) {
824824 context : '3rd argument' ,
825825 } ) ;
826826
827- return signVerify ( algorithm , key , data ) ;
827+ return await signVerify ( algorithm , key , data ) ;
828828}
829829
830830async function verify ( algorithm , key , signature , data ) {
@@ -850,7 +850,7 @@ async function verify(algorithm, key, signature, data) {
850850 context : '4th argument' ,
851851 } ) ;
852852
853- return signVerify ( algorithm , key , data , signature ) ;
853+ return await signVerify ( algorithm , key , data , signature ) ;
854854}
855855
856856async function cipherOrWrap ( mode , algorithm , key , data , op ) {
@@ -873,18 +873,18 @@ async function cipherOrWrap(mode, algorithm, key, data, op) {
873873
874874 switch ( algorithm . name ) {
875875 case 'RSA-OAEP' :
876- return require ( 'internal/crypto/rsa' )
876+ return await require ( 'internal/crypto/rsa' )
877877 . rsaCipher ( mode , key , data , algorithm ) ;
878878 case 'AES-CTR' :
879879 // Fall through
880880 case 'AES-CBC' :
881881 // Fall through
882882 case 'AES-GCM' :
883- return require ( 'internal/crypto/aes' )
883+ return await require ( 'internal/crypto/aes' )
884884 . aesCipher ( mode , key , data , algorithm ) ;
885885 case 'AES-KW' :
886886 if ( op === 'wrapKey' || op === 'unwrapKey' ) {
887- return require ( 'internal/crypto/aes' )
887+ return await require ( 'internal/crypto/aes' )
888888 . aesCipher ( mode , key , data , algorithm ) ;
889889 }
890890 }
@@ -911,7 +911,13 @@ async function encrypt(algorithm, key, data) {
911911 } ) ;
912912
913913 algorithm = normalizeAlgorithm ( algorithm , 'encrypt' ) ;
914- return cipherOrWrap ( kWebCryptoCipherEncrypt , algorithm , key , data , 'encrypt' ) ;
914+ return await cipherOrWrap (
915+ kWebCryptoCipherEncrypt ,
916+ algorithm ,
917+ key ,
918+ data ,
919+ 'encrypt' ,
920+ ) ;
915921}
916922
917923async function decrypt ( algorithm , key , data ) {
@@ -934,7 +940,13 @@ async function decrypt(algorithm, key, data) {
934940 } ) ;
935941
936942 algorithm = normalizeAlgorithm ( algorithm , 'decrypt' ) ;
937- return cipherOrWrap ( kWebCryptoCipherDecrypt , algorithm , key , data , 'decrypt' ) ;
943+ return await cipherOrWrap (
944+ kWebCryptoCipherDecrypt ,
945+ algorithm ,
946+ key ,
947+ data ,
948+ 'decrypt' ,
949+ ) ;
938950}
939951
940952// The SubtleCrypto and Crypto classes are defined as part of the
0 commit comments