forked from oleksiyk/shacrypt
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.d.ts
More file actions
64 lines (58 loc) · 2.54 KB
/
Copy pathindex.d.ts
File metadata and controls
64 lines (58 loc) · 2.54 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* Callback function for async hash operations.
*/
type HashCallback = (error: Error | null, hash: string) => void;
/**
* Generate SHA256-CRYPT hash (synchronous).
*
* @param password - The password to hash
* @param salt - Optional salt string (auto-generated if not provided)
* @param rounds - Optional number of rounds (default: 5000, minimum: 1000)
* @returns The hashed password string
*/
export function sha256crypt(password: string, salt?: string, rounds?: number): string;
/**
* Generate SHA256-CRYPT hash (callback-based async).
*
* @param password - The password to hash
* @param salt - Optional salt string (auto-generated if not provided)
* @param rounds - Optional number of rounds (default: 5000, minimum: 1000)
* @param callback - Callback function receiving (error, hash)
*/
export function sha256crypt(password: string, salt: string | undefined, rounds: number | undefined, callback: HashCallback): void;
/**
* Generate SHA512-CRYPT hash (synchronous).
*
* @param password - The password to hash
* @param salt - Optional salt string (auto-generated if not provided)
* @param rounds - Optional number of rounds (default: 5000, minimum: 1000)
* @returns The hashed password string
*/
export function sha512crypt(password: string, salt?: string, rounds?: number): string;
/**
* Generate SHA512-CRYPT hash (callback-based async).
*
* @param password - The password to hash
* @param salt - Optional salt string (auto-generated if not provided)
* @param rounds - Optional number of rounds (default: 5000, minimum: 1000)
* @param callback - Callback function receiving (error, hash)
*/
export function sha512crypt(password: string, salt: string | undefined, rounds: number | undefined, callback: HashCallback): void;
/**
* Generate SHA256-CRYPT hash (async/await compatible).
*
* @param password - The password to hash
* @param salt - Optional salt string (auto-generated if not provided)
* @param rounds - Optional number of rounds (default: 5000, minimum: 1000)
* @returns Promise resolving to the hashed password string
*/
export function sha256cryptAsync(password: string, salt?: string, rounds?: number): Promise<string>;
/**
* Generate SHA512-CRYPT hash (async/await compatible).
*
* @param password - The password to hash
* @param salt - Optional salt string (auto-generated if not provided)
* @param rounds - Optional number of rounds (default: 5000, minimum: 1000)
* @returns Promise resolving to the hashed password string
*/
export function sha512cryptAsync(password: string, salt?: string, rounds?: number): Promise<string>;