GeezerVison is showing github.com — crypto: use `return await` when returning Promises from async functions · nodejs/node@647c332
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/internal/crypto/aes.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -172,7 +172,7 @@ async function asyncAesGcmCipher(mode, key, data, algorithm) { | 172 | 172 | break; | 173 | 173 | } | 174 | 174 |
| 175 | | - return jobPromise(() => new AESCipherJob( | | 175 | + return await jobPromise(() => new AESCipherJob( | 176 | 176 | kCryptoJobAsync, | 177 | 177 | mode, | 178 | 178 | key[kKeyObject][kHandle], | @@ -209,7 +209,7 @@ async function asyncAesOcbCipher(mode, key, data, algorithm) { | 209 | 209 | break; | 210 | 210 | } | 211 | 211 |
| 212 | | - return jobPromise(() => new AESCipherJob( | | 212 | + return await jobPromise(() => new AESCipherJob( | 213 | 213 | kCryptoJobAsync, | 214 | 214 | mode, | 215 | 215 | key[kKeyObject][kHandle], | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/crypto/cfrg.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -350,7 +350,7 @@ async function eddsaSignVerify(key, data, algorithm, signature) { | 350 | 350 | if (key[kKeyType] !== type) | 351 | 351 | throw lazyDOMException(`Key must be a ${type} key`, 'InvalidAccessError'); | 352 | 352 |
| 353 | | - return jobPromise(() => new SignJob( | | 353 | + return await jobPromise(() => new SignJob( | 354 | 354 | kCryptoJobAsync, | 355 | 355 | mode, | 356 | 356 | key[kKeyObject][kHandle], | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/crypto/chacha20_poly1305.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -68,7 +68,7 @@ async function c20pCipher(mode, key, data, algorithm) { | 68 | 68 | break; | 69 | 69 | } | 70 | 70 |
| 71 | | - return jobPromise(() => new ChaCha20Poly1305CipherJob( | | 71 | + return await jobPromise(() => new ChaCha20Poly1305CipherJob( | 72 | 72 | kCryptoJobAsync, | 73 | 73 | mode, | 74 | 74 | key[kKeyObject][kHandle], | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/crypto/ec.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -100,7 +100,7 @@ async function ecGenerateKey(algorithm, extractable, keyUsages) { | 100 | 100 | let keyPair; | 101 | 101 | try { | 102 | 102 | keyPair = await generateKeyPair('ec', { namedCurve }); | 103 | | - } catch(err) { | | 103 | + } catch (err) { | 104 | 104 | throw lazyDOMException( | 105 | 105 | 'The operation failed for an operation-specific reason', | 106 | 106 | { name: 'OperationError', cause: err }); | @@ -293,7 +293,7 @@ async function ecdsaSignVerify(key, data, { name, hash }, signature) { | 293 | 293 |
| 294 | 294 | const hashname = normalizeHashName(hash.name); | 295 | 295 |
| 296 | | - return jobPromise(() => new SignJob( | | 296 | + return await jobPromise(() => new SignJob( | 297 | 297 | kCryptoJobAsync, | 298 | 298 | mode, | 299 | 299 | key[kKeyObject][kHandle], | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/crypto/hash.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -221,7 +221,7 @@ async function asyncDigest(algorithm, data) { | 221 | 221 | case 'cSHAKE128': | 222 | 222 | // Fall through | 223 | 223 | case 'cSHAKE256': | 224 | | - return jobPromise(() => new HashJob( | | 224 | + return await jobPromise(() => new HashJob( | 225 | 225 | kCryptoJobAsync, | 226 | 226 | normalizeHashName(algorithm.name), | 227 | 227 | data, | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/crypto/ml_dsa.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -294,7 +294,7 @@ async function mlDsaSignVerify(key, data, algorithm, signature) { | 294 | 294 | if (key[kKeyType] !== type) | 295 | 295 | throw lazyDOMException(`Key must be a ${type} key`, 'InvalidAccessError'); | 296 | 296 |
| 297 | | - return jobPromise(() => new SignJob( | | 297 | + return await jobPromise(() => new SignJob( | 298 | 298 | kCryptoJobAsync, | 299 | 299 | mode, | 300 | 300 | key[kKeyObject][kHandle], | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/crypto/ml_kem.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -62,7 +62,7 @@ async function mlKemGenerateKey(algorithm, extractable, keyUsages) { | 62 | 62 | let keyPair; | 63 | 63 | try { | 64 | 64 | keyPair = await generateKeyPair(name.toLowerCase()); | 65 | | - } catch(err) { | | 65 | + } catch (err) { | 66 | 66 | throw lazyDOMException( | 67 | 67 | 'The operation failed for an operation-specific reason', | 68 | 68 | { name: 'OperationError', cause: err }); | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/crypto/rsa.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -103,7 +103,7 @@ async function rsaOaepCipher(mode, key, data, algorithm) { | 103 | 103 | 'InvalidAccessError'); | 104 | 104 | } | 105 | 105 |
| 106 | | - return jobPromise(() => new RSACipherJob( | | 106 | + return await jobPromise(() => new RSACipherJob( | 107 | 107 | kCryptoJobAsync, | 108 | 108 | mode, | 109 | 109 | key[kKeyObject][kHandle], | @@ -337,7 +337,7 @@ async function rsaSignVerify(key, data, { saltLength }, signature) { | 337 | 337 | if (key[kKeyType] !== type) | 338 | 338 | throw lazyDOMException(`Key must be a ${type} key`, 'InvalidAccessError'); | 339 | 339 |
| 340 | | - return jobPromise(() => { | | 340 | + return await jobPromise(() => { | 341 | 341 | if (key[kAlgorithm].name === 'RSA-PSS') { | 342 | 342 | validateInt32( | 343 | 343 | saltLength, | |
|