@vlasky/shacrypt 0.5.0 → 0.5.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.1] - 2026-01-29
4
+
5
+ ### Added
6
+ - TypeScript type declarations (`index.d.ts`)
7
+
3
8
  ## [0.5.0] - 2026-01-28
4
9
 
5
10
  ### Changed
package/README.md CHANGED
@@ -16,6 +16,8 @@ Asynchronous mode is especially useful in that computation is performed in Node.
16
16
  npm install @vlasky/shacrypt
17
17
  ```
18
18
 
19
+ TypeScript type declarations are included.
20
+
19
21
  NOTE: You will need to have C++ build tools installed on your system to successfully install the package. If you are running under Windows, you can download Microsoft's [Build Tools for Visual Studio 2017](https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017).
20
22
 
21
23
  ### Usage
package/index.d.ts ADDED
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Callback function for async hash operations.
3
+ */
4
+ type HashCallback = (error: Error | null, hash: string) => void;
5
+
6
+ /**
7
+ * Generate SHA256-CRYPT hash (synchronous).
8
+ *
9
+ * @param password - The password to hash
10
+ * @param salt - Optional salt string (auto-generated if not provided)
11
+ * @param rounds - Optional number of rounds (default: 5000, minimum: 1000)
12
+ * @returns The hashed password string
13
+ */
14
+ export function sha256crypt(password: string, salt?: string, rounds?: number): string;
15
+
16
+ /**
17
+ * Generate SHA256-CRYPT hash (callback-based async).
18
+ *
19
+ * @param password - The password to hash
20
+ * @param salt - Optional salt string (auto-generated if not provided)
21
+ * @param rounds - Optional number of rounds (default: 5000, minimum: 1000)
22
+ * @param callback - Callback function receiving (error, hash)
23
+ */
24
+ export function sha256crypt(password: string, salt: string | undefined, rounds: number | undefined, callback: HashCallback): void;
25
+
26
+ /**
27
+ * Generate SHA512-CRYPT hash (synchronous).
28
+ *
29
+ * @param password - The password to hash
30
+ * @param salt - Optional salt string (auto-generated if not provided)
31
+ * @param rounds - Optional number of rounds (default: 5000, minimum: 1000)
32
+ * @returns The hashed password string
33
+ */
34
+ export function sha512crypt(password: string, salt?: string, rounds?: number): string;
35
+
36
+ /**
37
+ * Generate SHA512-CRYPT hash (callback-based async).
38
+ *
39
+ * @param password - The password to hash
40
+ * @param salt - Optional salt string (auto-generated if not provided)
41
+ * @param rounds - Optional number of rounds (default: 5000, minimum: 1000)
42
+ * @param callback - Callback function receiving (error, hash)
43
+ */
44
+ export function sha512crypt(password: string, salt: string | undefined, rounds: number | undefined, callback: HashCallback): void;
45
+
46
+ /**
47
+ * Generate SHA256-CRYPT hash (async/await compatible).
48
+ *
49
+ * @param password - The password to hash
50
+ * @param salt - Optional salt string (auto-generated if not provided)
51
+ * @param rounds - Optional number of rounds (default: 5000, minimum: 1000)
52
+ * @returns Promise resolving to the hashed password string
53
+ */
54
+ export function sha256cryptAsync(password: string, salt?: string, rounds?: number): Promise<string>;
55
+
56
+ /**
57
+ * Generate SHA512-CRYPT hash (async/await compatible).
58
+ *
59
+ * @param password - The password to hash
60
+ * @param salt - Optional salt string (auto-generated if not provided)
61
+ * @param rounds - Optional number of rounds (default: 5000, minimum: 1000)
62
+ * @returns Promise resolving to the hashed password string
63
+ */
64
+ export function sha512cryptAsync(password: string, salt?: string, rounds?: number): Promise<string>;
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@vlasky/shacrypt",
3
3
  "description": "Node.js wrapper over sha256-crypt and sha512-crypt functions originally created by Ulrich Drepper https://www.akkadia.org/drepper/SHA-crypt.txt",
4
- "version": "0.5.0",
4
+ "version": "0.5.1",
5
5
  "homepage": "https://github.com/vlasky/shacrypt",
6
6
  "author": "Vlad Lasky <github@vladlasky.com> (https://github.com/vlasky/)",
7
7
  "contributors": [
8
8
  "Oleksiy Krivoshey <oleksiyk@gmail.com> (https://github.com/oleksiyk/)"
9
9
  ],
10
10
  "main": "shacrypt",
11
+ "types": "index.d.ts",
11
12
  "scripts": {
12
13
  "install": "node-gyp rebuild",
13
14
  "test": "make test"