aboutsummaryrefslogtreecommitdiffstats
path: root/providers/LegacyHashDriver.ts
diff options
context:
space:
mode:
Diffstat (limited to 'providers/LegacyHashDriver.ts')
-rw-r--r--providers/LegacyHashDriver.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/providers/LegacyHashDriver.ts b/providers/LegacyHashDriver.ts
new file mode 100644
index 0000000..22f9de1
--- /dev/null
+++ b/providers/LegacyHashDriver.ts
@@ -0,0 +1,19 @@
1import bcrypt from 'bcrypt';
2import { HashDriverContract } from '@ioc:Adonis/Core/Hash';
3/**
4 * Implementation of custom bcrypt driver
5 */
6export class LegacyHashDriver implements HashDriverContract {
7 /**
8 * Hash value
9 */
10 public async make(value: string) {
11 return bcrypt.hash(value, 10);
12 }
13 /**
14 * Verify value
15 */
16 public async verify(hashedValue: string, plainValue: string) {
17 return bcrypt.compare(plainValue, hashedValue);
18 }
19}