@anatix/runtime 1.0.3 → 1.0.5
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/contracts/service-options.d.ts +1 -0
- package/dist/contracts/service-options.d.ts.map +1 -1
- package/dist/guards/index.d.ts +0 -1
- package/dist/guards/index.d.ts.map +1 -1
- package/dist/guards/index.js +0 -1
- package/dist/guards/index.js.map +1 -1
- package/dist/security/aes.adapter.d.ts +13 -0
- package/dist/security/aes.adapter.d.ts.map +1 -0
- package/dist/security/aes.adapter.js +105 -0
- package/dist/security/aes.adapter.js.map +1 -0
- package/dist/security/bcrypt.adapter.d.ts +1 -0
- package/dist/security/bcrypt.adapter.d.ts.map +1 -1
- package/dist/security/bcrypt.adapter.js +3 -0
- package/dist/security/bcrypt.adapter.js.map +1 -1
- package/dist/security/index.d.ts +1 -0
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1 -0
- package/dist/security/index.js.map +1 -1
- package/dist/security/interfaces/encryption.adapter.d.ts +6 -0
- package/dist/security/interfaces/encryption.adapter.d.ts.map +1 -0
- package/dist/security/interfaces/encryption.adapter.js +3 -0
- package/dist/security/interfaces/encryption.adapter.js.map +1 -0
- package/dist/security/interfaces/hashing.adapter.d.ts +1 -0
- package/dist/security/interfaces/hashing.adapter.d.ts.map +1 -1
- package/dist/security/interfaces/index.d.ts +1 -0
- package/dist/security/interfaces/index.d.ts.map +1 -1
- package/dist/security/interfaces/index.js +1 -0
- package/dist/security/interfaces/index.js.map +1 -1
- package/dist/security/security.config.d.ts +1 -0
- package/dist/security/security.config.d.ts.map +1 -1
- package/dist/security/security.config.js +1 -0
- package/dist/security/security.config.js.map +1 -1
- package/dist/security/tokens/injection.tokens.d.ts +1 -0
- package/dist/security/tokens/injection.tokens.d.ts.map +1 -1
- package/dist/security/tokens/injection.tokens.js +2 -1
- package/dist/security/tokens/injection.tokens.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-options.d.ts","sourceRoot":"","sources":["../../src/contracts/service-options.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;AAEtC,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"service-options.d.ts","sourceRoot":"","sources":["../../src/contracts/service-options.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;AAEtC,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAGD,MAAM,MAAM,eAAe,GAAG,kBAAkB,CAAC;AACjD,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,CAAC"}
|
package/dist/guards/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guards/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AAGxB,cAAc,cAAc,CAAC;AAG7B,cAAc,SAAS,CAAC;AAGxB,cAAc,QAAQ,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guards/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AAGxB,cAAc,cAAc,CAAC;AAG7B,cAAc,SAAS,CAAC;AAGxB,cAAc,QAAQ,CAAC"}
|
package/dist/guards/index.js
CHANGED
package/dist/guards/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/guards/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,0CAAwB;AAGxB,+CAA6B;AAG7B,0CAAwB;AAGxB,yCAAuB
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/guards/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,0CAAwB;AAGxB,+CAA6B;AAG7B,0CAAwB;AAGxB,yCAAuB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EncryptionAdapter } from './interfaces';
|
|
2
|
+
import { type SecurityConfig } from './security.config';
|
|
3
|
+
export declare class AesAdapter implements EncryptionAdapter {
|
|
4
|
+
private readonly config;
|
|
5
|
+
private readonly algorithm;
|
|
6
|
+
private readonly ivLength;
|
|
7
|
+
private readonly keyBuffer;
|
|
8
|
+
constructor(config?: SecurityConfig);
|
|
9
|
+
encrypt(plainText: string): Promise<string>;
|
|
10
|
+
decrypt(encryptedText: string): Promise<string>;
|
|
11
|
+
isEncrypted(value: string): boolean;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=aes.adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aes.adapter.d.ts","sourceRoot":"","sources":["../../src/security/aes.adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAkC/E,qBAAa,UAAW,YAAW,iBAAiB;IAKtC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAM;IAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEN,MAAM,GAAE,cAAsC;IAoCrE,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA6B3C,OAAO,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA6CrD,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGpC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AesAdapter = void 0;
|
|
37
|
+
const crypto = __importStar(require("crypto"));
|
|
38
|
+
const security_config_1 = require("./security.config");
|
|
39
|
+
class AesAdapter {
|
|
40
|
+
config;
|
|
41
|
+
algorithm = 'aes-256-gcm';
|
|
42
|
+
ivLength = 16;
|
|
43
|
+
keyBuffer;
|
|
44
|
+
constructor(config = security_config_1.defaultSecurityConfig) {
|
|
45
|
+
this.config = config;
|
|
46
|
+
const key = this.config.encryptionKey ?? security_config_1.defaultSecurityConfig.encryptionKey;
|
|
47
|
+
if (!key) {
|
|
48
|
+
throw new Error('AesAdapter: encryptionKey is required in SecurityConfig. ' +
|
|
49
|
+
'Set it via environment variable or config object.');
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
this.keyBuffer = Buffer.isBuffer(key)
|
|
53
|
+
? key
|
|
54
|
+
: Buffer.from(key, 'hex');
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
throw new Error(`AesAdapter: Invalid encryptionKey format. Expected hex string or Buffer. Error: ${error}`);
|
|
58
|
+
}
|
|
59
|
+
if (this.keyBuffer.length !== 32) {
|
|
60
|
+
throw new Error(`AesAdapter: encryptionKey must be 32 bytes (256 bits). Got ${this.keyBuffer.length} bytes. ` +
|
|
61
|
+
'Generate a secure key with: crypto.randomBytes(32).toString("hex")');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async encrypt(plainText) {
|
|
65
|
+
if (!plainText) {
|
|
66
|
+
throw new Error('AesAdapter.encrypt: plainText cannot be empty');
|
|
67
|
+
}
|
|
68
|
+
const iv = crypto.randomBytes(this.ivLength);
|
|
69
|
+
const cipher = crypto.createCipheriv(this.algorithm, this.keyBuffer, iv);
|
|
70
|
+
let encrypted = cipher.update(plainText, 'utf8', 'hex');
|
|
71
|
+
encrypted += cipher.final('hex');
|
|
72
|
+
const tag = cipher.getAuthTag();
|
|
73
|
+
return `aes256gcm:${iv.toString('hex')}:${tag.toString('hex')}:${encrypted}`;
|
|
74
|
+
}
|
|
75
|
+
async decrypt(encryptedText) {
|
|
76
|
+
if (!encryptedText) {
|
|
77
|
+
throw new Error('AesAdapter.decrypt: encryptedText cannot be empty');
|
|
78
|
+
}
|
|
79
|
+
const parts = encryptedText.split(':');
|
|
80
|
+
if (parts.length !== 4 || parts[0] !== 'aes256gcm') {
|
|
81
|
+
throw new Error('AesAdapter.decrypt: Invalid encrypted format. ' +
|
|
82
|
+
'Expected format: aes256gcm:iv:tag:encrypted');
|
|
83
|
+
}
|
|
84
|
+
const [, ivHex, tagHex, encrypted] = parts;
|
|
85
|
+
try {
|
|
86
|
+
const iv = Buffer.from(ivHex, 'hex');
|
|
87
|
+
const tag = Buffer.from(tagHex, 'hex');
|
|
88
|
+
const decipher = crypto.createDecipheriv(this.algorithm, this.keyBuffer, iv);
|
|
89
|
+
decipher.setAuthTag(tag);
|
|
90
|
+
let decrypted = decipher.update(encrypted, 'hex', 'utf8');
|
|
91
|
+
decrypted += decipher.final('utf8');
|
|
92
|
+
return decrypted;
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
throw new Error(`AesAdapter.decrypt: Decryption failed. ` +
|
|
96
|
+
`Possible causes: wrong key, corrupted data, or tampered ciphertext. ` +
|
|
97
|
+
`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
isEncrypted(value) {
|
|
101
|
+
return typeof value === 'string' && value.startsWith('aes256gcm:');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.AesAdapter = AesAdapter;
|
|
105
|
+
//# sourceMappingURL=aes.adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aes.adapter.js","sourceRoot":"","sources":["../../src/security/aes.adapter.ts"],"names":[],"mappings":"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"}
|
|
@@ -4,6 +4,7 @@ export declare class BcryptAdapter implements HashingAdapter {
|
|
|
4
4
|
private readonly config;
|
|
5
5
|
constructor(config?: SecurityConfig);
|
|
6
6
|
hash(plain: string): Promise<string>;
|
|
7
|
+
compare(plain: string, hashed: string): Promise<boolean>;
|
|
7
8
|
isHashed(value: string): boolean;
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=bcrypt.adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bcrypt.adapter.d.ts","sourceRoot":"","sources":["../../src/security/bcrypt.adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAG/E,qBAAa,aAAc,YAAW,cAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,GAAE,cAAsC;IAErE,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"bcrypt.adapter.d.ts","sourceRoot":"","sources":["../../src/security/bcrypt.adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAG/E,qBAAa,aAAc,YAAW,cAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,GAAE,cAAsC;IAErE,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAKpC,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI9D,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGjC"}
|
|
@@ -45,6 +45,9 @@ class BcryptAdapter {
|
|
|
45
45
|
const rounds = this.config.hashSaltRounds ?? security_config_1.defaultSecurityConfig.hashSaltRounds;
|
|
46
46
|
return bcrypt.hash(plain, rounds);
|
|
47
47
|
}
|
|
48
|
+
async compare(plain, hashed) {
|
|
49
|
+
return bcrypt.compare(plain, hashed);
|
|
50
|
+
}
|
|
48
51
|
isHashed(value) {
|
|
49
52
|
return typeof value === 'string' && /^\$2[aby]\$/.test(value);
|
|
50
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bcrypt.adapter.js","sourceRoot":"","sources":["../../src/security/bcrypt.adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AAEnC,uDAA+E;AAG/E,MAAa,aAAa;IACK;IAA7B,YAA6B,SAAyB,uCAAqB;QAA9C,WAAM,GAAN,MAAM,CAAwC;IAAG,CAAC;IAE/E,KAAK,CAAC,IAAI,CAAC,KAAa;QACtB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,IAAI,uCAAqB,CAAC,cAAe,CAAC;QACnF,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;IAED,QAAQ,CAAC,KAAa;QACpB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"bcrypt.adapter.js","sourceRoot":"","sources":["../../src/security/bcrypt.adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AAEnC,uDAA+E;AAG/E,MAAa,aAAa;IACK;IAA7B,YAA6B,SAAyB,uCAAqB;QAA9C,WAAM,GAAN,MAAM,CAAwC;IAAG,CAAC;IAE/E,KAAK,CAAC,IAAI,CAAC,KAAa;QACtB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,IAAI,uCAAqB,CAAC,cAAe,CAAC;QACnF,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,KAAa,EAAE,MAAc;QACzC,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,QAAQ,CAAC,KAAa;QACpB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;CACF;AAfD,sCAeC"}
|
package/dist/security/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC;AAG7B,cAAc,UAAU,CAAC;AAGzB,cAAc,mBAAmB,CAAC;AAGlC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC;AAG7B,cAAc,UAAU,CAAC;AAGzB,cAAc,mBAAmB,CAAC;AAGlC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
|
package/dist/security/index.js
CHANGED
|
@@ -18,4 +18,5 @@ __exportStar(require("./interfaces"), exports);
|
|
|
18
18
|
__exportStar(require("./tokens"), exports);
|
|
19
19
|
__exportStar(require("./security.config"), exports);
|
|
20
20
|
__exportStar(require("./bcrypt.adapter"), exports);
|
|
21
|
+
__exportStar(require("./aes.adapter"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,+CAA6B;AAG7B,2CAAyB;AAGzB,oDAAkC;AAGlC,mDAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,+CAA6B;AAG7B,2CAAyB;AAGzB,oDAAkC;AAGlC,mDAAiC;AACjC,gDAA8B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption.adapter.d.ts","sourceRoot":"","sources":["../../../src/security/interfaces/encryption.adapter.ts"],"names":[],"mappings":"AAgDA,MAAM,WAAW,iBAAiB;IAahC,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAe5C,OAAO,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAiBhD,WAAW,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CACtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption.adapter.js","sourceRoot":"","sources":["../../../src/security/interfaces/encryption.adapter.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashing.adapter.d.ts","sourceRoot":"","sources":["../../../src/security/interfaces/hashing.adapter.ts"],"names":[],"mappings":"AAgCA,MAAM,WAAW,cAAc;IAa7B,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAiBrC,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CACnC"}
|
|
1
|
+
{"version":3,"file":"hashing.adapter.d.ts","sourceRoot":"","sources":["../../../src/security/interfaces/hashing.adapter.ts"],"names":[],"mappings":"AAgCA,MAAM,WAAW,cAAc;IAa7B,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAiBrC,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAiBzD,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CACnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/security/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/security/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC"}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./hashing.adapter"), exports);
|
|
18
|
+
__exportStar(require("./encryption.adapter"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/security/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/security/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,uDAAqC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.config.d.ts","sourceRoot":"","sources":["../../src/security/security.config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"security.config.d.ts","sourceRoot":"","sources":["../../src/security/security.config.ts"],"names":[],"mappings":"AAsBA,MAAM,WAAW,cAAc;IAM7B,cAAc,CAAC,EAAE,MAAM,CAAC;IAkBxB,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAGD,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAQjD,eAAO,MAAM,qBAAqB,EAAE,cAInC,CAAC"}
|
|
@@ -4,5 +4,6 @@ exports.defaultSecurityConfig = exports.SECURITY_CONFIG = void 0;
|
|
|
4
4
|
exports.SECURITY_CONFIG = 'SECURITY_CONFIG';
|
|
5
5
|
exports.defaultSecurityConfig = {
|
|
6
6
|
hashSaltRounds: 12,
|
|
7
|
+
encryptionKey: process.env.ENCRYPTION_KEY || '0'.repeat(64),
|
|
7
8
|
};
|
|
8
9
|
//# sourceMappingURL=security.config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.config.js","sourceRoot":"","sources":["../../src/security/security.config.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"security.config.js","sourceRoot":"","sources":["../../src/security/security.config.ts"],"names":[],"mappings":";;;AAkDa,QAAA,eAAe,GAAG,iBAAiB,CAAC;AAQpC,QAAA,qBAAqB,GAAmB;IACnD,cAAc,EAAE,EAAE;IAElB,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;CAC5D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injection.tokens.d.ts","sourceRoot":"","sources":["../../../src/security/tokens/injection.tokens.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,eAAe,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"injection.tokens.d.ts","sourceRoot":"","sources":["../../../src/security/tokens/injection.tokens.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAuCjD,eAAO,MAAM,kBAAkB,uBAAuB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HASHING_ADAPTER = void 0;
|
|
3
|
+
exports.ENCRYPTION_ADAPTER = exports.HASHING_ADAPTER = void 0;
|
|
4
4
|
exports.HASHING_ADAPTER = 'HASHING_ADAPTER';
|
|
5
|
+
exports.ENCRYPTION_ADAPTER = 'ENCRYPTION_ADAPTER';
|
|
5
6
|
//# sourceMappingURL=injection.tokens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injection.tokens.js","sourceRoot":"","sources":["../../../src/security/tokens/injection.tokens.ts"],"names":[],"mappings":";;;AA4Ba,QAAA,eAAe,GAAG,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"injection.tokens.js","sourceRoot":"","sources":["../../../src/security/tokens/injection.tokens.ts"],"names":[],"mappings":";;;AA4Ba,QAAA,eAAe,GAAG,iBAAiB,CAAC;AAuCpC,QAAA,kBAAkB,GAAG,oBAAoB,CAAC"}
|