GeezerVison is showing github.com — crypto: use async functions for non-stub Promise-returning functions · nodejs/node@f488b2f
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 +3-4Lines changed: 3 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 5 | 5 | ArrayBufferPrototypeSlice, | 6 | 6 | ArrayFrom, | 7 | 7 | ArrayPrototypePush, | 8 | | - PromiseReject, | 9 | 8 | SafeSet, | 10 | 9 | TypedArrayPrototypeSlice, | 11 | 10 | } = primordials; | @@ -132,7 +131,7 @@ function asyncAesKwCipher(mode, key, data) { | 132 | 131 | getVariant('AES-KW', key.algorithm.length))); | 133 | 132 | } | 134 | 133 |
| 135 | | -function asyncAesGcmCipher(mode, key, data, algorithm) { | | 134 | +async function asyncAesGcmCipher(mode, key, data, algorithm) { | 136 | 135 | const { tagLength = 128 } = algorithm; | 137 | 136 |
| 138 | 137 | const tagByteLength = tagLength / 8; | @@ -148,9 +147,9 @@ function asyncAesGcmCipher(mode, key, data, algorithm) { | 148 | 147 | // > If *plaintext* has a length less than *tagLength* bits, then `throw` | 149 | 148 | // > an `OperationError`. | 150 | 149 | if (tagByteLength > tag.byteLength) { | 151 | | - return PromiseReject(lazyDOMException( | | 150 | + throw lazyDOMException( | 152 | 151 | 'The provided data is too small.', | 153 | | - 'OperationError')); | | 152 | + 'OperationError'); | 154 | 153 | } | 155 | 154 |
| 156 | 155 | data = slice(data, 0, -tagByteLength); | |
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 |
|---|
@@ -342,7 +342,7 @@ function cfrgImportKey( | 342 | 342 | extractable); | 343 | 343 | } | 344 | 344 |
| 345 | | -function eddsaSignVerify(key, data, algorithm, signature) { | | 345 | +async function eddsaSignVerify(key, data, algorithm, signature) { | 346 | 346 | const mode = signature === undefined ? kSignJobModeSign : kSignJobModeVerify; | 347 | 347 | const type = mode === kSignJobModeSign ? 'private' : 'public'; | 348 | 348 |
| |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/crypto/ec.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -283,7 +283,7 @@ function ecImportKey( | 283 | 283 | extractable); | 284 | 284 | } | 285 | 285 |
| 286 | | -function ecdsaSignVerify(key, data, { name, hash }, signature) { | | 286 | +async function ecdsaSignVerify(key, data, { name, hash }, signature) { | 287 | 287 | const mode = signature === undefined ? kSignJobModeSign : kSignJobModeVerify; | 288 | 288 | const type = mode === kSignJobModeSign ? 'private' : 'public'; | 289 | 289 |
| |
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 |
|---|
@@ -91,7 +91,7 @@ function validateRsaOaepAlgorithm(algorithm) { | 91 | 91 | } | 92 | 92 | } | 93 | 93 |
| 94 | | -function rsaOaepCipher(mode, key, data, algorithm) { | | 94 | +async function rsaOaepCipher(mode, key, data, algorithm) { | 95 | 95 | validateRsaOaepAlgorithm(algorithm); | 96 | 96 |
| 97 | 97 | const type = mode === kWebCryptoCipherEncrypt ? 'public' : 'private'; | @@ -328,7 +328,7 @@ function rsaImportKey( | 328 | 328 | }, keyUsages, extractable); | 329 | 329 | } | 330 | 330 |
| 331 | | -function rsaSignVerify(key, data, { saltLength }, signature) { | | 331 | +async function rsaSignVerify(key, data, { saltLength }, signature) { | 332 | 332 | const mode = signature === undefined ? kSignJobModeSign : kSignJobModeVerify; | 333 | 333 | const type = mode === kSignJobModeSign ? 'private' : 'public'; | 334 | 334 |
| |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/crypto/webcrypto.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -769,7 +769,7 @@ async function unwrapKey( | 769 | 769 | ); | 770 | 770 | } | 771 | 771 |
| 772 | | -function signVerify(algorithm, key, data, signature) { | | 772 | +async function signVerify(algorithm, key, data, signature) { | 773 | 773 | let usage = 'sign'; | 774 | 774 | if (signature !== undefined) { | 775 | 775 | usage = 'verify'; | |
|