forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbcryptjs-tests.ts
More file actions
70 lines (58 loc) · 1.71 KB
/
bcryptjs-tests.ts
File metadata and controls
70 lines (58 loc) · 1.71 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
65
66
67
68
69
70
import bcryptjs = require("bcryptjs");
let str: string;
let num: number;
let bool: boolean;
let arr: number[];
let error: Error;
str = bcryptjs.genSaltSync();
str = bcryptjs.genSaltSync(10);
bcryptjs.genSalt((err: Error | null, salt: string) => {
str = salt;
});
bcryptjs.genSalt(10, (err: Error | null, salt: string) => {
str = salt;
});
bcryptjs.genSalt()
.then(salt => str = salt)
.catch(err => error = err);
bcryptjs.genSalt(10)
.then(salt => str = salt)
.catch(err => error = err);
str = bcryptjs.hashSync("string");
str = bcryptjs.hashSync("string", 10);
str = bcryptjs.hashSync("string", "salt");
bcryptjs.hash("string", 10, (err: Error | null, hash: string) => {
str = hash;
});
bcryptjs.hash("string", 10, (err: Error | null, hash: string) => {
str = hash;
}, (percent: number) => {
num = percent;
});
bcryptjs.hash("string", 10)
.then(salt => str = salt)
.catch(err => error = err);
bcryptjs.hash("string", "salt", (err: Error | null, hash: string) => {
str = hash;
});
bcryptjs.hash("string", "salt", (err: Error | null, hash: string) => {
str = hash;
}, (percent: number) => {
num = percent;
});
bool = bcryptjs.compareSync("string1", "string2");
bcryptjs.compare("string1", "string2", (err: Error | null, success: boolean) => {
bool = success;
});
bcryptjs.compare("string1", "string2", (err: Error | null, success: boolean) => {
bool = success;
}, (percent: number) => {
num = percent;
});
bcryptjs.compare("string1", "string2")
.then(success => bool = success)
.catch(err => error = err);
num = bcryptjs.getRounds("string");
str = bcryptjs.getSalt("string");
str = bcryptjs.encodeBase64([1, 2, 3, 4, 5], 5);
arr = bcryptjs.decodeBase64("string", 5);