GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — crypto: use async functions for non-stub Promise-returning functions · nodejs/node@f488b2f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/crypto
    • aes.js
    • cfrg.js
    • ec.js
    • rsa.js
    • webcrypto.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/crypto/aes.js‎

Copy file name to clipboardExpand all lines: lib/internal/crypto/aes.js
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const {
55
ArrayBufferPrototypeSlice,
66
ArrayFrom,
77
ArrayPrototypePush,
8-
PromiseReject,
98
SafeSet,
109
TypedArrayPrototypeSlice,
1110
} = primordials;
@@ -132,7 +131,7 @@ function asyncAesKwCipher(mode, key, data) {
132131
getVariant('AES-KW', key.algorithm.length)));
133132
}
134133

135-
function asyncAesGcmCipher(mode, key, data, algorithm) {
134+
async function asyncAesGcmCipher(mode, key, data, algorithm) {
136135
const { tagLength = 128 } = algorithm;
137136

138137
const tagByteLength = tagLength / 8;
@@ -148,9 +147,9 @@ function asyncAesGcmCipher(mode, key, data, algorithm) {
148147
// > If *plaintext* has a length less than *tagLength* bits, then `throw`
149148
// > an `OperationError`.
150149
if (tagByteLength > tag.byteLength) {
151-
return PromiseReject(lazyDOMException(
150+
throw lazyDOMException(
152151
'The provided data is too small.',
153-
'OperationError'));
152+
'OperationError');
154153
}
155154

156155
data = slice(data, 0, -tagByteLength);
Collapse file

‎lib/internal/crypto/cfrg.js‎

Copy file name to clipboardExpand all lines: lib/internal/crypto/cfrg.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ function cfrgImportKey(
342342
extractable);
343343
}
344344

345-
function eddsaSignVerify(key, data, algorithm, signature) {
345+
async function eddsaSignVerify(key, data, algorithm, signature) {
346346
const mode = signature === undefined ? kSignJobModeSign : kSignJobModeVerify;
347347
const type = mode === kSignJobModeSign ? 'private' : 'public';
348348

Collapse file

‎lib/internal/crypto/ec.js‎

Copy file name to clipboardExpand all lines: lib/internal/crypto/ec.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ function ecImportKey(
283283
extractable);
284284
}
285285

286-
function ecdsaSignVerify(key, data, { name, hash }, signature) {
286+
async function ecdsaSignVerify(key, data, { name, hash }, signature) {
287287
const mode = signature === undefined ? kSignJobModeSign : kSignJobModeVerify;
288288
const type = mode === kSignJobModeSign ? 'private' : 'public';
289289

Collapse file

‎lib/internal/crypto/rsa.js‎

Copy file name to clipboardExpand all lines: lib/internal/crypto/rsa.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function validateRsaOaepAlgorithm(algorithm) {
9191
}
9292
}
9393

94-
function rsaOaepCipher(mode, key, data, algorithm) {
94+
async function rsaOaepCipher(mode, key, data, algorithm) {
9595
validateRsaOaepAlgorithm(algorithm);
9696

9797
const type = mode === kWebCryptoCipherEncrypt ? 'public' : 'private';
@@ -328,7 +328,7 @@ function rsaImportKey(
328328
}, keyUsages, extractable);
329329
}
330330

331-
function rsaSignVerify(key, data, { saltLength }, signature) {
331+
async function rsaSignVerify(key, data, { saltLength }, signature) {
332332
const mode = signature === undefined ? kSignJobModeSign : kSignJobModeVerify;
333333
const type = mode === kSignJobModeSign ? 'private' : 'public';
334334

Collapse file

‎lib/internal/crypto/webcrypto.js‎

Copy file name to clipboardExpand all lines: lib/internal/crypto/webcrypto.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ async function unwrapKey(
769769
);
770770
}
771771

772-
function signVerify(algorithm, key, data, signature) {
772+
async function signVerify(algorithm, key, data, signature) {
773773
let usage = 'sign';
774774
if (signature !== undefined) {
775775
usage = 'verify';

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.