@nest-boot/hash 7.0.1 → 7.1.0
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/dist/hash-module-options.interface.d.ts +7 -0
- package/dist/hash.module-definition.d.ts +1 -7
- package/dist/hash.module-definition.js +1 -8
- package/dist/hash.module-definition.js.map +1 -1
- package/dist/hash.module.d.ts +32 -1
- package/dist/hash.module.js +48 -1
- package/dist/hash.module.js.map +1 -1
- package/dist/hash.service.d.ts +78 -3
- package/dist/hash.service.js +93 -28
- package/dist/hash.service.js.map +1 -1
- package/dist/hash.service.spec.js +188 -30
- package/dist/hash.service.spec.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +10 -6
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
import { type HashModuleOptions } from "./hash-module-options.interface";
|
|
2
|
-
export declare const ConfigurableModuleClass: import("@nestjs/common").ConfigurableModuleCls<HashModuleOptions, "register", "create", {
|
|
3
|
-
isGlobal: boolean;
|
|
4
|
-
}>, MODULE_OPTIONS_TOKEN: string | symbol, OPTIONS_TYPE: HashModuleOptions & Partial<{
|
|
5
|
-
isGlobal: boolean;
|
|
6
|
-
}>, ASYNC_OPTIONS_TYPE: import("@nestjs/common").ConfigurableModuleAsyncOptions<HashModuleOptions, "create"> & Partial<{
|
|
7
|
-
isGlobal: boolean;
|
|
8
|
-
}>;
|
|
2
|
+
export declare const ConfigurableModuleClass: import("@nestjs/common").ConfigurableModuleCls<HashModuleOptions, "register", "create", {}>, MODULE_OPTIONS_TOKEN: string | symbol, OPTIONS_TYPE: HashModuleOptions & Partial<{}>, ASYNC_OPTIONS_TYPE: import("@nestjs/common").ConfigurableModuleAsyncOptions<HashModuleOptions, "create"> & Partial<{}>;
|
|
@@ -3,12 +3,5 @@ var _a;
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.ASYNC_OPTIONS_TYPE = exports.OPTIONS_TYPE = exports.MODULE_OPTIONS_TOKEN = exports.ConfigurableModuleClass = void 0;
|
|
5
5
|
const common_1 = require("@nestjs/common");
|
|
6
|
-
_a = new common_1.ConfigurableModuleBuilder()
|
|
7
|
-
.setExtras({
|
|
8
|
-
isGlobal: false,
|
|
9
|
-
}, (definition, extras) => ({
|
|
10
|
-
...definition,
|
|
11
|
-
global: extras.isGlobal,
|
|
12
|
-
}))
|
|
13
|
-
.build(), exports.ConfigurableModuleClass = _a.ConfigurableModuleClass, exports.MODULE_OPTIONS_TOKEN = _a.MODULE_OPTIONS_TOKEN, exports.OPTIONS_TYPE = _a.OPTIONS_TYPE, exports.ASYNC_OPTIONS_TYPE = _a.ASYNC_OPTIONS_TYPE;
|
|
6
|
+
_a = new common_1.ConfigurableModuleBuilder().build(), exports.ConfigurableModuleClass = _a.ConfigurableModuleClass, exports.MODULE_OPTIONS_TOKEN = _a.MODULE_OPTIONS_TOKEN, exports.OPTIONS_TYPE = _a.OPTIONS_TYPE, exports.ASYNC_OPTIONS_TYPE = _a.ASYNC_OPTIONS_TYPE;
|
|
14
7
|
//# sourceMappingURL=hash.module-definition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.module-definition.js","sourceRoot":"","sources":["../src/hash.module-definition.ts"],"names":[],"mappings":";;;;AAAA,2CAA2D;AAI9C,KAKT,IAAI,kCAAyB,EAAqB
|
|
1
|
+
{"version":3,"file":"hash.module-definition.js","sourceRoot":"","sources":["../src/hash.module-definition.ts"],"names":[],"mappings":";;;;AAAA,2CAA2D;AAI9C,KAKT,IAAI,kCAAyB,EAAqB,CAAC,KAAK,EAAE,EAJ5D,+BAAuB,+BACvB,4BAAoB,4BACpB,oBAAY,oBACZ,0BAAkB,yBAC2C"}
|
package/dist/hash.module.d.ts
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type DynamicModule } from "@nestjs/common";
|
|
2
|
+
import { ASYNC_OPTIONS_TYPE, ConfigurableModuleClass, OPTIONS_TYPE } from "./hash.module-definition";
|
|
3
|
+
/**
|
|
4
|
+
* Module that provides password hashing services using Argon2.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { HashModule } from '@nest-boot/hash';
|
|
9
|
+
*
|
|
10
|
+
* @Module({
|
|
11
|
+
* imports: [
|
|
12
|
+
* HashModule.register({
|
|
13
|
+
* secret: 'your-secret-key',
|
|
14
|
+
* isGlobal: true,
|
|
15
|
+
* }),
|
|
16
|
+
* ],
|
|
17
|
+
* })
|
|
18
|
+
* export class AppModule {}
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
2
21
|
export declare class HashModule extends ConfigurableModuleClass {
|
|
22
|
+
/**
|
|
23
|
+
* Registers the HashModule with the given options.
|
|
24
|
+
* @param options - Configuration options including secret and isGlobal
|
|
25
|
+
* @returns Dynamic module configuration
|
|
26
|
+
*/
|
|
27
|
+
static register(options: typeof OPTIONS_TYPE): DynamicModule;
|
|
28
|
+
/**
|
|
29
|
+
* Registers the HashModule asynchronously with factory functions.
|
|
30
|
+
* @param options - Async configuration options
|
|
31
|
+
* @returns Dynamic module configuration
|
|
32
|
+
*/
|
|
33
|
+
static registerAsync(options: typeof ASYNC_OPTIONS_TYPE): DynamicModule;
|
|
3
34
|
}
|
package/dist/hash.module.js
CHANGED
|
@@ -10,10 +10,57 @@ exports.HashModule = void 0;
|
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const hash_module_definition_1 = require("./hash.module-definition");
|
|
12
12
|
const hash_service_1 = require("./hash.service");
|
|
13
|
+
/**
|
|
14
|
+
* Module that provides password hashing services using Argon2.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { HashModule } from '@nest-boot/hash';
|
|
19
|
+
*
|
|
20
|
+
* @Module({
|
|
21
|
+
* imports: [
|
|
22
|
+
* HashModule.register({
|
|
23
|
+
* secret: 'your-secret-key',
|
|
24
|
+
* isGlobal: true,
|
|
25
|
+
* }),
|
|
26
|
+
* ],
|
|
27
|
+
* })
|
|
28
|
+
* export class AppModule {}
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
13
31
|
let HashModule = class HashModule extends hash_module_definition_1.ConfigurableModuleClass {
|
|
32
|
+
/**
|
|
33
|
+
* Registers the HashModule with the given options.
|
|
34
|
+
* @param options - Configuration options including secret and isGlobal
|
|
35
|
+
* @returns Dynamic module configuration
|
|
36
|
+
*/
|
|
37
|
+
static register(options) {
|
|
38
|
+
return super.register(options);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Registers the HashModule asynchronously with factory functions.
|
|
42
|
+
* @param options - Async configuration options
|
|
43
|
+
* @returns Dynamic module configuration
|
|
44
|
+
*/
|
|
45
|
+
static registerAsync(options) {
|
|
46
|
+
return super.registerAsync(options);
|
|
47
|
+
}
|
|
14
48
|
};
|
|
15
49
|
exports.HashModule = HashModule;
|
|
16
50
|
exports.HashModule = HashModule = __decorate([
|
|
17
|
-
(0, common_1.
|
|
51
|
+
(0, common_1.Global)(),
|
|
52
|
+
(0, common_1.Module)({
|
|
53
|
+
providers: [
|
|
54
|
+
{
|
|
55
|
+
provide: hash_service_1.HashService,
|
|
56
|
+
inject: [{ token: hash_module_definition_1.MODULE_OPTIONS_TOKEN, optional: true }],
|
|
57
|
+
useFactory: (options) => {
|
|
58
|
+
hash_service_1.HashService.init(options.secret ?? process.env.HASH_SECRET ?? process.env.APP_SECRET);
|
|
59
|
+
return hash_service_1.HashService.instance;
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
exports: [hash_service_1.HashService],
|
|
64
|
+
})
|
|
18
65
|
], HashModule);
|
|
19
66
|
//# sourceMappingURL=hash.module.js.map
|
package/dist/hash.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.module.js","sourceRoot":"","sources":["../src/hash.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"hash.module.js","sourceRoot":"","sources":["../src/hash.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAoE;AAEpE,qEAKkC;AAClC,iDAA6C;AAG7C;;;;;;;;;;;;;;;;;GAiBG;AAkBI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,gDAAuB;IACrD;;;;OAIG;IACH,MAAM,CAAU,QAAQ,CAAC,OAA4B;QACnD,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAU,aAAa,CAC3B,OAAkC;QAElC,OAAO,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;CACF,CAAA;AApBY,gCAAU;qBAAV,UAAU;IAjBtB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,0BAAW;gBACpB,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,6CAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;gBACzD,UAAU,EAAE,CAAC,OAA0B,EAAE,EAAE;oBACzC,0BAAW,CAAC,IAAI,CACd,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CACpE,CAAC;oBAEF,OAAO,0BAAW,CAAC,QAAQ,CAAC;gBAC9B,CAAC;aACF;SACF;QACD,OAAO,EAAE,CAAC,0BAAW,CAAC;KACvB,CAAC;GACW,UAAU,CAoBtB"}
|
package/dist/hash.service.d.ts
CHANGED
|
@@ -1,8 +1,83 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Service that provides password hashing and verification using Argon2 algorithm.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import { HashService } from '@nest-boot/hash';
|
|
7
|
+
*
|
|
8
|
+
* // Initialize at application startup
|
|
9
|
+
* HashService.init(process.env.HASH_SECRET);
|
|
10
|
+
*
|
|
11
|
+
* // Use static methods
|
|
12
|
+
* const hashed = await HashService.hash(password);
|
|
13
|
+
* const isValid = await HashService.verify(hashed, password);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
2
16
|
export declare class HashService {
|
|
3
|
-
private
|
|
17
|
+
private static _instance?;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the static HashService instance.
|
|
20
|
+
* @throws Error if HashService has not been initialized via `init()`
|
|
21
|
+
* @returns The HashService instance
|
|
22
|
+
*/
|
|
23
|
+
static get instance(): HashService;
|
|
24
|
+
/**
|
|
25
|
+
* Initializes the static HashService instance with the given secret.
|
|
26
|
+
* Call this method at application startup to configure the default secret.
|
|
27
|
+
*
|
|
28
|
+
* @param secret - The secret key to use for hashing
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* // In your application bootstrap
|
|
33
|
+
* HashService.init(process.env.HASH_SECRET);
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
static init(secret?: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a hash from the given value using the static instance.
|
|
39
|
+
* @param value - The value to hash (password or other sensitive data)
|
|
40
|
+
* @param secret - Optional secret key to use instead of the default
|
|
41
|
+
* @returns The hashed string
|
|
42
|
+
* @throws Error if HashService has not been initialized via `init()`
|
|
43
|
+
*/
|
|
44
|
+
static hash(value: string | Buffer, secret?: string): Promise<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Verifies a value against a hash using the static instance.
|
|
47
|
+
* @param hashed - The hash to verify against
|
|
48
|
+
* @param value - The value to verify
|
|
49
|
+
* @param secret - Optional secret key to use instead of the default
|
|
50
|
+
* @returns True if the value matches the hash, false otherwise
|
|
51
|
+
* @throws Error if HashService has not been initialized via `init()`
|
|
52
|
+
*/
|
|
53
|
+
static verify(hashed: string | Buffer, value: string | Buffer, secret?: string): Promise<boolean>;
|
|
4
54
|
private readonly secret?;
|
|
5
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Creates an instance of HashService.
|
|
57
|
+
* @param secret - Optional secret key to use for hashing
|
|
58
|
+
*/
|
|
59
|
+
constructor(secret?: string);
|
|
60
|
+
/**
|
|
61
|
+
* Creates a hash from the given value using Argon2.
|
|
62
|
+
* @param value - The value to hash (password or other sensitive data)
|
|
63
|
+
* @param secret - Optional secret key to use instead of the default
|
|
64
|
+
* @returns The hashed string
|
|
65
|
+
*/
|
|
66
|
+
hash(value: string | Buffer, secret?: string): Promise<string>;
|
|
67
|
+
/**
|
|
68
|
+
* Creates a hash from the given value using Argon2.
|
|
69
|
+
* @param value - The value to hash (password or other sensitive data)
|
|
70
|
+
* @param secret - Optional secret key to use instead of the default
|
|
71
|
+
* @returns The hashed string
|
|
72
|
+
* @deprecated Use `hash` instead
|
|
73
|
+
*/
|
|
6
74
|
create(value: string | Buffer, secret?: string): Promise<string>;
|
|
75
|
+
/**
|
|
76
|
+
* Verifies a value against a hash.
|
|
77
|
+
* @param hashed - The hash to verify against
|
|
78
|
+
* @param value - The value to verify
|
|
79
|
+
* @param secret - Optional secret key to use instead of the default
|
|
80
|
+
* @returns True if the value matches the hash, false otherwise
|
|
81
|
+
*/
|
|
7
82
|
verify(hashed: string | Buffer, value: string | Buffer, secret?: string): Promise<boolean>;
|
|
8
83
|
}
|
package/dist/hash.service.js
CHANGED
|
@@ -1,45 +1,110 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.HashService = void 0;
|
|
16
|
-
const common_1 = require("@nestjs/common");
|
|
17
4
|
const argon2_1 = require("@node-rs/argon2");
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Service that provides password hashing and verification using Argon2 algorithm.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { HashService } from '@nest-boot/hash';
|
|
11
|
+
*
|
|
12
|
+
* // Initialize at application startup
|
|
13
|
+
* HashService.init(process.env.HASH_SECRET);
|
|
14
|
+
*
|
|
15
|
+
* // Use static methods
|
|
16
|
+
* const hashed = await HashService.hash(password);
|
|
17
|
+
* const isValid = await HashService.verify(hashed, password);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
class HashService {
|
|
21
|
+
/**
|
|
22
|
+
* Gets the static HashService instance.
|
|
23
|
+
* @throws Error if HashService has not been initialized via `init()`
|
|
24
|
+
* @returns The HashService instance
|
|
25
|
+
*/
|
|
26
|
+
static get instance() {
|
|
27
|
+
if (!this._instance) {
|
|
28
|
+
throw new Error("HashService not initialized");
|
|
25
29
|
}
|
|
30
|
+
return this._instance;
|
|
26
31
|
}
|
|
27
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Initializes the static HashService instance with the given secret.
|
|
34
|
+
* Call this method at application startup to configure the default secret.
|
|
35
|
+
*
|
|
36
|
+
* @param secret - The secret key to use for hashing
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* // In your application bootstrap
|
|
41
|
+
* HashService.init(process.env.HASH_SECRET);
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
static init(secret) {
|
|
45
|
+
this._instance = new HashService(secret);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Creates a hash from the given value using the static instance.
|
|
49
|
+
* @param value - The value to hash (password or other sensitive data)
|
|
50
|
+
* @param secret - Optional secret key to use instead of the default
|
|
51
|
+
* @returns The hashed string
|
|
52
|
+
* @throws Error if HashService has not been initialized via `init()`
|
|
53
|
+
*/
|
|
54
|
+
static hash(value, secret) {
|
|
55
|
+
return this.instance.hash(value, secret);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Verifies a value against a hash using the static instance.
|
|
59
|
+
* @param hashed - The hash to verify against
|
|
60
|
+
* @param value - The value to verify
|
|
61
|
+
* @param secret - Optional secret key to use instead of the default
|
|
62
|
+
* @returns True if the value matches the hash, false otherwise
|
|
63
|
+
* @throws Error if HashService has not been initialized via `init()`
|
|
64
|
+
*/
|
|
65
|
+
static verify(hashed, value, secret) {
|
|
66
|
+
return this.instance.verify(hashed, value, secret);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Creates an instance of HashService.
|
|
70
|
+
* @param secret - Optional secret key to use for hashing
|
|
71
|
+
*/
|
|
72
|
+
constructor(secret) {
|
|
73
|
+
this.secret = secret ? Buffer.from(secret) : undefined;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Creates a hash from the given value using Argon2.
|
|
77
|
+
* @param value - The value to hash (password or other sensitive data)
|
|
78
|
+
* @param secret - Optional secret key to use instead of the default
|
|
79
|
+
* @returns The hashed string
|
|
80
|
+
*/
|
|
81
|
+
async hash(value, secret) {
|
|
28
82
|
return await (0, argon2_1.hash)(value, {
|
|
29
83
|
secret: typeof secret !== "undefined" ? Buffer.from(secret) : this.secret,
|
|
30
84
|
});
|
|
31
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Creates a hash from the given value using Argon2.
|
|
88
|
+
* @param value - The value to hash (password or other sensitive data)
|
|
89
|
+
* @param secret - Optional secret key to use instead of the default
|
|
90
|
+
* @returns The hashed string
|
|
91
|
+
* @deprecated Use `hash` instead
|
|
92
|
+
*/
|
|
93
|
+
async create(value, secret) {
|
|
94
|
+
return await this.hash(value, secret);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Verifies a value against a hash.
|
|
98
|
+
* @param hashed - The hash to verify against
|
|
99
|
+
* @param value - The value to verify
|
|
100
|
+
* @param secret - Optional secret key to use instead of the default
|
|
101
|
+
* @returns True if the value matches the hash, false otherwise
|
|
102
|
+
*/
|
|
32
103
|
async verify(hashed, value, secret) {
|
|
33
104
|
return await (0, argon2_1.verify)(hashed, value, {
|
|
34
105
|
secret: typeof secret !== "undefined" ? Buffer.from(secret) : this.secret,
|
|
35
106
|
});
|
|
36
107
|
}
|
|
37
|
-
}
|
|
108
|
+
}
|
|
38
109
|
exports.HashService = HashService;
|
|
39
|
-
exports.HashService = HashService = __decorate([
|
|
40
|
-
(0, common_1.Injectable)(),
|
|
41
|
-
__param(0, (0, common_1.Optional)()),
|
|
42
|
-
__param(0, (0, common_1.Inject)(hash_module_definition_1.MODULE_OPTIONS_TOKEN)),
|
|
43
|
-
__metadata("design:paramtypes", [Object])
|
|
44
|
-
], HashService);
|
|
45
110
|
//# sourceMappingURL=hash.service.js.map
|
package/dist/hash.service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.service.js","sourceRoot":"","sources":["../src/hash.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hash.service.js","sourceRoot":"","sources":["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AAC,MAAM,CAAC,KAAsB,EAAE,MAAe;QAClD,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CACV,MAAuB,EACvB,KAAsB,EACtB,MAAe;QAEf,OAAO,MAAM,IAAA,eAAM,EAAC,MAAM,EAAE,KAAK,EAAE;YACjC,MAAM,EAAE,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM;SAC1E,CAAC,CAAC;IACL,CAAC;CACF;AA5GD,kCA4GC"}
|
|
@@ -1,42 +1,200 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
const testing_1 = require("@nestjs/testing");
|
|
4
5
|
const _1 = require(".");
|
|
5
6
|
describe("HashService", () => {
|
|
6
7
|
const globalSecret = "myGlobalSecret";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
describe("instance methods (via HashModule.register)", () => {
|
|
9
|
+
let hashService;
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
const moduleRef = await testing_1.Test.createTestingModule({
|
|
12
|
+
imports: [_1.HashModule.register({ secret: globalSecret })],
|
|
13
|
+
}).compile();
|
|
14
|
+
hashService = moduleRef.get(_1.HashService);
|
|
15
|
+
});
|
|
16
|
+
describe("hash", () => {
|
|
17
|
+
it("should create a hash with the provided value and secret", async () => {
|
|
18
|
+
const value = "password";
|
|
19
|
+
const secret = "mySecret";
|
|
20
|
+
const result = await hashService.hash(value, secret);
|
|
21
|
+
expect(result).toBeDefined();
|
|
22
|
+
expect(result).toContain("$argon2");
|
|
23
|
+
});
|
|
24
|
+
it("should create a hash with the provided value and default secret", async () => {
|
|
25
|
+
const value = "password";
|
|
26
|
+
const result = await hashService.hash(value);
|
|
27
|
+
expect(result).toBeDefined();
|
|
28
|
+
expect(result).toContain("$argon2");
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe("create (deprecated)", () => {
|
|
32
|
+
it("should create a hash with the provided value and secret", async () => {
|
|
33
|
+
const value = "password";
|
|
34
|
+
const secret = "mySecret";
|
|
35
|
+
const result = await hashService.create(value, secret);
|
|
36
|
+
expect(result).toBeDefined();
|
|
37
|
+
expect(result).toContain("$argon2");
|
|
38
|
+
});
|
|
39
|
+
it("should create a hash with the provided value and default secret", async () => {
|
|
40
|
+
const value = "password";
|
|
41
|
+
const result = await hashService.create(value);
|
|
42
|
+
expect(result).toBeDefined();
|
|
43
|
+
expect(result).toContain("$argon2");
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
describe("verify", () => {
|
|
47
|
+
it("should verify the hashed value with the provided value and secret", async () => {
|
|
48
|
+
const value = "password";
|
|
49
|
+
const secret = "mySecret";
|
|
50
|
+
const hashed = await hashService.hash(value, secret);
|
|
51
|
+
const result = await hashService.verify(hashed, value, secret);
|
|
52
|
+
expect(result).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
it("should verify the hashed value with the provided value and default secret", async () => {
|
|
55
|
+
const value = "password";
|
|
56
|
+
const hashed = await hashService.hash(value);
|
|
57
|
+
const result = await hashService.verify(hashed, value);
|
|
58
|
+
expect(result).toBe(true);
|
|
59
|
+
});
|
|
60
|
+
it("should return false for incorrect password", async () => {
|
|
61
|
+
const value = "password";
|
|
62
|
+
const hashed = await hashService.hash(value);
|
|
63
|
+
const result = await hashService.verify(hashed, "wrongpassword");
|
|
64
|
+
expect(result).toBe(false);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
describe("static methods", () => {
|
|
69
|
+
beforeEach(() => {
|
|
70
|
+
// Reset static instance before each test
|
|
71
|
+
_1.HashService._instance =
|
|
72
|
+
undefined;
|
|
73
|
+
});
|
|
74
|
+
describe("instance getter", () => {
|
|
75
|
+
it("should throw error when not initialized", () => {
|
|
76
|
+
expect(() => _1.HashService.instance).toThrow("HashService not initialized");
|
|
77
|
+
});
|
|
78
|
+
it("should return instance after initialization", () => {
|
|
79
|
+
_1.HashService.init("secret");
|
|
80
|
+
expect(_1.HashService.instance).toBeInstanceOf(_1.HashService);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
describe("init", () => {
|
|
84
|
+
it("should initialize with secret", () => {
|
|
85
|
+
_1.HashService.init("mySecret");
|
|
86
|
+
expect(_1.HashService.instance).toBeDefined();
|
|
87
|
+
});
|
|
88
|
+
it("should initialize without secret", () => {
|
|
89
|
+
_1.HashService.init();
|
|
90
|
+
expect(_1.HashService.instance).toBeDefined();
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
describe("hash (static)", () => {
|
|
94
|
+
it("should create a hash using static method", async () => {
|
|
95
|
+
_1.HashService.init("mySecret");
|
|
96
|
+
const value = "password";
|
|
97
|
+
const result = await _1.HashService.hash(value);
|
|
98
|
+
expect(result).toBeDefined();
|
|
99
|
+
expect(result).toContain("$argon2");
|
|
100
|
+
});
|
|
101
|
+
it("should create a hash with custom secret using static method", async () => {
|
|
102
|
+
_1.HashService.init();
|
|
103
|
+
const value = "password";
|
|
104
|
+
const secret = "customSecret";
|
|
105
|
+
const result = await _1.HashService.hash(value, secret);
|
|
106
|
+
expect(result).toBeDefined();
|
|
107
|
+
expect(result).toContain("$argon2");
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
describe("verify (static)", () => {
|
|
111
|
+
it("should verify using static method", async () => {
|
|
112
|
+
_1.HashService.init("mySecret");
|
|
113
|
+
const value = "password";
|
|
114
|
+
const hashed = await _1.HashService.hash(value);
|
|
115
|
+
const result = await _1.HashService.verify(hashed, value);
|
|
116
|
+
expect(result).toBe(true);
|
|
117
|
+
});
|
|
118
|
+
it("should verify with custom secret using static method", async () => {
|
|
119
|
+
_1.HashService.init();
|
|
120
|
+
const value = "password";
|
|
121
|
+
const secret = "customSecret";
|
|
122
|
+
const hashed = await _1.HashService.hash(value, secret);
|
|
123
|
+
const result = await _1.HashService.verify(hashed, value, secret);
|
|
124
|
+
expect(result).toBe(true);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
13
127
|
});
|
|
14
|
-
describe("
|
|
15
|
-
it("should create
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const value = "password";
|
|
23
|
-
const result = await hashService.create(value);
|
|
24
|
-
expect(result).toBeDefined();
|
|
128
|
+
describe("constructor", () => {
|
|
129
|
+
it("should create instance with secret", () => {
|
|
130
|
+
const service = new _1.HashService("mySecret");
|
|
131
|
+
expect(service).toBeDefined();
|
|
132
|
+
});
|
|
133
|
+
it("should create instance without secret", () => {
|
|
134
|
+
const service = new _1.HashService();
|
|
135
|
+
expect(service).toBeDefined();
|
|
25
136
|
});
|
|
26
137
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
138
|
+
});
|
|
139
|
+
describe("HashModule", () => {
|
|
140
|
+
const originalEnv = process.env;
|
|
141
|
+
beforeEach(() => {
|
|
142
|
+
// Reset static instance before each test
|
|
143
|
+
_1.HashService._instance = undefined;
|
|
144
|
+
// Reset environment variables
|
|
145
|
+
process.env = { ...originalEnv };
|
|
146
|
+
delete process.env.HASH_SECRET;
|
|
147
|
+
delete process.env.APP_SECRET;
|
|
148
|
+
});
|
|
149
|
+
afterAll(() => {
|
|
150
|
+
process.env = originalEnv;
|
|
151
|
+
});
|
|
152
|
+
describe("registerAsync", () => {
|
|
153
|
+
it("should register module with async factory", async () => {
|
|
154
|
+
const moduleRef = await testing_1.Test.createTestingModule({
|
|
155
|
+
imports: [
|
|
156
|
+
_1.HashModule.registerAsync({
|
|
157
|
+
useFactory: () => ({
|
|
158
|
+
secret: "asyncSecret",
|
|
159
|
+
}),
|
|
160
|
+
}),
|
|
161
|
+
],
|
|
162
|
+
}).compile();
|
|
163
|
+
const hashService = moduleRef.get(_1.HashService);
|
|
164
|
+
expect(hashService).toBeDefined();
|
|
165
|
+
const hashed = await hashService.hash("password");
|
|
166
|
+
expect(hashed).toContain("$argon2");
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
describe("register with fallback secrets", () => {
|
|
170
|
+
it("should use HASH_SECRET env when no secret provided", async () => {
|
|
171
|
+
process.env.HASH_SECRET = "envHashSecret";
|
|
172
|
+
const moduleRef = await testing_1.Test.createTestingModule({
|
|
173
|
+
imports: [_1.HashModule.register({})],
|
|
174
|
+
}).compile();
|
|
175
|
+
const hashService = moduleRef.get(_1.HashService);
|
|
176
|
+
expect(hashService).toBeDefined();
|
|
177
|
+
const hashed = await hashService.hash("password");
|
|
178
|
+
expect(hashed).toContain("$argon2");
|
|
179
|
+
});
|
|
180
|
+
it("should use APP_SECRET env when no secret or HASH_SECRET provided", async () => {
|
|
181
|
+
process.env.APP_SECRET = "envAppSecret";
|
|
182
|
+
const moduleRef = await testing_1.Test.createTestingModule({
|
|
183
|
+
imports: [_1.HashModule.register({})],
|
|
184
|
+
}).compile();
|
|
185
|
+
const hashService = moduleRef.get(_1.HashService);
|
|
186
|
+
expect(hashService).toBeDefined();
|
|
187
|
+
const hashed = await hashService.hash("password");
|
|
188
|
+
expect(hashed).toContain("$argon2");
|
|
189
|
+
});
|
|
190
|
+
it("should work without any secret", async () => {
|
|
191
|
+
const moduleRef = await testing_1.Test.createTestingModule({
|
|
192
|
+
imports: [_1.HashModule.register({})],
|
|
193
|
+
}).compile();
|
|
194
|
+
const hashService = moduleRef.get(_1.HashService);
|
|
195
|
+
expect(hashService).toBeDefined();
|
|
196
|
+
const hashed = await hashService.hash("password");
|
|
197
|
+
expect(hashed).toContain("$argon2");
|
|
40
198
|
});
|
|
41
199
|
});
|
|
42
200
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.service.spec.js","sourceRoot":"","sources":["../src/hash.service.spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hash.service.spec.js","sourceRoot":"","sources":["../src/hash.service.spec.ts"],"names":[],"mappings":";AAAA,qDAAqD;;AAErD,6CAAuC;AAEvC,wBAA4C;AAE5C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,MAAM,YAAY,GAAG,gBAAgB,CAAC;IAEtC,QAAQ,CAAC,4CAA4C,EAAE,GAAG,EAAE;QAC1D,IAAI,WAAwB,CAAC;QAE7B,UAAU,CAAC,KAAK,IAAI,EAAE;YACpB,MAAM,SAAS,GAAG,MAAM,cAAI,CAAC,mBAAmB,CAAC;gBAC/C,OAAO,EAAE,CAAC,aAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;aACzD,CAAC,CAAC,OAAO,EAAE,CAAC;YAEb,WAAW,GAAG,SAAS,CAAC,GAAG,CAAc,cAAW,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;YACpB,EAAE,CAAC,yDAAyD,EAAE,KAAK,IAAI,EAAE;gBACvE,MAAM,KAAK,GAAG,UAAU,CAAC;gBACzB,MAAM,MAAM,GAAG,UAAU,CAAC;gBAE1B,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBAErD,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;gBAC7B,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;YAEH,EAAE,CAAC,iEAAiE,EAAE,KAAK,IAAI,EAAE;gB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nC,CAAC,CAAC,OAAO,EAAE,CAAC;YAEb,MAAM,WAAW,GAAG,SAAS,CAAC,GAAG,CAAc,cAAW,CAAC,CAAC;YAE5D,MAAM,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC;YAElC,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAClD,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,gCAAgC,EAAE,KAAK,IAAI,EAAE;YAC9C,MAAM,SAAS,GAAG,MAAM,cAAI,CAAC,mBAAmB,CAAC;gBAC/C,OAAO,EAAE,CAAC,aAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;aACnC,CAAC,CAAC,OAAO,EAAE,CAAC;YAEb,MAAM,WAAW,GAAG,SAAS,CAAC,GAAG,CAAc,cAAW,CAAC,CAAC;YAE5D,MAAM,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC;YAElC,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAClD,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./hash.module"), exports);
|
|
18
18
|
__exportStar(require("./hash.service"), exports);
|
|
19
|
+
__exportStar(require("./hash-module-options.interface"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|