Skip to content

Commit

Permalink
enable eslint and typescript warnings for crypto_scrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Feb 27, 2025
1 parent 084024b commit 6713212
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/node/internal/crypto_scrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

/* TODO: the following is adopted code, enabling linting one day */
/* eslint-disable */

'use strict';

import { default as cryptoImpl } from 'node-internal:crypto';

import {
Expand Down Expand Up @@ -77,7 +72,7 @@ function validateParameters(
password: ArrayLike,
salt: ArrayLike,
keylen: number,
options: ScryptOptions
options?: ScryptOptions
): ValidatedScryptOptions {
// TODO(soon): Add support for KeyObject input.
password = getArrayBufferOrView(password, 'password');
Expand Down Expand Up @@ -151,7 +146,7 @@ export function scrypt(
keylen: number,
options: OptionsOrCallback,
callback: OptionsOrCallback = defaults
) {
): void {
if (callback === defaults) {
callback = options;
options = defaults;
Expand All @@ -174,13 +169,15 @@ export function scrypt(
try {
res(cryptoImpl.getScrypt(password, salt, N, r, p, maxmem, keylen));
} catch (err) {
rej(err);
rej(err as Error);
}
}).then(
(val: ArrayBuffer) => {
(callback as Callback)(null, Buffer.from(val));
},
(err) => (callback as Callback)(err)
(err: unknown) => {
(callback as Callback)(err as Error);
}
);
}

Expand Down

0 comments on commit 6713212

Please sign in to comment.