@seidor-cloud-produtos/orbit-backend-lib 0.0.24 → 0.0.25
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/README.md +0 -0
- package/dist/clean-arch/application/queue/handler.d.ts +0 -0
- package/dist/clean-arch/application/queue/handler.js +0 -0
- package/dist/clean-arch/application/queue/messages-in-memory.d.ts +0 -0
- package/dist/clean-arch/application/queue/messages-in-memory.js +0 -0
- package/dist/clean-arch/application/queue/queue-connection.d.ts +0 -0
- package/dist/clean-arch/application/queue/queue-connection.js +0 -0
- package/dist/clean-arch/application/queue/queue.d.ts +0 -0
- package/dist/clean-arch/application/queue/queue.js +0 -0
- package/dist/clean-arch/domain/entities/aggregate-root.d.ts +0 -0
- package/dist/clean-arch/domain/entities/aggregate-root.js +0 -0
- package/dist/clean-arch/domain/entities/common-dto.d.ts +0 -0
- package/dist/clean-arch/domain/entities/common-dto.js +0 -0
- package/dist/clean-arch/domain/entities/entity.d.ts +0 -0
- package/dist/clean-arch/domain/entities/entity.js +0 -0
- package/dist/clean-arch/domain/entities/unique-entity-id.d.ts +0 -0
- package/dist/clean-arch/domain/entities/unique-entity-id.js +0 -0
- package/dist/clean-arch/domain/entities/value-object.d.ts +0 -0
- package/dist/clean-arch/domain/entities/value-object.js +0 -0
- package/dist/clean-arch/domain/entities/watched-list.d.ts +0 -0
- package/dist/clean-arch/domain/entities/watched-list.js +0 -0
- package/dist/clean-arch/domain/entities/watched-list.spec.d.ts +0 -0
- package/dist/clean-arch/domain/entities/watched-list.spec.js +0 -0
- package/dist/clean-arch/domain/errors/application-error.d.ts +0 -0
- package/dist/clean-arch/domain/errors/application-error.js +0 -0
- package/dist/clean-arch/domain/errors/domain-error.d.ts +0 -0
- package/dist/clean-arch/domain/errors/domain-error.js +0 -0
- package/dist/clean-arch/domain/errors/invalid-password-algorithm-error.d.ts +4 -0
- package/dist/clean-arch/domain/errors/invalid-password-algorithm-error.js +11 -0
- package/dist/clean-arch/domain/errors/invalid-password-length-error.d.ts +4 -0
- package/dist/clean-arch/domain/errors/invalid-password-length-error.js +14 -0
- package/dist/clean-arch/domain/errors/validation-error.d.ts +0 -0
- package/dist/clean-arch/domain/errors/validation-error.js +0 -0
- package/dist/clean-arch/domain/events/domain-event.d.ts +0 -0
- package/dist/clean-arch/domain/events/domain-event.js +0 -0
- package/dist/clean-arch/domain/factories/create-password-factory.d.ts +13 -0
- package/dist/clean-arch/domain/factories/create-password-factory.js +32 -0
- package/dist/clean-arch/domain/factories/random-password-temporary-factory.d.ts +8 -0
- package/dist/clean-arch/domain/factories/random-password-temporary-factory.js +55 -0
- package/dist/clean-arch/domain/types/optional.d.ts +0 -0
- package/dist/clean-arch/domain/types/optional.js +0 -0
- package/dist/clean-arch/domain/value-objects/password.d.ts +19 -0
- package/dist/clean-arch/domain/value-objects/password.js +18 -0
- package/dist/clean-arch/domain/value-objects/pbkdf2-password.d.ts +10 -0
- package/dist/clean-arch/domain/value-objects/pbkdf2-password.js +47 -0
- package/dist/clean-arch/domain/value-objects/sha1-password.d.ts +10 -0
- package/dist/clean-arch/domain/value-objects/sha1-password.js +35 -0
- package/dist/clean-arch/infra/adapters/express-adapter.d.ts +0 -0
- package/dist/clean-arch/infra/adapters/express-adapter.js +0 -0
- package/dist/clean-arch/infra/adapters/fastify-adapter.d.ts +0 -0
- package/dist/clean-arch/infra/adapters/fastify-adapter.js +0 -0
- package/dist/clean-arch/infra/authorizations/authorization.d.ts +0 -0
- package/dist/clean-arch/infra/authorizations/authorization.js +0 -0
- package/dist/clean-arch/infra/authorizations/authorizer.d.ts +0 -0
- package/dist/clean-arch/infra/authorizations/authorizer.js +0 -0
- package/dist/clean-arch/infra/authorizations/authorizer.spec.d.ts +0 -0
- package/dist/clean-arch/infra/authorizations/authorizer.spec.js +0 -0
- package/dist/clean-arch/infra/authorizations/not-allowed.d.ts +0 -0
- package/dist/clean-arch/infra/authorizations/not-allowed.js +0 -0
- package/dist/clean-arch/infra/errors/infra-error.d.ts +0 -0
- package/dist/clean-arch/infra/errors/infra-error.js +0 -0
- package/dist/clean-arch/infra/http/controller.d.ts +0 -0
- package/dist/clean-arch/infra/http/controller.js +0 -0
- package/dist/clean-arch/infra/http/handle-bool-filter.d.ts +0 -0
- package/dist/clean-arch/infra/http/handle-bool-filter.js +0 -0
- package/dist/clean-arch/infra/http/handle-is-active-query.d.ts +0 -0
- package/dist/clean-arch/infra/http/handle-is-active-query.js +0 -0
- package/dist/clean-arch/infra/http/handle-sort-param-query.d.ts +0 -0
- package/dist/clean-arch/infra/http/handle-sort-param-query.js +0 -0
- package/dist/clean-arch/infra/http/handle-user-headers.d.ts +0 -0
- package/dist/clean-arch/infra/http/handle-user-headers.js +0 -0
- package/dist/clean-arch/infra/http/health-connections.d.ts +0 -0
- package/dist/clean-arch/infra/http/health-connections.js +0 -0
- package/dist/clean-arch/infra/http/http.d.ts +0 -0
- package/dist/clean-arch/infra/http/http.js +0 -0
- package/dist/clean-arch/shared/pagination/dto-response.d.ts +0 -0
- package/dist/clean-arch/shared/pagination/dto-response.js +0 -0
- package/dist/clean-arch/shared/pagination/get-take-and-skip.d.ts +0 -0
- package/dist/clean-arch/shared/pagination/get-take-and-skip.js +0 -0
- package/dist/clean-arch/shared/pagination/pagination.d.ts +0 -0
- package/dist/clean-arch/shared/pagination/pagination.js +0 -0
- package/dist/frameworks/express/api-gateway/mapping-model.d.ts +0 -0
- package/dist/frameworks/express/api-gateway/mapping-model.js +0 -0
- package/dist/frameworks/express/api-gateway/mapping-model.spec.d.ts +0 -0
- package/dist/frameworks/express/api-gateway/mapping-model.spec.js +0 -0
- package/dist/frameworks/express/api-gateway/middleware-express.d.ts +0 -0
- package/dist/frameworks/express/api-gateway/middleware-express.js +0 -0
- package/dist/frameworks/express/authorizations/authorization-express.d.ts +0 -0
- package/dist/frameworks/express/authorizations/authorization-express.js +0 -0
- package/dist/frameworks/express/authorizations/authorization-express.spec.d.ts +0 -0
- package/dist/frameworks/express/authorizations/authorization-express.spec.js +0 -0
- package/dist/frameworks/express/authorizations/middleware-express.d.ts +0 -0
- package/dist/frameworks/express/authorizations/middleware-express.js +0 -0
- package/dist/frameworks/express/types.d.ts +0 -0
- package/dist/frameworks/express/types.js +0 -0
- package/dist/frameworks/nest/authorizations/guard-nest.d.ts +0 -0
- package/dist/frameworks/nest/authorizations/guard-nest.js +0 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -0
- package/dist/infra/authorizations/auth-matcher.d.ts +0 -0
- package/dist/infra/authorizations/auth-matcher.js +0 -0
- package/dist/infra/authorizations/auth-matcher.spec.d.ts +0 -0
- package/dist/infra/authorizations/auth-matcher.spec.js +0 -0
- package/dist/infra/authorizations/validator/api/api-validator.d.ts +0 -0
- package/dist/infra/authorizations/validator/api/api-validator.js +0 -0
- package/dist/infra/authorizations/validator/api/factories/unauthorized-response-factory.d.ts +0 -0
- package/dist/infra/authorizations/validator/api/factories/unauthorized-response-factory.js +0 -0
- package/dist/infra/authorizations/validator/api/factories/unauthorized-response-factory.spec.d.ts +0 -0
- package/dist/infra/authorizations/validator/api/factories/unauthorized-response-factory.spec.js +0 -0
- package/dist/infra/authorizations/validator/auth-validator.d.ts +0 -0
- package/dist/infra/authorizations/validator/auth-validator.js +0 -0
- package/dist/infra/authorizations/validator/auth-validator.spec.d.ts +0 -0
- package/dist/infra/authorizations/validator/auth-validator.spec.js +0 -0
- package/dist/infra/http/api-gateway/mapping-model.d.ts +0 -0
- package/dist/infra/http/api-gateway/mapping-model.js +0 -0
- package/dist/infra/http/api-gateway/mapping-model.spec.d.ts +0 -0
- package/dist/infra/http/api-gateway/mapping-model.spec.js +3 -3
- package/dist/infra/http/errors/api-common-error.d.ts +0 -0
- package/dist/infra/http/errors/api-common-error.js +0 -0
- package/dist/infra/http/errors/api-error.d.ts +0 -0
- package/dist/infra/http/errors/api-error.js +0 -0
- package/dist/infra/http/errors/unauthorized-response.d.ts +0 -0
- package/dist/infra/http/errors/unauthorized-response.js +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
const tslib_1 = require('tslib');
|
|
4
|
+
const domain_error_1 = tslib_1.__importDefault(require('./domain-error'));
|
|
5
|
+
class InvalidPasswordAlgorithmError extends domain_error_1.default {
|
|
6
|
+
constructor() {
|
|
7
|
+
super('Invalid password algorithm.', 400);
|
|
8
|
+
this.name = 'InvalidPasswordAlgorithmError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.default = InvalidPasswordAlgorithmError;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
const tslib_1 = require('tslib');
|
|
4
|
+
const domain_error_1 = tslib_1.__importDefault(require('./domain-error'));
|
|
5
|
+
class InvalidPasswordLengthError extends domain_error_1.default {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(
|
|
8
|
+
'Invalid length password. Password must be at least 8 characters long.',
|
|
9
|
+
400,
|
|
10
|
+
);
|
|
11
|
+
this.name = 'InvalidPasswordLengthError';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.default = InvalidPasswordLengthError;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PasswordAlgorithm } from '../value-objects/password';
|
|
2
|
+
import PBKDF2Password from '../value-objects/pbkdf2-password';
|
|
3
|
+
import SHA1Password from '../value-objects/sha1-password';
|
|
4
|
+
export type CreatePasswordDomainProps = {
|
|
5
|
+
value: string;
|
|
6
|
+
algorithm: PasswordAlgorithm;
|
|
7
|
+
salt: string | null;
|
|
8
|
+
};
|
|
9
|
+
export default class CreatePasswordFactory {
|
|
10
|
+
static create(
|
|
11
|
+
password?: CreatePasswordDomainProps,
|
|
12
|
+
): PBKDF2Password | SHA1Password;
|
|
13
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
const tslib_1 = require('tslib');
|
|
4
|
+
const invalid_password_algorithm_error_1 = tslib_1.__importDefault(
|
|
5
|
+
require('../errors/invalid-password-algorithm-error'),
|
|
6
|
+
);
|
|
7
|
+
const pbkdf2_password_1 = tslib_1.__importDefault(
|
|
8
|
+
require('../value-objects/pbkdf2-password'),
|
|
9
|
+
);
|
|
10
|
+
const sha1_password_1 = tslib_1.__importDefault(
|
|
11
|
+
require('../value-objects/sha1-password'),
|
|
12
|
+
);
|
|
13
|
+
const random_password_temporary_factory_1 = tslib_1.__importDefault(
|
|
14
|
+
require('./random-password-temporary-factory'),
|
|
15
|
+
);
|
|
16
|
+
class CreatePasswordFactory {
|
|
17
|
+
static create(password) {
|
|
18
|
+
if (!password) {
|
|
19
|
+
return sha1_password_1.default.create(
|
|
20
|
+
random_password_temporary_factory_1.default.create(),
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
if (password && password.algorithm === 'sha1') {
|
|
24
|
+
return sha1_password_1.default.restore(password.value, password.salt);
|
|
25
|
+
}
|
|
26
|
+
if (password && password.algorithm === 'pbkdf2') {
|
|
27
|
+
return pbkdf2_password_1.default.restore(password.value, password.salt);
|
|
28
|
+
}
|
|
29
|
+
throw new invalid_password_algorithm_error_1.default();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.default = CreatePasswordFactory;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default class CreateRandomPasswordTemporaryFactory {
|
|
2
|
+
static create(password?: string): string;
|
|
3
|
+
static isValid(str: string): boolean;
|
|
4
|
+
private static hasSpecialCharacter;
|
|
5
|
+
private static hasUpperCaseLetter;
|
|
6
|
+
private static hasNumber;
|
|
7
|
+
private static getRandomCharacter;
|
|
8
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
class CreateRandomPasswordTemporaryFactory {
|
|
4
|
+
static create(password) {
|
|
5
|
+
if (password) {
|
|
6
|
+
return password;
|
|
7
|
+
}
|
|
8
|
+
const specials = '!@#$%^&*()_+-=[]{}|;:,.<>?';
|
|
9
|
+
const upperCaseLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
10
|
+
const allChars = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
|
11
|
+
let randomString = '';
|
|
12
|
+
randomString += this.getRandomCharacter(specials);
|
|
13
|
+
randomString += this.getRandomCharacter(upperCaseLetters);
|
|
14
|
+
randomString += this.getRandomCharacter('0123456789');
|
|
15
|
+
for (let i = 0; i < 5; i++) {
|
|
16
|
+
randomString += this.getRandomCharacter(allChars);
|
|
17
|
+
}
|
|
18
|
+
randomString = randomString
|
|
19
|
+
.split('')
|
|
20
|
+
.sort(() => Math.random() - 0.5)
|
|
21
|
+
.join('');
|
|
22
|
+
return randomString;
|
|
23
|
+
}
|
|
24
|
+
static isValid(str) {
|
|
25
|
+
const minLength = 8;
|
|
26
|
+
if (str.length < minLength) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
if (!this.hasSpecialCharacter(str)) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
if (!this.hasUpperCaseLetter(str)) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
if (!this.hasNumber(str)) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
static hasSpecialCharacter(str) {
|
|
41
|
+
const specials = '!@#$%^&*()_+-=[]{}|;:,.<>?';
|
|
42
|
+
return [...str].some(char => specials.includes(char));
|
|
43
|
+
}
|
|
44
|
+
static hasUpperCaseLetter(str) {
|
|
45
|
+
return [...str].some(char => char >= 'A' && char <= 'Z');
|
|
46
|
+
}
|
|
47
|
+
static hasNumber(str) {
|
|
48
|
+
return [...str].some(char => char >= '0' && char <= '9');
|
|
49
|
+
}
|
|
50
|
+
static getRandomCharacter(characters) {
|
|
51
|
+
const index = Math.floor(Math.random() * characters.length);
|
|
52
|
+
return characters[index];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.default = CreateRandomPasswordTemporaryFactory;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare enum PasswordAlgorithm {
|
|
2
|
+
SHA1 = 'sha1',
|
|
3
|
+
PBKDF2 = 'pbkdf2',
|
|
4
|
+
}
|
|
5
|
+
type PasswordProps = {
|
|
6
|
+
algorithm: PasswordAlgorithm;
|
|
7
|
+
isTemporary: boolean;
|
|
8
|
+
};
|
|
9
|
+
export default abstract class Password {
|
|
10
|
+
value: string;
|
|
11
|
+
salt: string | null;
|
|
12
|
+
notEncryptedValue?: string;
|
|
13
|
+
algorithm: string;
|
|
14
|
+
isTemporary: boolean;
|
|
15
|
+
abstract isEqual(password: string): boolean;
|
|
16
|
+
protected static isValid(password: string): boolean;
|
|
17
|
+
protected constructor(props: PasswordProps);
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
exports.PasswordAlgorithm = void 0;
|
|
4
|
+
var PasswordAlgorithm;
|
|
5
|
+
(function (PasswordAlgorithm) {
|
|
6
|
+
PasswordAlgorithm['SHA1'] = 'sha1';
|
|
7
|
+
PasswordAlgorithm['PBKDF2'] = 'pbkdf2';
|
|
8
|
+
})(PasswordAlgorithm || (exports.PasswordAlgorithm = PasswordAlgorithm = {}));
|
|
9
|
+
class Password {
|
|
10
|
+
static isValid(password) {
|
|
11
|
+
return password.length >= 8;
|
|
12
|
+
}
|
|
13
|
+
constructor(props) {
|
|
14
|
+
this.algorithm = props.algorithm;
|
|
15
|
+
this.isTemporary = props.isTemporary;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = Password;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Password from './password';
|
|
2
|
+
export default class PBKDF2Password extends Password {
|
|
3
|
+
readonly value: string;
|
|
4
|
+
readonly salt: string;
|
|
5
|
+
readonly notEncryptedValue?: string | undefined;
|
|
6
|
+
private constructor();
|
|
7
|
+
static create(password: string): PBKDF2Password;
|
|
8
|
+
static restore(password: string, salt: string): PBKDF2Password;
|
|
9
|
+
isEqual(password: string): boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
const tslib_1 = require('tslib');
|
|
4
|
+
const node_crypto_1 = require('node:crypto');
|
|
5
|
+
const invalid_password_length_error_1 = tslib_1.__importDefault(
|
|
6
|
+
require('../errors/invalid-password-length-error'),
|
|
7
|
+
);
|
|
8
|
+
const password_1 = tslib_1.__importStar(require('./password'));
|
|
9
|
+
class PBKDF2Password extends password_1.default {
|
|
10
|
+
constructor(value, salt, notEncryptedValue) {
|
|
11
|
+
super({
|
|
12
|
+
algorithm: password_1.PasswordAlgorithm.PBKDF2,
|
|
13
|
+
isTemporary: false,
|
|
14
|
+
});
|
|
15
|
+
this.value = value;
|
|
16
|
+
this.salt = salt;
|
|
17
|
+
this.notEncryptedValue = notEncryptedValue;
|
|
18
|
+
}
|
|
19
|
+
static create(password) {
|
|
20
|
+
if (!this.isValid(password)) {
|
|
21
|
+
throw new invalid_password_length_error_1.default();
|
|
22
|
+
}
|
|
23
|
+
const salt = (0, node_crypto_1.randomBytes)(20).toString('hex');
|
|
24
|
+
const value = (0, node_crypto_1.pbkdf2Sync)(
|
|
25
|
+
password,
|
|
26
|
+
salt,
|
|
27
|
+
100,
|
|
28
|
+
64,
|
|
29
|
+
'sha512',
|
|
30
|
+
).toString('hex');
|
|
31
|
+
return new PBKDF2Password(value, salt, password);
|
|
32
|
+
}
|
|
33
|
+
static restore(password, salt) {
|
|
34
|
+
return new PBKDF2Password(password, salt);
|
|
35
|
+
}
|
|
36
|
+
isEqual(password) {
|
|
37
|
+
const value = (0, node_crypto_1.pbkdf2Sync)(
|
|
38
|
+
password,
|
|
39
|
+
this.salt,
|
|
40
|
+
100,
|
|
41
|
+
64,
|
|
42
|
+
'sha512',
|
|
43
|
+
).toString('hex');
|
|
44
|
+
return this.value === value;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.default = PBKDF2Password;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Password from './password';
|
|
2
|
+
export default class SHA1Password extends Password {
|
|
3
|
+
readonly value: string;
|
|
4
|
+
readonly salt: string | null;
|
|
5
|
+
readonly notEncryptedValue?: string | undefined;
|
|
6
|
+
private constructor();
|
|
7
|
+
static create(password: string): SHA1Password;
|
|
8
|
+
static restore(password: string, salt: string | null): SHA1Password;
|
|
9
|
+
isEqual(password: string): boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
const tslib_1 = require('tslib');
|
|
4
|
+
const node_crypto_1 = require('node:crypto');
|
|
5
|
+
const invalid_password_length_error_1 = tslib_1.__importDefault(
|
|
6
|
+
require('../errors/invalid-password-length-error'),
|
|
7
|
+
);
|
|
8
|
+
const password_1 = tslib_1.__importStar(require('./password'));
|
|
9
|
+
class SHA1Password extends password_1.default {
|
|
10
|
+
constructor(value, salt, notEncryptedValue) {
|
|
11
|
+
super({ algorithm: password_1.PasswordAlgorithm.SHA1, isTemporary: true });
|
|
12
|
+
this.value = value;
|
|
13
|
+
this.salt = salt;
|
|
14
|
+
this.notEncryptedValue = notEncryptedValue;
|
|
15
|
+
}
|
|
16
|
+
static create(password) {
|
|
17
|
+
if (!this.isValid(password)) {
|
|
18
|
+
throw new invalid_password_length_error_1.default();
|
|
19
|
+
}
|
|
20
|
+
const value = (0, node_crypto_1.createHash)('sha1')
|
|
21
|
+
.update(password)
|
|
22
|
+
.digest('hex');
|
|
23
|
+
return new SHA1Password(value, null, password);
|
|
24
|
+
}
|
|
25
|
+
static restore(password, salt) {
|
|
26
|
+
return new SHA1Password(password, salt, undefined);
|
|
27
|
+
}
|
|
28
|
+
isEqual(password) {
|
|
29
|
+
const value = (0, node_crypto_1.createHash)('sha1')
|
|
30
|
+
.update(password)
|
|
31
|
+
.digest('hex');
|
|
32
|
+
return this.value === value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.default = SHA1Password;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/infra/authorizations/validator/api/factories/unauthorized-response-factory.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/infra/authorizations/validator/api/factories/unauthorized-response-factory.spec.d.ts
CHANGED
|
File without changes
|
package/dist/infra/authorizations/validator/api/factories/unauthorized-response-factory.spec.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -14,16 +14,16 @@ class MockMappingModel extends mapping_model_1.MappingModel {
|
|
|
14
14
|
getPathParams() {
|
|
15
15
|
throw new Error('Method not implemented.');
|
|
16
16
|
}
|
|
17
|
-
setHeader(
|
|
17
|
+
setHeader() {
|
|
18
18
|
throw new Error('Method not implemented.');
|
|
19
19
|
}
|
|
20
|
-
setQuery(
|
|
20
|
+
setQuery() {
|
|
21
21
|
throw new Error('Method not implemented.');
|
|
22
22
|
}
|
|
23
23
|
deleteParams() {
|
|
24
24
|
throw new Error('Method not implemented.');
|
|
25
25
|
}
|
|
26
|
-
setPathParams(
|
|
26
|
+
setPathParams() {
|
|
27
27
|
throw new Error('Method not implemented.');
|
|
28
28
|
}
|
|
29
29
|
next() {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|