inslash 1.0.2 → 1.0.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Inslash
3
+ Copyright (c) 2026 Reshuk Sapkota
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,15 +1,39 @@
1
- {
2
- "name": "inslash",
3
- "version": "1.0.2",
4
- "main": "index.js",
5
- "scripts": {
6
- "test": "echo \"Error: no test specified\" && exit 1"
7
- },
8
- "keywords": [],
9
- "author": "Reshuk Sapkota",
10
- "license": "MIT",
11
- "description": "",
12
- "dependencies": {
13
- "crypto": "^1.0.1"
14
- }
15
- }
1
+ {
2
+ "name": "inslash",
3
+ "version": "1.0.3",
4
+ "description": "A modern, upgradeable, and secure password hashing utility with passport encoding and hash ancestry.",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "scripts": {
8
+ "test": "node cstest.js"
9
+ },
10
+ "keywords": [
11
+ "password",
12
+ "hash",
13
+ "security",
14
+ "crypto",
15
+ "salt",
16
+ "pepper",
17
+ "upgradeable",
18
+ "passport",
19
+ "nodejs"
20
+ ],
21
+ "author": "Reshuk Sapkota",
22
+ "license": "MIT",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/reshuk-code/inslash"
26
+ },
27
+ "bugs": {
28
+ "url": "https://github.com/reshuk-code/inslash/issues"
29
+ },
30
+ "homepage": "https://github.com/reshuk-code/inslash#readme",
31
+ "files": [
32
+ "index.js",
33
+ "README.md",
34
+ "LICENSE"
35
+ ],
36
+ "engines": {
37
+ "node": ">=16"
38
+ }
39
+ }
package/cstest.js DELETED
@@ -1,49 +0,0 @@
1
- const { hash, verify } = require("./script");
2
-
3
- const SECRET_KEY = "supersecret";
4
-
5
- // 1. Rainbow Table Attack
6
- (async () => {
7
- const a = await hash("password123", SECRET_KEY);
8
- const b = await hash("password123", SECRET_KEY);
9
- console.log("Rainbow Table Test:", a.hash !== b.hash ? "PASS" : "FAIL");
10
-
11
- // 2. Brute Force Attack (timing)
12
- console.time("Low Iterations");
13
- await hash("password123", SECRET_KEY, { iterations: 1000 });
14
- console.timeEnd("Low Iterations");
15
-
16
- console.time("High Iterations");
17
- await hash("password123", SECRET_KEY, { iterations: 200_000 });
18
- console.timeEnd("High Iterations");
19
-
20
- // 3. Timing Attack (should use timingSafeEqual)
21
- const v = await verify("password123", a.passport, SECRET_KEY);
22
- console.log("Timing Safe Equal Test:", v.valid ? "PASS" : "FAIL");
23
-
24
- // 4. Salt Storage
25
- console.log("Salt Unique Test:", a.salt !== b.salt ? "PASS" : "FAIL");
26
-
27
- // 5. Pepper Security
28
- process.env.HASH_PEPPER = "pepper";
29
- const withPepper = await hash("password123", SECRET_KEY);
30
- process.env.HASH_PEPPER = "";
31
- const vPepper = await verify("password123", withPepper.passport, SECRET_KEY);
32
- console.log("Pepper Security Test:", vPepper.valid ? "FAIL" : "PASS");
33
-
34
- // 6. Upgrade Path
35
- const vUpgrade = await verify("password123", a.passport, SECRET_KEY, { iterations: 200_000 });
36
- console.log("Upgrade Path Test:", vUpgrade.needsUpgrade ? "PASS" : "FAIL");
37
-
38
- // 7. Input Validation
39
- try {
40
- await hash(null, SECRET_KEY);
41
- console.log("Null Input Test: FAIL");
42
- } catch {
43
- console.log("Null Input Test: PASS");
44
- }
45
-
46
- // 8. Collision Resistance
47
- const c = await hash("passwordABC", SECRET_KEY);
48
- console.log("Collision Resistance Test:", a.hash !== c.hash ? "PASS" : "FAIL");
49
- })();
package/test.js DELETED
@@ -1,22 +0,0 @@
1
- const { hash, verify } = require("./script");
2
-
3
- const SECRET_KEY = process.env.HASH_SECRET || "abcd";
4
-
5
- // create hash
6
- (async () => {
7
- const result = await hash("Happy", SECRET_KEY, {
8
- iterations: 150_000
9
- });
10
-
11
- console.log(result);
12
-
13
- // verify
14
- const verifyResult = await verify(
15
- "Happy",
16
- result.passport, // <-- use passport, not salt/hash
17
- SECRET_KEY,
18
- { iterations: result.iterations }
19
- );
20
-
21
- console.log(verifyResult); // { valid: true, needsUpgrade: false, upgradedPassport: null }
22
- })();
File without changes