mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
scrypt-js: change types of password and salt to accept Array and Uint8Array (#35171)
This commit is contained in:
parent
129ec7b668
commit
02daed3e94
5
types/scrypt-js/index.d.ts
vendored
5
types/scrypt-js/index.d.ts
vendored
@ -1,13 +1,14 @@
|
||||
// Type definitions for scrypt-js 2.0
|
||||
// Project: https://github.com/ricmoo/scrypt-js
|
||||
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
|
||||
// Romain Delamare <https://github.com/alightgoesout>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types= "node" />
|
||||
|
||||
declare function scrypt(
|
||||
password: Buffer,
|
||||
salt: Buffer,
|
||||
password: Buffer | ReadonlyArray<number> | Uint8Array,
|
||||
salt: Buffer | ReadonlyArray<number> | Uint8Array,
|
||||
N: number,
|
||||
r: number,
|
||||
p: number,
|
||||
|
||||
@ -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<number>) => {};
|
||||
|
||||
// $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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user