diff --git a/types/scrypt-js/index.d.ts b/types/scrypt-js/index.d.ts new file mode 100644 index 0000000000..fde3c0a444 --- /dev/null +++ b/types/scrypt-js/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for scrypt-js 2.0 +// Project: https://github.com/ricmoo/scrypt-js +// Definitions by: Daniel Byrne +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare function scrypt( + password: Buffer, + salt: Buffer, + N: number, + r: number, + p: number, + dklen: number, + callback: ( + error: Error | undefined | null, + progress: number, + key?: ReadonlyArray, + ) => void +): void; + +export = scrypt; diff --git a/types/scrypt-js/scrypt-js-tests.ts b/types/scrypt-js/scrypt-js-tests.ts new file mode 100644 index 0000000000..21c77fb16c --- /dev/null +++ b/types/scrypt-js/scrypt-js-tests.ts @@ -0,0 +1,7 @@ +import scrypt = require('scrypt-js'); + +const testBuffer = Buffer.from('test'); +const testCB = (err: Error | undefined | null, progress: number) => {}; + +// $ExpectType void +scrypt(testBuffer, testBuffer, 1, 1, 1, 1, testCB); diff --git a/types/scrypt-js/tsconfig.json b/types/scrypt-js/tsconfig.json new file mode 100644 index 0000000000..8c6c60e736 --- /dev/null +++ b/types/scrypt-js/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "scrypt-js-tests.ts" + ] +} diff --git a/types/scrypt-js/tslint.json b/types/scrypt-js/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/scrypt-js/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}