diff --git a/types/scrypt-js/index.d.ts b/types/scrypt-js/index.d.ts index fde3c0a444..d231be19ff 100644 --- a/types/scrypt-js/index.d.ts +++ b/types/scrypt-js/index.d.ts @@ -1,13 +1,14 @@ // Type definitions for scrypt-js 2.0 // Project: https://github.com/ricmoo/scrypt-js // Definitions by: Daniel Byrne +// Romain Delamare // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// declare function scrypt( - password: Buffer, - salt: Buffer, + password: Buffer | ReadonlyArray | Uint8Array, + salt: Buffer | ReadonlyArray | Uint8Array, N: number, r: number, p: number, diff --git a/types/scrypt-js/scrypt-js-tests.ts b/types/scrypt-js/scrypt-js-tests.ts index c0b3c41a9c..abab2a4280 100644 --- a/types/scrypt-js/scrypt-js-tests.ts +++ b/types/scrypt-js/scrypt-js-tests.ts @@ -1,7 +1,10 @@ import scrypt = require('scrypt-js'); const testBuffer = Buffer.from('test'); +const testArray = [74, 65, 73, 74]; +const testUint8Array = Uint8Array.from(testArray); const testCB = (err: Error | undefined | null, progress: number, key?: ReadonlyArray) => {}; -// $ExpectType void -scrypt(testBuffer, testBuffer, 1, 1, 1, 1, testCB); +scrypt(testBuffer, testBuffer, 1, 1, 1, 1, testCB); // $ExpectType void +scrypt(testArray, testArray, 1, 1, 1, 1, testCB); // $ExpectType void +scrypt(testUint8Array, testUint8Array, 1, 1, 1, 1, testCB); // $ExpectType void