@j3r3mcdev/auth-service 1.0.0 → 1.0.7

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.
Files changed (65) hide show
  1. package/README.md +0 -0
  2. package/dist/hashing.d.ts +2 -0
  3. package/dist/hashing.d.ts.map +1 -0
  4. package/dist/hashing.js +8 -0
  5. package/dist/index.d.ts +4 -12
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +4 -30
  8. package/dist/sanitize.d.ts +2 -0
  9. package/dist/sanitize.d.ts.map +1 -0
  10. package/dist/sanitize.js +5 -0
  11. package/dist/tokens.d.ts +6 -0
  12. package/dist/tokens.d.ts.map +1 -0
  13. package/dist/tokens.js +11 -0
  14. package/dist/validators.d.ts +3 -0
  15. package/dist/validators.d.ts.map +1 -0
  16. package/dist/validators.js +14 -0
  17. package/package.json +46 -8
  18. package/dist/auth/auth.controller.d.ts +0 -60
  19. package/dist/auth/auth.controller.d.ts.map +0 -1
  20. package/dist/auth/auth.controller.js +0 -128
  21. package/dist/auth/auth.module.d.ts +0 -3
  22. package/dist/auth/auth.module.d.ts.map +0 -1
  23. package/dist/auth/auth.module.js +0 -44
  24. package/dist/auth/auth.repository.d.ts +0 -119
  25. package/dist/auth/auth.repository.d.ts.map +0 -1
  26. package/dist/auth/auth.repository.js +0 -108
  27. package/dist/auth/auth.service.d.ts +0 -61
  28. package/dist/auth/auth.service.d.ts.map +0 -1
  29. package/dist/auth/auth.service.js +0 -287
  30. package/dist/auth/dto/forgot-password.dto.d.ts +0 -4
  31. package/dist/auth/dto/forgot-password.dto.d.ts.map +0 -1
  32. package/dist/auth/dto/forgot-password.dto.js +0 -21
  33. package/dist/auth/dto/login.dto.d.ts +0 -5
  34. package/dist/auth/dto/login.dto.d.ts.map +0 -1
  35. package/dist/auth/dto/login.dto.js +0 -26
  36. package/dist/auth/dto/refresh.dto.d.ts +0 -4
  37. package/dist/auth/dto/refresh.dto.d.ts.map +0 -1
  38. package/dist/auth/dto/refresh.dto.js +0 -21
  39. package/dist/auth/dto/register.dto.d.ts +0 -5
  40. package/dist/auth/dto/register.dto.d.ts.map +0 -1
  41. package/dist/auth/dto/register.dto.js +0 -27
  42. package/dist/auth/dto/reset-password.dto.d.ts +0 -5
  43. package/dist/auth/dto/reset-password.dto.d.ts.map +0 -1
  44. package/dist/auth/dto/reset-password.dto.js +0 -27
  45. package/dist/auth/dto/update-user.dto.d.ts +0 -5
  46. package/dist/auth/dto/update-user.dto.d.ts.map +0 -1
  47. package/dist/auth/dto/update-user.dto.js +0 -28
  48. package/dist/auth/guards/jwt.guard.d.ts +0 -5
  49. package/dist/auth/guards/jwt.guard.d.ts.map +0 -1
  50. package/dist/auth/guards/jwt.guard.js +0 -18
  51. package/dist/auth/guards/jwt.refresh-guard.d.ts +0 -5
  52. package/dist/auth/guards/jwt.refresh-guard.d.ts.map +0 -1
  53. package/dist/auth/guards/jwt.refresh-guard.js +0 -18
  54. package/dist/auth/strategies/jwt-refresh.strategy.d.ts +0 -22
  55. package/dist/auth/strategies/jwt-refresh.strategy.d.ts.map +0 -1
  56. package/dist/auth/strategies/jwt-refresh.strategy.js +0 -45
  57. package/dist/auth/strategies/jwt.strategy.d.ts +0 -10
  58. package/dist/auth/strategies/jwt.strategy.d.ts.map +0 -1
  59. package/dist/auth/strategies/jwt.strategy.js +0 -33
  60. package/dist/auth/strategies/strategies/jwt-refresh.strategy.d.ts +0 -22
  61. package/dist/auth/strategies/strategies/jwt-refresh.strategy.d.ts.map +0 -1
  62. package/dist/auth/strategies/strategies/jwt-refresh.strategy.js +0 -45
  63. package/dist/auth/strategies/strategies/jwt.strategy.d.ts +0 -10
  64. package/dist/auth/strategies/strategies/jwt.strategy.d.ts.map +0 -1
  65. package/dist/auth/strategies/strategies/jwt.strategy.js +0 -33
@@ -1,28 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.UpdateUserDto = void 0;
13
- const class_validator_1 = require("class-validator");
14
- class UpdateUserDto {
15
- email;
16
- password;
17
- }
18
- exports.UpdateUserDto = UpdateUserDto;
19
- __decorate([
20
- (0, class_validator_1.IsOptional)(),
21
- (0, class_validator_1.IsEmail)(),
22
- __metadata("design:type", String)
23
- ], UpdateUserDto.prototype, "email", void 0);
24
- __decorate([
25
- (0, class_validator_1.IsOptional)(),
26
- (0, class_validator_1.MinLength)(6),
27
- __metadata("design:type", String)
28
- ], UpdateUserDto.prototype, "password", void 0);
@@ -1,5 +0,0 @@
1
- declare const JwtAuthGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
2
- export declare class JwtAuthGuard extends JwtAuthGuard_base {
3
- }
4
- export {};
5
- //# sourceMappingURL=jwt.guard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jwt.guard.d.ts","sourceRoot":"","sources":["../../../src/auth/guards/jwt.guard.ts"],"names":[],"mappings":";AAIA,qBACa,YAAa,SAAQ,iBAAgB;CAAG"}
@@ -1,18 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.JwtAuthGuard = void 0;
10
- // src/auth/guards/jwt.guard.ts
11
- const common_1 = require("@nestjs/common");
12
- const passport_1 = require("@nestjs/passport");
13
- let JwtAuthGuard = class JwtAuthGuard extends (0, passport_1.AuthGuard)('jwt') {
14
- };
15
- exports.JwtAuthGuard = JwtAuthGuard;
16
- exports.JwtAuthGuard = JwtAuthGuard = __decorate([
17
- (0, common_1.Injectable)()
18
- ], JwtAuthGuard);
@@ -1,5 +0,0 @@
1
- declare const JwtRefreshGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
2
- export declare class JwtRefreshGuard extends JwtRefreshGuard_base {
3
- }
4
- export {};
5
- //# sourceMappingURL=jwt.refresh-guard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jwt.refresh-guard.d.ts","sourceRoot":"","sources":["../../../src/auth/guards/jwt.refresh-guard.ts"],"names":[],"mappings":";AAIA,qBACa,eAAgB,SAAQ,oBAAwB;CAAG"}
@@ -1,18 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.JwtRefreshGuard = void 0;
10
- // src/auth/guards/jwt-refresh.guard.ts
11
- const common_1 = require("@nestjs/common");
12
- const passport_1 = require("@nestjs/passport");
13
- let JwtRefreshGuard = class JwtRefreshGuard extends (0, passport_1.AuthGuard)('jwt-refresh') {
14
- };
15
- exports.JwtRefreshGuard = JwtRefreshGuard;
16
- exports.JwtRefreshGuard = JwtRefreshGuard = __decorate([
17
- (0, common_1.Injectable)()
18
- ], JwtRefreshGuard);
@@ -1,22 +0,0 @@
1
- import { Strategy } from 'passport-jwt';
2
- declare const JwtRefreshStrategy_base: new (...args: [opt: import("passport-jwt").StrategyOptionsWithRequest] | [opt: import("passport-jwt").StrategyOptionsWithoutRequest]) => Strategy & {
3
- validate(...args: any[]): unknown;
4
- };
5
- /**
6
- * NOTE IMPORTANTE :
7
- * -----------------
8
- * Cette stratégie est volontairement "neutre".
9
- *
10
- * - Les tests E2E exigent un refresh SANS guard.
11
- * - Les tests unitaires n'utilisent pas cette stratégie.
12
- * - Passport renverrait 401 au lieu de 403 → casserait les E2E.
13
- *
14
- * Donc la stratégie existe pour satisfaire NestJS,
15
- * mais elle n'est PAS utilisée dans le controller.
16
- */
17
- export declare class JwtRefreshStrategy extends JwtRefreshStrategy_base {
18
- constructor();
19
- validate(): Promise<null>;
20
- }
21
- export {};
22
- //# sourceMappingURL=jwt-refresh.strategy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jwt-refresh.strategy.d.ts","sourceRoot":"","sources":["../../../src/auth/strategies/jwt-refresh.strategy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;;;;AAExC;;;;;;;;;;;GAWG;AAEH,qBACa,kBAAmB,SAAQ,uBAGvC;;IASO,QAAQ;CAIf"}
@@ -1,45 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.JwtRefreshStrategy = void 0;
13
- const common_1 = require("@nestjs/common");
14
- const passport_1 = require("@nestjs/passport");
15
- const passport_jwt_1 = require("passport-jwt");
16
- /**
17
- * NOTE IMPORTANTE :
18
- * -----------------
19
- * Cette stratégie est volontairement "neutre".
20
- *
21
- * - Les tests E2E exigent un refresh SANS guard.
22
- * - Les tests unitaires n'utilisent pas cette stratégie.
23
- * - Passport renverrait 401 au lieu de 403 → casserait les E2E.
24
- *
25
- * Donc la stratégie existe pour satisfaire NestJS,
26
- * mais elle n'est PAS utilisée dans le controller.
27
- */
28
- let JwtRefreshStrategy = class JwtRefreshStrategy extends (0, passport_1.PassportStrategy)(passport_jwt_1.Strategy, 'jwt-refresh') {
29
- constructor() {
30
- super({
31
- jwtFromRequest: () => null, // 🔥 Ne lit jamais de token
32
- ignoreExpiration: true,
33
- secretOrKey: process.env.JWT_REFRESH_SECRET,
34
- });
35
- }
36
- async validate() {
37
- // 🔥 Ne valide jamais rien
38
- return null;
39
- }
40
- };
41
- exports.JwtRefreshStrategy = JwtRefreshStrategy;
42
- exports.JwtRefreshStrategy = JwtRefreshStrategy = __decorate([
43
- (0, common_1.Injectable)(),
44
- __metadata("design:paramtypes", [])
45
- ], JwtRefreshStrategy);
@@ -1,10 +0,0 @@
1
- import { Strategy } from 'passport-jwt';
2
- declare const JwtStrategy_base: new (...args: [opt: import("passport-jwt").StrategyOptionsWithRequest] | [opt: import("passport-jwt").StrategyOptionsWithoutRequest]) => Strategy & {
3
- validate(...args: any[]): unknown;
4
- };
5
- export declare class JwtStrategy extends JwtStrategy_base {
6
- constructor();
7
- validate(payload: any): Promise<any>;
8
- }
9
- export {};
10
- //# sourceMappingURL=jwt.strategy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jwt.strategy.d.ts","sourceRoot":"","sources":["../../../src/auth/strategies/jwt.strategy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,QAAQ,EAAE,MAAM,cAAc,CAAC;;;;AAEpD,qBACa,WAAY,SAAQ,gBAAiC;;IAS1D,QAAQ,CAAC,OAAO,EAAE,GAAG;CAI5B"}
@@ -1,33 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.JwtStrategy = void 0;
13
- const common_1 = require("@nestjs/common");
14
- const passport_1 = require("@nestjs/passport");
15
- const passport_jwt_1 = require("passport-jwt");
16
- let JwtStrategy = class JwtStrategy extends (0, passport_1.PassportStrategy)(passport_jwt_1.Strategy, 'jwt') {
17
- constructor() {
18
- super({
19
- jwtFromRequest: passport_jwt_1.ExtractJwt.fromAuthHeaderAsBearerToken(),
20
- ignoreExpiration: false,
21
- secretOrKey: process.env.JWT_SECRET,
22
- });
23
- }
24
- async validate(payload) {
25
- // payload = { sub, email }
26
- return payload;
27
- }
28
- };
29
- exports.JwtStrategy = JwtStrategy;
30
- exports.JwtStrategy = JwtStrategy = __decorate([
31
- (0, common_1.Injectable)(),
32
- __metadata("design:paramtypes", [])
33
- ], JwtStrategy);
@@ -1,22 +0,0 @@
1
- import { Strategy } from 'passport-jwt';
2
- declare const JwtRefreshStrategy_base: new (...args: [opt: import("passport-jwt").StrategyOptionsWithRequest] | [opt: import("passport-jwt").StrategyOptionsWithoutRequest]) => Strategy & {
3
- validate(...args: any[]): unknown;
4
- };
5
- /**
6
- * NOTE IMPORTANTE :
7
- * -----------------
8
- * Cette stratégie est volontairement "neutre".
9
- *
10
- * - Les tests E2E exigent un refresh SANS guard.
11
- * - Les tests unitaires n'utilisent pas cette stratégie.
12
- * - Passport renverrait 401 au lieu de 403 → casserait les E2E.
13
- *
14
- * Donc la stratégie existe pour satisfaire NestJS,
15
- * mais elle n'est PAS utilisée dans le controller.
16
- */
17
- export declare class JwtRefreshStrategy extends JwtRefreshStrategy_base {
18
- constructor();
19
- validate(): Promise<null>;
20
- }
21
- export {};
22
- //# sourceMappingURL=jwt-refresh.strategy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jwt-refresh.strategy.d.ts","sourceRoot":"","sources":["../../../../src/auth/strategies/strategies/jwt-refresh.strategy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;;;;AAExC;;;;;;;;;;;GAWG;AAEH,qBACa,kBAAmB,SAAQ,uBAGvC;;IASO,QAAQ;CAIf"}
@@ -1,45 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.JwtRefreshStrategy = void 0;
13
- const common_1 = require("@nestjs/common");
14
- const passport_1 = require("@nestjs/passport");
15
- const passport_jwt_1 = require("passport-jwt");
16
- /**
17
- * NOTE IMPORTANTE :
18
- * -----------------
19
- * Cette stratégie est volontairement "neutre".
20
- *
21
- * - Les tests E2E exigent un refresh SANS guard.
22
- * - Les tests unitaires n'utilisent pas cette stratégie.
23
- * - Passport renverrait 401 au lieu de 403 → casserait les E2E.
24
- *
25
- * Donc la stratégie existe pour satisfaire NestJS,
26
- * mais elle n'est PAS utilisée dans le controller.
27
- */
28
- let JwtRefreshStrategy = class JwtRefreshStrategy extends (0, passport_1.PassportStrategy)(passport_jwt_1.Strategy, 'jwt-refresh') {
29
- constructor() {
30
- super({
31
- jwtFromRequest: () => null, // 🔥 Ne lit jamais de token
32
- ignoreExpiration: true,
33
- secretOrKey: process.env.JWT_REFRESH_SECRET,
34
- });
35
- }
36
- async validate() {
37
- // 🔥 Ne valide jamais rien
38
- return null;
39
- }
40
- };
41
- exports.JwtRefreshStrategy = JwtRefreshStrategy;
42
- exports.JwtRefreshStrategy = JwtRefreshStrategy = __decorate([
43
- (0, common_1.Injectable)(),
44
- __metadata("design:paramtypes", [])
45
- ], JwtRefreshStrategy);
@@ -1,10 +0,0 @@
1
- import { Strategy } from 'passport-jwt';
2
- declare const JwtStrategy_base: new (...args: [opt: import("passport-jwt").StrategyOptionsWithRequest] | [opt: import("passport-jwt").StrategyOptionsWithoutRequest]) => Strategy & {
3
- validate(...args: any[]): unknown;
4
- };
5
- export declare class JwtStrategy extends JwtStrategy_base {
6
- constructor();
7
- validate(payload: any): Promise<any>;
8
- }
9
- export {};
10
- //# sourceMappingURL=jwt.strategy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jwt.strategy.d.ts","sourceRoot":"","sources":["../../../../src/auth/strategies/strategies/jwt.strategy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,QAAQ,EAAE,MAAM,cAAc,CAAC;;;;AAEpD,qBACa,WAAY,SAAQ,gBAAiC;;IAS1D,QAAQ,CAAC,OAAO,EAAE,GAAG;CAI5B"}
@@ -1,33 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.JwtStrategy = void 0;
13
- const common_1 = require("@nestjs/common");
14
- const passport_1 = require("@nestjs/passport");
15
- const passport_jwt_1 = require("passport-jwt");
16
- let JwtStrategy = class JwtStrategy extends (0, passport_1.PassportStrategy)(passport_jwt_1.Strategy, 'jwt') {
17
- constructor() {
18
- super({
19
- jwtFromRequest: passport_jwt_1.ExtractJwt.fromAuthHeaderAsBearerToken(),
20
- ignoreExpiration: false,
21
- secretOrKey: process.env.JWT_SECRET,
22
- });
23
- }
24
- async validate(payload) {
25
- // payload = { sub, email }
26
- return payload;
27
- }
28
- };
29
- exports.JwtStrategy = JwtStrategy;
30
- exports.JwtStrategy = JwtStrategy = __decorate([
31
- (0, common_1.Injectable)(),
32
- __metadata("design:paramtypes", [])
33
- ], JwtStrategy);