@rudderjs/hash 0.0.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/LICENSE +21 -0
- package/README.md +67 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +115 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Suleiman Shahbari
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @rudderjs/hash
|
|
2
|
+
|
|
3
|
+
One-way password hashing for RudderJS. Built-in drivers: **bcrypt** (default) and **argon2**.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @rudderjs/hash
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
For argon2 support:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add argon2
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Setup
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
// config/hash.ts
|
|
21
|
+
export default {
|
|
22
|
+
driver: 'bcrypt',
|
|
23
|
+
bcrypt: { rounds: 12 },
|
|
24
|
+
argon2: { memory: 65536, time: 3, threads: 4 },
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// bootstrap/providers.ts
|
|
28
|
+
import { hash } from '@rudderjs/hash'
|
|
29
|
+
export default [hash(configs.hash), ...]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { Hash } from '@rudderjs/hash'
|
|
36
|
+
|
|
37
|
+
// Hash a password
|
|
38
|
+
const hashed = await Hash.make('password')
|
|
39
|
+
|
|
40
|
+
// Verify a password
|
|
41
|
+
const valid = await Hash.check('password', hashed) // true
|
|
42
|
+
|
|
43
|
+
// Check if rehash is needed (e.g. after changing rounds)
|
|
44
|
+
if (Hash.needsRehash(hashed)) {
|
|
45
|
+
const newHash = await Hash.make('password')
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Drivers
|
|
50
|
+
|
|
51
|
+
### Bcrypt (default)
|
|
52
|
+
|
|
53
|
+
Uses `bcryptjs` (pure JS, no native compilation needed).
|
|
54
|
+
|
|
55
|
+
| Option | Default | Description |
|
|
56
|
+
|--------|---------|-------------|
|
|
57
|
+
| `rounds` | `12` | Cost factor (2^rounds iterations) |
|
|
58
|
+
|
|
59
|
+
### Argon2
|
|
60
|
+
|
|
61
|
+
Uses the `argon2` package (native, requires compilation). Uses argon2id variant.
|
|
62
|
+
|
|
63
|
+
| Option | Default | Description |
|
|
64
|
+
|--------|---------|-------------|
|
|
65
|
+
| `memory` | `65536` | Memory cost in KiB |
|
|
66
|
+
| `time` | `3` | Time cost (iterations) |
|
|
67
|
+
| `threads` | `4` | Parallelism factor |
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ServiceProvider, type Application } from '@rudderjs/core';
|
|
2
|
+
export interface HashDriver {
|
|
3
|
+
make(value: string): Promise<string>;
|
|
4
|
+
check(value: string, hashed: string): Promise<boolean>;
|
|
5
|
+
needsRehash(hashed: string): boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class HashRegistry {
|
|
8
|
+
private static driver;
|
|
9
|
+
static set(driver: HashDriver): void;
|
|
10
|
+
static get(): HashDriver | null;
|
|
11
|
+
/** @internal */
|
|
12
|
+
static reset(): void;
|
|
13
|
+
}
|
|
14
|
+
export declare class Hash {
|
|
15
|
+
private static driver;
|
|
16
|
+
/** Hash a plain-text value. */
|
|
17
|
+
static make(value: string): Promise<string>;
|
|
18
|
+
/** Check a plain-text value against a hash. */
|
|
19
|
+
static check(value: string, hashed: string): Promise<boolean>;
|
|
20
|
+
/** Determine if a hash needs to be rehashed (e.g. cost changed). */
|
|
21
|
+
static needsRehash(hashed: string): boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface BcryptConfig {
|
|
24
|
+
rounds?: number;
|
|
25
|
+
}
|
|
26
|
+
export declare class BcryptDriver implements HashDriver {
|
|
27
|
+
private readonly rounds;
|
|
28
|
+
constructor(config?: BcryptConfig);
|
|
29
|
+
make(value: string): Promise<string>;
|
|
30
|
+
check(value: string, hashed: string): Promise<boolean>;
|
|
31
|
+
needsRehash(hashed: string): boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface Argon2Config {
|
|
34
|
+
memory?: number;
|
|
35
|
+
time?: number;
|
|
36
|
+
threads?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare class Argon2Driver implements HashDriver {
|
|
39
|
+
private readonly memory;
|
|
40
|
+
private readonly time;
|
|
41
|
+
private readonly threads;
|
|
42
|
+
constructor(config?: Argon2Config);
|
|
43
|
+
make(value: string): Promise<string>;
|
|
44
|
+
check(value: string, hashed: string): Promise<boolean>;
|
|
45
|
+
needsRehash(hashed: string): boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface HashConfig {
|
|
48
|
+
driver: 'bcrypt' | 'argon2';
|
|
49
|
+
bcrypt?: BcryptConfig;
|
|
50
|
+
argon2?: Argon2Config;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Returns a HashServiceProvider class configured for the given hash config.
|
|
54
|
+
*
|
|
55
|
+
* Built-in drivers: bcrypt (default, uses bcryptjs)
|
|
56
|
+
* argon2 (requires argon2: pnpm add argon2)
|
|
57
|
+
*
|
|
58
|
+
* Usage in bootstrap/providers.ts:
|
|
59
|
+
* import { hash } from '@rudderjs/hash'
|
|
60
|
+
* import configs from '../config/index.js'
|
|
61
|
+
* export default [..., hash(configs.hash), ...]
|
|
62
|
+
*/
|
|
63
|
+
export declare function hash(config: HashConfig): new (app: Application) => ServiceProvider;
|
|
64
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAIlE,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACpC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACtD,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;CACrC;AAID,qBAAa,YAAY;IACvB,O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,OAAO,CAAQ;gBAEpB,MAAM,CAAC,EAAE,YAAY;IAM3B,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUpC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK5D,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;CAUrC;AAID,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC3B,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,MAAM,CAAC,EAAE,YAAY,CAAA;CACtB;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,KAAK,GAAG,EAAE,WAAW,KAAK,eAAe,CAqBlF"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { ServiceProvider } from '@rudderjs/core';
|
|
2
|
+
// ─── Hash Registry ────────────────────────────────────────
|
|
3
|
+
export class HashRegistry {
|
|
4
|
+
static driver = null;
|
|
5
|
+
static set(driver) { this.driver = driver; }
|
|
6
|
+
static get() { return this.driver; }
|
|
7
|
+
/** @internal */
|
|
8
|
+
static reset() { this.driver = null; }
|
|
9
|
+
}
|
|
10
|
+
// ─── Hash Facade ──────────────────────────────────────────
|
|
11
|
+
export class Hash {
|
|
12
|
+
static driver() {
|
|
13
|
+
const d = HashRegistry.get();
|
|
14
|
+
if (!d)
|
|
15
|
+
throw new Error('[RudderJS Hash] No hash driver registered. Add hash() to providers.');
|
|
16
|
+
return d;
|
|
17
|
+
}
|
|
18
|
+
/** Hash a plain-text value. */
|
|
19
|
+
static make(value) {
|
|
20
|
+
return this.driver().make(value);
|
|
21
|
+
}
|
|
22
|
+
/** Check a plain-text value against a hash. */
|
|
23
|
+
static check(value, hashed) {
|
|
24
|
+
return this.driver().check(value, hashed);
|
|
25
|
+
}
|
|
26
|
+
/** Determine if a hash needs to be rehashed (e.g. cost changed). */
|
|
27
|
+
static needsRehash(hashed) {
|
|
28
|
+
return this.driver().needsRehash(hashed);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export class BcryptDriver {
|
|
32
|
+
rounds;
|
|
33
|
+
constructor(config) {
|
|
34
|
+
this.rounds = config?.rounds ?? 12;
|
|
35
|
+
}
|
|
36
|
+
async make(value) {
|
|
37
|
+
const bcrypt = (await import('bcryptjs')).default;
|
|
38
|
+
return bcrypt.hash(value, this.rounds);
|
|
39
|
+
}
|
|
40
|
+
async check(value, hashed) {
|
|
41
|
+
const bcrypt = (await import('bcryptjs')).default;
|
|
42
|
+
return bcrypt.compare(value, hashed);
|
|
43
|
+
}
|
|
44
|
+
needsRehash(hashed) {
|
|
45
|
+
const match = hashed.match(/^\$2[aby]?\$(\d{2})\$/);
|
|
46
|
+
if (!match)
|
|
47
|
+
return true;
|
|
48
|
+
return parseInt(match[1], 10) !== this.rounds;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export class Argon2Driver {
|
|
52
|
+
memory;
|
|
53
|
+
time;
|
|
54
|
+
threads;
|
|
55
|
+
constructor(config) {
|
|
56
|
+
this.memory = config?.memory ?? 65536;
|
|
57
|
+
this.time = config?.time ?? 3;
|
|
58
|
+
this.threads = config?.threads ?? 4;
|
|
59
|
+
}
|
|
60
|
+
async make(value) {
|
|
61
|
+
const argon2 = await import('argon2');
|
|
62
|
+
return argon2.hash(value, {
|
|
63
|
+
type: 2, // argon2id
|
|
64
|
+
memoryCost: this.memory,
|
|
65
|
+
timeCost: this.time,
|
|
66
|
+
parallelism: this.threads,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async check(value, hashed) {
|
|
70
|
+
const argon2 = await import('argon2');
|
|
71
|
+
return argon2.verify(hashed, value);
|
|
72
|
+
}
|
|
73
|
+
needsRehash(hashed) {
|
|
74
|
+
// Argon2 encodes params in the hash: $argon2id$v=19$m=65536,t=3,p=4$...
|
|
75
|
+
const match = hashed.match(/\$m=(\d+),t=(\d+),p=(\d+)\$/);
|
|
76
|
+
if (!match)
|
|
77
|
+
return true;
|
|
78
|
+
return (parseInt(match[1], 10) !== this.memory ||
|
|
79
|
+
parseInt(match[2], 10) !== this.time ||
|
|
80
|
+
parseInt(match[3], 10) !== this.threads);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// ─── Service Provider Factory ─────────────────────────────
|
|
84
|
+
/**
|
|
85
|
+
* Returns a HashServiceProvider class configured for the given hash config.
|
|
86
|
+
*
|
|
87
|
+
* Built-in drivers: bcrypt (default, uses bcryptjs)
|
|
88
|
+
* argon2 (requires argon2: pnpm add argon2)
|
|
89
|
+
*
|
|
90
|
+
* Usage in bootstrap/providers.ts:
|
|
91
|
+
* import { hash } from '@rudderjs/hash'
|
|
92
|
+
* import configs from '../config/index.js'
|
|
93
|
+
* export default [..., hash(configs.hash), ...]
|
|
94
|
+
*/
|
|
95
|
+
export function hash(config) {
|
|
96
|
+
class HashServiceProvider extends ServiceProvider {
|
|
97
|
+
register() { }
|
|
98
|
+
async boot() {
|
|
99
|
+
let driver;
|
|
100
|
+
if (config.driver === 'bcrypt') {
|
|
101
|
+
driver = new BcryptDriver(config.bcrypt);
|
|
102
|
+
}
|
|
103
|
+
else if (config.driver === 'argon2') {
|
|
104
|
+
driver = new Argon2Driver(config.argon2);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
throw new Error(`[RudderJS Hash] Unknown driver "${config.driver}". Available: bcrypt, argon2`);
|
|
108
|
+
}
|
|
109
|
+
HashRegistry.set(driver);
|
|
110
|
+
this.app.instance('hash', driver);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return HashServiceProvider;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EA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;YAED,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;YACxB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QACnC,CAAC;KACF;IAED,OAAO,mBAAmB,CAAA;AAC5B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rudderjs/hash",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/rudderjs/rudder",
|
|
8
|
+
"directory": "packages/hash"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"bcryptjs": "^2.4.3",
|
|
24
|
+
"@rudderjs/core": "0.0.8"
|
|
25
|
+
},
|
|
26
|
+
"optionalDependencies": {
|
|
27
|
+
"argon2": "^0.41.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/bcryptjs": "^2.4.6",
|
|
31
|
+
"@types/node": "^20.0.0",
|
|
32
|
+
"typescript": "^5.4.0",
|
|
33
|
+
"tsx": "^4.0.0"
|
|
34
|
+
},
|
|
35
|
+
"author": "Suleiman Shahbari",
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc -p tsconfig.build.json",
|
|
38
|
+
"dev": "tsc -p tsconfig.build.json --watch",
|
|
39
|
+
"typecheck": "tsc --noEmit",
|
|
40
|
+
"lint": "eslint src",
|
|
41
|
+
"clean": "rm -rf dist",
|
|
42
|
+
"test": "tsc -p tsconfig.test.json && node --test dist-test/index.test.js; EXIT=$?; rm -rf dist-test; exit $EXIT"
|
|
43
|
+
}
|
|
44
|
+
}
|