tethys.backend/providers/HashDriver/index.ts
Arno Kaimbacher 4714dfdd94
All checks were successful
CI Pipeline / japa-tests (push) Successful in 46s
- use latest prettier 3.0 with eslint-plugin-prettier: 5.0.0-alpha.2
- npm normal updates
- add all xslt and style asstes in extra folder public/assets2
- linting corrections
- delete local .env.test from git tracking: git rm --cached .env.test
- add .env.test into .gitignore file
- add edit functionality for editing by submitter
- npm updates
-added xslt3 packeage for builfing sef files
- added Language.ts class vor language table
- added version to datasetxml2oai-pmh.xslt
2023-07-17 19:13:30 +02:00

22 lines
687 B
TypeScript

import { HashDriverContract } from '@ioc:Adonis/Core/Hash';
// const bcrypt = require("bcrypt");
import bcrypt from 'bcryptjs';
const saltRounds = 10;
export class LaravelHash implements HashDriverContract {
public async make(value: string) {
const hashedValue = bcrypt.hashSync(value, saltRounds);
return hashedValue;
}
public async verify(hashedValue: string, plainValue: string) {
let newHash: string;
if (hashedValue.includes('$2y$10$')) {
newHash = hashedValue.replace('$2y$10$', '$2a$10$');
} else {
newHash = hashedValue;
}
return await bcrypt.compareSync(plainValue, newHash);
}
}