summaryrefslogtreecommitdiffstats
path: root/providers
diff options
context:
space:
mode:
authorLibravatar MCMXC <16797721+mcmxcdev@users.noreply.github.com>2024-02-10 18:19:14 -0700
committerLibravatar Vijay A <vraravam@users.noreply.github.com>2024-02-13 06:59:44 +0530
commit7584d2d7a7110aef0331ebfa178b2295842c59fa (patch)
tree900cd71237e6231b57936fcce77ff229cd459041 /providers
parentupgrade recipes submodule (diff)
downloadferdium-server-7584d2d7a7110aef0331ebfa178b2295842c59fa.tar.gz
ferdium-server-7584d2d7a7110aef0331ebfa178b2295842c59fa.tar.zst
ferdium-server-7584d2d7a7110aef0331ebfa178b2295842c59fa.zip
refactor: project maintenance
- work in progress
Diffstat (limited to 'providers')
-rw-r--r--providers/AppProvider.ts4
-rw-r--r--providers/LegacyHashDriver.ts9
-rw-r--r--providers/LegacyHasherProvider.ts12
3 files changed, 13 insertions, 12 deletions
diff --git a/providers/AppProvider.ts b/providers/AppProvider.ts
index 8d64412..c84c0e6 100644
--- a/providers/AppProvider.ts
+++ b/providers/AppProvider.ts
@@ -1,7 +1,7 @@
1import { ApplicationContract } from '@ioc:Adonis/Core/Application'; 1import { ApplicationService } from '@adonisjs/core/types'
2 2
3export default class AppProvider { 3export default class AppProvider {
4 constructor(protected app: ApplicationContract) {} 4 constructor(protected app: ApplicationService) {}
5 5
6 public register() { 6 public register() {
7 // Register your own bindings 7 // Register your own bindings
diff --git a/providers/LegacyHashDriver.ts b/providers/LegacyHashDriver.ts
index 22f9de1..eb2a263 100644
--- a/providers/LegacyHashDriver.ts
+++ b/providers/LegacyHashDriver.ts
@@ -1,5 +1,6 @@
1import bcrypt from 'bcrypt'; 1import bcrypt from 'bcrypt'
2import { HashDriverContract } from '@ioc:Adonis/Core/Hash'; 2import { HashDriverContract } from '@adonisjs/core/hash'
3
3/** 4/**
4 * Implementation of custom bcrypt driver 5 * Implementation of custom bcrypt driver
5 */ 6 */
@@ -8,12 +9,12 @@ export class LegacyHashDriver implements HashDriverContract {
8 * Hash value 9 * Hash value
9 */ 10 */
10 public async make(value: string) { 11 public async make(value: string) {
11 return bcrypt.hash(value, 10); 12 return bcrypt.hash(value, 10)
12 } 13 }
13 /** 14 /**
14 * Verify value 15 * Verify value
15 */ 16 */
16 public async verify(hashedValue: string, plainValue: string) { 17 public async verify(hashedValue: string, plainValue: string) {
17 return bcrypt.compare(plainValue, hashedValue); 18 return bcrypt.compare(plainValue, hashedValue)
18 } 19 }
19} 20}
diff --git a/providers/LegacyHasherProvider.ts b/providers/LegacyHasherProvider.ts
index 05b2d27..a4a25d9 100644
--- a/providers/LegacyHasherProvider.ts
+++ b/providers/LegacyHasherProvider.ts
@@ -1,14 +1,14 @@
1import { ApplicationContract } from '@ioc:Adonis/Core/Application'; 1import { LegacyHashDriver } from './LegacyHashDriver.js'
2import { LegacyHashDriver } from './LegacyHashDriver'; 2import { ApplicationService } from '@adonisjs/core/types'
3 3
4export default class LegacyHasherProvider { 4export default class LegacyHasherProvider {
5 constructor(protected app: ApplicationContract) {} 5 constructor(protected app: ApplicationService) {}
6 6
7 public async boot() { 7 public async boot() {
8 const Hash = this.app.container.use('Adonis/Core/Hash'); 8 const Hash = this.app.container.use('Adonis/Core/Hash')
9 9
10 Hash.extend('legacy', () => { 10 Hash.extend('legacy', () => {
11 return new LegacyHashDriver(); 11 return new LegacyHashDriver()
12 }); 12 })
13 } 13 }
14} 14}