@lyxa.ai/core 1.3.173 → 1.3.174
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/types/README.md
CHANGED
package/dist/types/package.json
CHANGED
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.hashPassword = hashPassword;
|
|
7
7
|
exports.verifyPassword = verifyPassword;
|
|
8
|
-
const server_1 = require("@trpc/server");
|
|
9
8
|
const bcryptjs_1 = __importDefault(require("bcryptjs"));
|
|
9
|
+
const error_common_1 = require("./error-common");
|
|
10
10
|
async function hashPassword(password) {
|
|
11
11
|
const salt = await bcryptjs_1.default.genSalt(10);
|
|
12
12
|
return bcryptjs_1.default.hash(password, salt);
|
|
@@ -14,10 +14,7 @@ async function hashPassword(password) {
|
|
|
14
14
|
async function verifyPassword(inputPassword, hashedPassword) {
|
|
15
15
|
const isPasswordValid = await bcryptjs_1.default.compare(inputPassword, hashedPassword);
|
|
16
16
|
if (!isPasswordValid) {
|
|
17
|
-
|
|
18
|
-
code: 'UNAUTHORIZED',
|
|
19
|
-
message: 'Incorrect email or password.',
|
|
20
|
-
});
|
|
17
|
+
(0, error_common_1.badRequestError)('Incorrect email or password');
|
|
21
18
|
}
|
|
22
19
|
}
|
|
23
20
|
//# sourceMappingURL=password.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password.js","sourceRoot":"/","sources":["utilities/password.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"password.js","sourceRoot":"/","sources":["utilities/password.ts"],"names":[],"mappings":";;;;;AAIA,oCAGC;AAED,wCAKC;AAbD,wDAA8B;AAC9B,iDAAiD;AAE1C,KAAK,UAAU,YAAY,CAAC,QAAgB;IAClD,MAAM,IAAI,GAAG,MAAM,kBAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACtC,OAAO,kBAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,aAAqB,EAAE,cAAsB;IACjF,MAAM,eAAe,GAAG,MAAM,kBAAM,CAAC,OAAO,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;IAC5E,IAAI,CAAC,eAAe,EAAE,CAAC;QACtB,IAAA,8BAAe,EAAC,6BAA6B,CAAC,CAAC;IAChD,CAAC;AACF,CAAC","sourcesContent":["import { TRPCError } from '@trpc/server';\nimport bcrypt from 'bcryptjs';\nimport { badRequestError } from './error-common';\n\nexport async function hashPassword(password: string): Promise<string> {\n\tconst salt = await bcrypt.genSalt(10);\n\treturn bcrypt.hash(password, salt);\n}\n\nexport async function verifyPassword(inputPassword: string, hashedPassword: string) {\n\tconst isPasswordValid = await bcrypt.compare(inputPassword, hashedPassword);\n\tif (!isPasswordValid) {\n\t\tbadRequestError('Incorrect email or password');\n\t}\n}\n"]}
|