bcrypt-ts 2.2.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +78 -0
- package/README.md +206 -3
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.mjs.map +1 -1
- package/dist/node.cjs.map +1 -1
- package/dist/node.mjs.map +1 -1
- package/package.json +20 -17
- package/dist/browser.d.ts +0 -83
- package/dist/node.d.ts +0 -83
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bcrypt-ts",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "bcrypt written in typescript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bcrypt",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
+
"types": "./dist/node.d.mts",
|
|
18
19
|
"browser": "./dist/browser.mjs",
|
|
19
20
|
"node": "./dist/node.mjs",
|
|
20
21
|
"import": "./dist/node.mjs",
|
|
@@ -22,11 +23,13 @@
|
|
|
22
23
|
"default": "./dist/node.cjs"
|
|
23
24
|
},
|
|
24
25
|
"./browser": {
|
|
26
|
+
"types": "./dist/browser.d.mts",
|
|
25
27
|
"import": "./dist/browser.mjs",
|
|
26
28
|
"require": "./dist/browser.cjs",
|
|
27
29
|
"default": "./dist/browser.mjs"
|
|
28
30
|
},
|
|
29
31
|
"./node": {
|
|
32
|
+
"types": "./dist/node.d.mts",
|
|
30
33
|
"import": "./dist/node.mjs",
|
|
31
34
|
"require": "./dist/node.cjs",
|
|
32
35
|
"default": "./dist/node.cjs"
|
|
@@ -35,32 +38,32 @@
|
|
|
35
38
|
"main": "./dist/node.cjs",
|
|
36
39
|
"module": "./dist/node.mjs",
|
|
37
40
|
"browser": "./dist/browser.mjs",
|
|
38
|
-
"types": "./dist/
|
|
41
|
+
"types": "./dist/node.d.mts",
|
|
39
42
|
"files": [
|
|
40
43
|
"dist"
|
|
41
44
|
],
|
|
42
|
-
"packageManager": "pnpm@7.
|
|
45
|
+
"packageManager": "pnpm@7.14.1",
|
|
43
46
|
"devDependencies": {
|
|
44
|
-
"@rollup/plugin-alias": "
|
|
45
|
-
"@rollup/plugin-replace": "
|
|
46
|
-
"@rollup/plugin-typescript": "
|
|
47
|
-
"@types/node": "18.
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
49
|
-
"@typescript-eslint/parser": "5.
|
|
50
|
-
"@vitest/coverage-c8": "0.
|
|
47
|
+
"@rollup/plugin-alias": "4.0.2",
|
|
48
|
+
"@rollup/plugin-replace": "5.0.1",
|
|
49
|
+
"@rollup/plugin-typescript": "9.0.2",
|
|
50
|
+
"@types/node": "18.11.9",
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "5.42.0",
|
|
52
|
+
"@typescript-eslint/parser": "5.42.0",
|
|
53
|
+
"@vitest/coverage-c8": "0.24.4",
|
|
51
54
|
"c8": "7.12.0",
|
|
52
|
-
"eslint": "8.
|
|
55
|
+
"eslint": "8.26.0",
|
|
53
56
|
"eslint-config-prettier": "8.5.0",
|
|
54
57
|
"eslint-plugin-prettier": "4.2.1",
|
|
55
58
|
"prettier": "2.7.1",
|
|
56
59
|
"rimraf": "3.0.2",
|
|
57
|
-
"rollup": "2.
|
|
58
|
-
"rollup-plugin-dts": "
|
|
60
|
+
"rollup": "3.2.5",
|
|
61
|
+
"rollup-plugin-dts": "5.0.0",
|
|
59
62
|
"rollup-plugin-terser": "7.0.2",
|
|
60
|
-
"tslib": "2.4.
|
|
61
|
-
"typescript": "4.8.
|
|
62
|
-
"vite": "3.
|
|
63
|
-
"vitest": "0.
|
|
63
|
+
"tslib": "2.4.1",
|
|
64
|
+
"typescript": "4.8.4",
|
|
65
|
+
"vite": "3.2.2",
|
|
66
|
+
"vitest": "0.24.4"
|
|
64
67
|
},
|
|
65
68
|
"scripts": {
|
|
66
69
|
"build": "rollup -c",
|
package/dist/browser.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Encodes a byte array to base64 with up to len bytes of input, using the custom bcrypt alphabet.
|
|
3
|
-
*
|
|
4
|
-
* @param byteArray Byte array
|
|
5
|
-
* @param length Maximum input length
|
|
6
|
-
*/
|
|
7
|
-
declare const encodeBase64: (byteArray: number[] | Buffer, length: number) => string;
|
|
8
|
-
/**
|
|
9
|
-
* Decodes a base64 encoded string to up to len bytes of output, using the custom bcrypt alphabet.
|
|
10
|
-
*
|
|
11
|
-
* @param contentString String to decode
|
|
12
|
-
* @param length Maximum output length
|
|
13
|
-
*/
|
|
14
|
-
declare const decodeBase64: (contentString: string, length: number) => number[];
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Synchronously tests a string against a hash.
|
|
18
|
-
*
|
|
19
|
-
* @param content String to compare
|
|
20
|
-
* @param hash Hash to test against
|
|
21
|
-
*/
|
|
22
|
-
declare const compareSync: (content: string, hash: string) => boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Asynchronously compares the given data against the given hash.
|
|
25
|
-
*
|
|
26
|
-
* @param content Data to compare
|
|
27
|
-
* @param hash Data to be compared to
|
|
28
|
-
* @param progressCallback Callback successively called with the percentage of rounds completed
|
|
29
|
-
* (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms.
|
|
30
|
-
*/
|
|
31
|
-
declare const compare: (content: string, hash: string, progressCallback?: ((percent: number) => void) | undefined) => Promise<boolean>;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Synchronously generates a hash for the given string.
|
|
35
|
-
*
|
|
36
|
-
* @param contentString String to hash
|
|
37
|
-
* @param salt Salt length to generate or salt to use, default to 10
|
|
38
|
-
* @returns Resulting hash
|
|
39
|
-
*/
|
|
40
|
-
declare const hashSync: (contentString: string, salt?: string | number) => string;
|
|
41
|
-
/**
|
|
42
|
-
* Asynchronously generates a hash for the given string.
|
|
43
|
-
*
|
|
44
|
-
* @param contentString String to hash
|
|
45
|
-
* @param salt Salt length to generate or salt to use
|
|
46
|
-
* @param progressCallback Callback successively called with the percentage of rounds completed
|
|
47
|
-
* (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms.
|
|
48
|
-
*/
|
|
49
|
-
declare const hash: (contentString: string, salt: number | string, progressCallback?: ((progress: number) => void) | undefined) => Promise<string>;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Gets the number of rounds used to encrypt the specified hash.
|
|
53
|
-
*
|
|
54
|
-
* @param hash Hash to extract the used number of rounds from
|
|
55
|
-
* @returns Number of rounds used
|
|
56
|
-
* @throws {Error} If `hash` is not a string
|
|
57
|
-
*/
|
|
58
|
-
declare const getRounds: (hash: string) => number;
|
|
59
|
-
/**
|
|
60
|
-
* Gets the salt portion from a hash. Does not validate the hash.
|
|
61
|
-
*
|
|
62
|
-
* @param hash Hash to extract the salt from
|
|
63
|
-
* @returns Extracted salt part
|
|
64
|
-
* @throws {Error} If `hash` is not a string or otherwise invalid
|
|
65
|
-
*/
|
|
66
|
-
declare const getSalt: (hash: string) => string;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Synchronously generates a salt.
|
|
70
|
-
*
|
|
71
|
-
* @param rounds Number of rounds to use, defaults to 10 if omitted
|
|
72
|
-
* @returns Resulting salt
|
|
73
|
-
* @throws {Error} If a random fallback is required but not set
|
|
74
|
-
*/
|
|
75
|
-
declare const genSaltSync: (rounds?: number) => string;
|
|
76
|
-
/**
|
|
77
|
-
* Asynchronously generates a salt.
|
|
78
|
-
*
|
|
79
|
-
* @param rounds Number of rounds to use, defaults to 10 if omitted
|
|
80
|
-
*/
|
|
81
|
-
declare const genSalt: (rounds?: number) => Promise<string>;
|
|
82
|
-
|
|
83
|
-
export { compare, compareSync, decodeBase64, encodeBase64, genSalt, genSaltSync, getRounds, getSalt, hash, hashSync };
|
package/dist/node.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Encodes a byte array to base64 with up to len bytes of input, using the custom bcrypt alphabet.
|
|
3
|
-
*
|
|
4
|
-
* @param byteArray Byte array
|
|
5
|
-
* @param length Maximum input length
|
|
6
|
-
*/
|
|
7
|
-
declare const encodeBase64: (byteArray: number[] | Buffer, length: number) => string;
|
|
8
|
-
/**
|
|
9
|
-
* Decodes a base64 encoded string to up to len bytes of output, using the custom bcrypt alphabet.
|
|
10
|
-
*
|
|
11
|
-
* @param contentString String to decode
|
|
12
|
-
* @param length Maximum output length
|
|
13
|
-
*/
|
|
14
|
-
declare const decodeBase64: (contentString: string, length: number) => number[];
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Synchronously tests a string against a hash.
|
|
18
|
-
*
|
|
19
|
-
* @param content String to compare
|
|
20
|
-
* @param hash Hash to test against
|
|
21
|
-
*/
|
|
22
|
-
declare const compareSync: (content: string, hash: string) => boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Asynchronously compares the given data against the given hash.
|
|
25
|
-
*
|
|
26
|
-
* @param content Data to compare
|
|
27
|
-
* @param hash Data to be compared to
|
|
28
|
-
* @param progressCallback Callback successively called with the percentage of rounds completed
|
|
29
|
-
* (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms.
|
|
30
|
-
*/
|
|
31
|
-
declare const compare: (content: string, hash: string, progressCallback?: ((percent: number) => void) | undefined) => Promise<boolean>;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Synchronously generates a hash for the given string.
|
|
35
|
-
*
|
|
36
|
-
* @param contentString String to hash
|
|
37
|
-
* @param salt Salt length to generate or salt to use, default to 10
|
|
38
|
-
* @returns Resulting hash
|
|
39
|
-
*/
|
|
40
|
-
declare const hashSync: (contentString: string, salt?: string | number) => string;
|
|
41
|
-
/**
|
|
42
|
-
* Asynchronously generates a hash for the given string.
|
|
43
|
-
*
|
|
44
|
-
* @param contentString String to hash
|
|
45
|
-
* @param salt Salt length to generate or salt to use
|
|
46
|
-
* @param progressCallback Callback successively called with the percentage of rounds completed
|
|
47
|
-
* (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms.
|
|
48
|
-
*/
|
|
49
|
-
declare const hash: (contentString: string, salt: number | string, progressCallback?: ((progress: number) => void) | undefined) => Promise<string>;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Gets the number of rounds used to encrypt the specified hash.
|
|
53
|
-
*
|
|
54
|
-
* @param hash Hash to extract the used number of rounds from
|
|
55
|
-
* @returns Number of rounds used
|
|
56
|
-
* @throws {Error} If `hash` is not a string
|
|
57
|
-
*/
|
|
58
|
-
declare const getRounds: (hash: string) => number;
|
|
59
|
-
/**
|
|
60
|
-
* Gets the salt portion from a hash. Does not validate the hash.
|
|
61
|
-
*
|
|
62
|
-
* @param hash Hash to extract the salt from
|
|
63
|
-
* @returns Extracted salt part
|
|
64
|
-
* @throws {Error} If `hash` is not a string or otherwise invalid
|
|
65
|
-
*/
|
|
66
|
-
declare const getSalt: (hash: string) => string;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Synchronously generates a salt.
|
|
70
|
-
*
|
|
71
|
-
* @param rounds Number of rounds to use, defaults to 10 if omitted
|
|
72
|
-
* @returns Resulting salt
|
|
73
|
-
* @throws {Error} If a random fallback is required but not set
|
|
74
|
-
*/
|
|
75
|
-
declare const genSaltSync: (rounds?: number) => string;
|
|
76
|
-
/**
|
|
77
|
-
* Asynchronously generates a salt.
|
|
78
|
-
*
|
|
79
|
-
* @param rounds Number of rounds to use, defaults to 10 if omitted
|
|
80
|
-
*/
|
|
81
|
-
declare const genSalt: (rounds?: number) => Promise<string>;
|
|
82
|
-
|
|
83
|
-
export { compare, compareSync, decodeBase64, encodeBase64, genSalt, genSaltSync, getRounds, getSalt, hash, hashSync };
|