| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f488b2f commit 1f93913
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -160,7 +160,7 @@ async function asyncAesGcmCipher(mode, key, data, algorithm) { | |||
| 160 | 160 | break; | |
| 161 | 161 | } | |
| 162 | 162 | ||
| 163 | - return jobPromise(() => new AESCipherJob( | ||
| 163 | + return await jobPromise(() => new AESCipherJob( | ||
| 164 | 164 | kCryptoJobAsync, | |
| 165 | 165 | mode, | |
| 166 | 166 | key[kKeyObject][kHandle], | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -349,7 +349,7 @@ async function eddsaSignVerify(key, data, algorithm, signature) { | |||
| 349 | 349 | if (key.type !== type) | |
| 350 | 350 | throw lazyDOMException(`Key must be a ${type} key`, 'InvalidAccessError'); | |
| 351 | 351 | ||
| 352 | - return jobPromise(() => new SignJob( | ||
| 352 | + return await jobPromise(() => new SignJob( | ||
| 353 | 353 | kCryptoJobAsync, | |
| 354 | 354 | mode, | |
| 355 | 355 | key[kKeyObject][kHandle], | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -99,7 +99,7 @@ async function ecGenerateKey(algorithm, extractable, keyUsages) { | |||
| 99 | 99 | let keyPair; | |
| 100 | 100 | try { | |
| 101 | 101 | keyPair = await generateKeyPair('ec', { namedCurve }); | |
| 102 | - } catch(err) { | ||
| 102 | + } catch (err) { | ||
| 103 | 103 | throw lazyDOMException( | |
| 104 | 104 | 'The operation failed for an operation-specific reason', | |
| 105 | 105 | { name: 'OperationError', cause: err }); | |
@@ -292,7 +292,7 @@ async function ecdsaSignVerify(key, data, { name, hash }, signature) { | |||
| 292 | 292 | ||
| 293 | 293 | const hashname = normalizeHashName(hash.name); | |
| 294 | 294 | ||
| 295 | - return jobPromise(() => new SignJob( | ||
| 295 | + return await jobPromise(() => new SignJob( | ||
| 296 | 296 | kCryptoJobAsync, | |
| 297 | 297 | mode, | |
| 298 | 298 | key[kKeyObject][kHandle], | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -101,7 +101,7 @@ async function rsaOaepCipher(mode, key, data, algorithm) { | |||
| 101 | 101 | 'InvalidAccessError'); | |
| 102 | 102 | } | |
| 103 | 103 | ||
| 104 | - return jobPromise(() => new RSACipherJob( | ||
| 104 | + return await jobPromise(() => new RSACipherJob( | ||
| 105 | 105 | kCryptoJobAsync, | |
| 106 | 106 | mode, | |
| 107 | 107 | key[kKeyObject][kHandle], | |
@@ -335,7 +335,7 @@ async function rsaSignVerify(key, data, { saltLength }, signature) { | |||
| 335 | 335 | if (key.type !== type) | |
| 336 | 336 | throw lazyDOMException(`Key must be a ${type} key`, 'InvalidAccessError'); | |
| 337 | 337 | ||
| 338 | - return jobPromise(() => { | ||
| 338 | + return await jobPromise(() => { | ||
| 339 | 339 | if (key.algorithm.name === 'RSA-PSS') { | |
| 340 | 340 | validateInt32( | |
| 341 | 341 | saltLength, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -80,7 +80,7 @@ async function digest(algorithm, data) { | |||
| 80 | 80 | ||
| 81 | 81 | algorithm = normalizeAlgorithm(algorithm, 'digest'); | |
| 82 | 82 | ||
| 83 | - return ReflectApply(asyncDigest, this, [algorithm, data]); | ||
| 83 | + return await ReflectApply(asyncDigest, this, [algorithm, data]); | ||
| 84 | 84 | } | |
| 85 | 85 | ||
| 86 | 86 | function randomUUID() { | |
@@ -210,13 +210,13 @@ async function deriveBits(algorithm, baseKey, length = null) { | |||
| 210 | 210 | case 'X448': | |
| 211 | 211 | // Fall through | |
| 212 | 212 | case 'ECDH': | |
| 213 | - return require('internal/crypto/diffiehellman') | ||
| 213 | + return await require('internal/crypto/diffiehellman') | ||
| 214 | 214 | .ecdhDeriveBits(algorithm, baseKey, length); | |
| 215 | 215 | case 'HKDF': | |
| 216 | - return require('internal/crypto/hkdf') | ||
| 216 | + return await require('internal/crypto/hkdf') | ||
| 217 | 217 | .hkdfDeriveBits(algorithm, baseKey, length); | |
| 218 | 218 | case 'PBKDF2': | |
| 219 | - return require('internal/crypto/pbkdf2') | ||
| 219 | + return await require('internal/crypto/pbkdf2') | ||
| 220 | 220 | .pbkdf2DeriveBits(algorithm, baseKey, length); | |
| 221 | 221 | } | |
| 222 | 222 | throw lazyDOMException('Unrecognized algorithm name', 'NotSupportedError'); | |
@@ -327,12 +327,12 @@ async function exportKeySpki(key) { | |||
| 327 | 327 | case 'RSA-PSS': | |
| 328 | 328 | // Fall through | |
| 329 | 329 | case 'RSA-OAEP': | |
| 330 | - return require('internal/crypto/rsa') | ||
| 330 | + return await require('internal/crypto/rsa') | ||
| 331 | 331 | .rsaExportKey(key, kWebCryptoKeyFormatSPKI); | |
| 332 | 332 | case 'ECDSA': | |
| 333 | 333 | // Fall through | |
| 334 | 334 | case 'ECDH': | |
| 335 | - return require('internal/crypto/ec') | ||
| 335 | + return await require('internal/crypto/ec') | ||
| 336 | 336 | .ecExportKey(key, kWebCryptoKeyFormatSPKI); | |
| 337 | 337 | case 'Ed25519': | |
| 338 | 338 | // Fall through | |
@@ -341,7 +341,7 @@ async function exportKeySpki(key) { | |||
| 341 | 341 | case 'X25519': | |
| 342 | 342 | // Fall through | |
| 343 | 343 | case 'X448': | |
| 344 | - return require('internal/crypto/cfrg') | ||
| 344 | + return await require('internal/crypto/cfrg') | ||
| 345 | 345 | .cfrgExportKey(key, kWebCryptoKeyFormatSPKI); | |
| 346 | 346 | default: | |
| 347 | 347 | return undefined; | |
@@ -355,12 +355,12 @@ async function exportKeyPkcs8(key) { | |||
| 355 | 355 | case 'RSA-PSS': | |
| 356 | 356 | // Fall through | |
| 357 | 357 | case 'RSA-OAEP': | |
| 358 | - return require('internal/crypto/rsa') | ||
| 358 | + return await require('internal/crypto/rsa') | ||
| 359 | 359 | .rsaExportKey(key, kWebCryptoKeyFormatPKCS8); | |
| 360 | 360 | case 'ECDSA': | |
| 361 | 361 | // Fall through | |
| 362 | 362 | case 'ECDH': | |
| 363 | - return require('internal/crypto/ec') | ||
| 363 | + return await require('internal/crypto/ec') | ||
| 364 | 364 | .ecExportKey(key, kWebCryptoKeyFormatPKCS8); | |
| 365 | 365 | case 'Ed25519': | |
| 366 | 366 | // Fall through | |
@@ -369,7 +369,7 @@ async function exportKeyPkcs8(key) { | |||
| 369 | 369 | case 'X25519': | |
| 370 | 370 | // Fall through | |
| 371 | 371 | case 'X448': | |
| 372 | - return require('internal/crypto/cfrg') | ||
| 372 | + return await require('internal/crypto/cfrg') | ||
| 373 | 373 | .cfrgExportKey(key, kWebCryptoKeyFormatPKCS8); | |
| 374 | 374 | default: | |
| 375 | 375 | return undefined; | |
@@ -381,7 +381,7 @@ async function exportKeyRawPublic(key) { | |||
| 381 | 381 | case 'ECDSA': | |
| 382 | 382 | // Fall through | |
| 383 | 383 | case 'ECDH': | |
| 384 | - return require('internal/crypto/ec') | ||
| 384 | + return await require('internal/crypto/ec') | ||
| 385 | 385 | .ecExportKey(key, kWebCryptoKeyFormatRaw); | |
| 386 | 386 | case 'Ed25519': | |
| 387 | 387 | // Fall through | |
@@ -390,7 +390,7 @@ async function exportKeyRawPublic(key) { | |||
| 390 | 390 | case 'X25519': | |
| 391 | 391 | // Fall through | |
| 392 | 392 | case 'X448': | |
| 393 | - return require('internal/crypto/cfrg') | ||
| 393 | + return await require('internal/crypto/cfrg') | ||
| 394 | 394 | .cfrgExportKey(key, kWebCryptoKeyFormatRaw); | |
| 395 | 395 | default: | |
| 396 | 396 | return undefined; | |
@@ -682,7 +682,7 @@ async function wrapKey(format, key, wrappingKey, algorithm) { | |||
| 682 | 682 | } | |
| 683 | 683 | } | |
| 684 | 684 | ||
| 685 | - return cipherOrWrap( | ||
| 685 | + return await cipherOrWrap( | ||
| 686 | 686 | kWebCryptoCipherEncrypt, | |
| 687 | 687 | algorithm, | |
| 688 | 688 | wrappingKey, | |
@@ -787,19 +787,19 @@ async function signVerify(algorithm, key, data, signature) { | |||
| 787 | 787 | case 'RSA-PSS': | |
| 788 | 788 | // Fall through | |
| 789 | 789 | case 'RSASSA-PKCS1-v1_5': | |
| 790 | - return require('internal/crypto/rsa') | ||
| 790 | + return await require('internal/crypto/rsa') | ||
| 791 | 791 | .rsaSignVerify(key, data, algorithm, signature); | |
| 792 | 792 | case 'ECDSA': | |
| 793 | - return require('internal/crypto/ec') | ||
| 793 | + return await require('internal/crypto/ec') | ||
| 794 | 794 | .ecdsaSignVerify(key, data, algorithm, signature); | |
| 795 | 795 | case 'Ed25519': | |
| 796 | 796 | // Fall through | |
| 797 | 797 | case 'Ed448': | |
| 798 | 798 | // Fall through | |
| 799 | - return require('internal/crypto/cfrg') | ||
| 799 | + return await require('internal/crypto/cfrg') | ||
| 800 | 800 | .eddsaSignVerify(key, data, algorithm, signature); | |
| 801 | 801 | case 'HMAC': | |
| 802 | - return require('internal/crypto/mac') | ||
| 802 | + return await require('internal/crypto/mac') | ||
| 803 | 803 | .hmacSignVerify(key, data, algorithm, signature); | |
| 804 | 804 | } | |
| 805 | 805 | throw lazyDOMException('Unrecognized algorithm name', 'NotSupportedError'); | |
@@ -824,7 +824,7 @@ async function sign(algorithm, key, data) { | |||
| 824 | 824 | context: '3rd argument', | |
| 825 | 825 | }); | |
| 826 | 826 | ||
| 827 | - return signVerify(algorithm, key, data); | ||
| 827 | + return await signVerify(algorithm, key, data); | ||
| 828 | 828 | } | |
| 829 | 829 | ||
| 830 | 830 | async function verify(algorithm, key, signature, data) { | |
@@ -850,7 +850,7 @@ async function verify(algorithm, key, signature, data) { | |||
| 850 | 850 | context: '4th argument', | |
| 851 | 851 | }); | |
| 852 | 852 | ||
| 853 | - return signVerify(algorithm, key, data, signature); | ||
| 853 | + return await signVerify(algorithm, key, data, signature); | ||
| 854 | 854 | } | |
| 855 | 855 | ||
| 856 | 856 | async function cipherOrWrap(mode, algorithm, key, data, op) { | |
@@ -873,18 +873,18 @@ async function cipherOrWrap(mode, algorithm, key, data, op) { | |||
| 873 | 873 | ||
| 874 | 874 | switch (algorithm.name) { | |
| 875 | 875 | case 'RSA-OAEP': | |
| 876 | - return require('internal/crypto/rsa') | ||
| 876 | + return await require('internal/crypto/rsa') | ||
| 877 | 877 | .rsaCipher(mode, key, data, algorithm); | |
| 878 | 878 | case 'AES-CTR': | |
| 879 | 879 | // Fall through | |
| 880 | 880 | case 'AES-CBC': | |
| 881 | 881 | // Fall through | |
| 882 | 882 | case 'AES-GCM': | |
| 883 | - return require('internal/crypto/aes') | ||
| 883 | + return await require('internal/crypto/aes') | ||
| 884 | 884 | .aesCipher(mode, key, data, algorithm); | |
| 885 | 885 | case 'AES-KW': | |
| 886 | 886 | if (op === 'wrapKey' || op === 'unwrapKey') { | |
| 887 | - return require('internal/crypto/aes') | ||
| 887 | + return await require('internal/crypto/aes') | ||
| 888 | 888 | .aesCipher(mode, key, data, algorithm); | |
| 889 | 889 | } | |
| 890 | 890 | } | |
@@ -911,7 +911,13 @@ async function encrypt(algorithm, key, data) { | |||
| 911 | 911 | }); | |
| 912 | 912 | ||
| 913 | 913 | 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 | + ); | ||
| 915 | 921 | } | |
| 916 | 922 | ||
| 917 | 923 | async function decrypt(algorithm, key, data) { | |
@@ -934,7 +940,13 @@ async function decrypt(algorithm, key, data) { | |||
| 934 | 940 | }); | |
| 935 | 941 | ||
| 936 | 942 | 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 | + ); | ||
| 938 | 950 | } | |
| 939 | 951 | ||
| 940 | 952 | // The SubtleCrypto and Crypto classes are defined as part of the | |
| Back | FazBrowse Home | New Git URL |
0 commit comments