forked from ranisalt/node-argon2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathargon2.d.ts
50 lines (44 loc) · 1.05 KB
/
argon2.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Type definitions for argon2 v0.19.2
/// <reference types="node" />
export interface Options {
hashLength?: number;
timeCost?: number;
memoryCost?: number;
parallelism?: number;
type?: 0 | 1 | 2;
version?: number;
salt?: Buffer;
saltLength?: number;
raw?: boolean;
secret?: Buffer;
associatedData?: Buffer;
}
export interface NumericLimit {
max: number;
min: number;
}
export interface OptionLimits {
hashLength: NumericLimit;
memoryCost: NumericLimit;
timeCost: NumericLimit;
parallelism: NumericLimit;
}
export const argon2d: 0;
export const argon2i: 1;
export const argon2id: 2;
export const defaults: Options;
export const limits: OptionLimits;
export function hash(
plain: Buffer | string,
options: Options & { raw: true }
): Promise<Buffer>;
export function hash(
plain: Buffer | string,
options?: Options & { raw?: false }
): Promise<string>;
export function verify(
hash: string,
plain: Buffer | string,
options?: Options
): Promise<boolean>;
export function needsRehash(hash: string, options?: Options): boolean;