@armi-wave/common 1.17.0 → 1.19.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/package.json +26 -23
- package/build/enums/AccountType.d.ts +0 -5
- package/build/enums/AccountType.js +0 -9
- package/build/enums/PaidPlan.d.ts +0 -4
- package/build/enums/PaidPlan.js +0 -8
- package/build/enums/PostType.d.ts +0 -7
- package/build/enums/PostType.js +0 -11
- package/build/errors/bad-request-error.d.ts +0 -9
- package/build/errors/bad-request-error.js +0 -18
- package/build/errors/custom-error.d.ts +0 -8
- package/build/errors/custom-error.js +0 -9
- package/build/errors/database-connection-error.d.ts +0 -9
- package/build/errors/database-connection-error.js +0 -22
- package/build/errors/not-authorized-error.d.ts +0 -8
- package/build/errors/not-authorized-error.js +0 -21
- package/build/errors/not-found-error.d.ts +0 -8
- package/build/errors/not-found-error.js +0 -21
- package/build/errors/request-validation-error.d.ts +0 -11
- package/build/errors/request-validation-error.js +0 -23
- package/build/index.d.ts +0 -15
- package/build/index.js +0 -42
- package/build/middlewares/current-user.d.ts +0 -15
- package/build/middlewares/current-user.js +0 -17
- package/build/middlewares/error-handler.d.ts +0 -2
- package/build/middlewares/error-handler.js +0 -17
- package/build/middlewares/require-auth.d.ts +0 -2
- package/build/middlewares/require-auth.js +0 -14
- package/build/middlewares/validate-request.d.ts +0 -2
- package/build/middlewares/validate-request.js +0 -16
- package/build/models/Comment.d.ts +0 -30
- package/build/models/Comment.js +0 -65
- package/build/models/Post.d.ts +0 -33
- package/build/models/Post.js +0 -73
- package/build/models/User.d.ts +0 -68
- package/build/models/User.js +0 -190
- package/build/utils/CountryUtils.d.ts +0 -5
- package/build/utils/CountryUtils.js +0 -30
- package/build/utils/countries.d.ts +0 -5
- package/build/utils/countries.js +0 -1215
- package/build/utils/password.d.ts +0 -4
- package/build/utils/password.js +0 -31
package/build/utils/password.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const crypto_1 = require("crypto");
|
|
13
|
-
const util_1 = require("util");
|
|
14
|
-
const scryptAsync = (0, util_1.promisify)(crypto_1.scrypt);
|
|
15
|
-
class Password {
|
|
16
|
-
static toHash(password) {
|
|
17
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
const salt = (0, crypto_1.randomBytes)(16).toString('hex');
|
|
19
|
-
const buffer = (yield scryptAsync(password, salt, 64));
|
|
20
|
-
return `${buffer.toString('hex')}.${salt}`;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
static compare(storedPassword, suppliedPassword) {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
const [hashedPassword, salt] = storedPassword.split('.');
|
|
26
|
-
const buffer = (yield scryptAsync(suppliedPassword, salt, 64));
|
|
27
|
-
return buffer.toString('hex') === hashedPassword;
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.default = Password;
|