module creation

This commit is contained in:
2025-12-15 21:44:06 +01:00
parent b834f88bbd
commit 7c7267da72
88 changed files with 12119 additions and 4241 deletions

View File

@@ -0,0 +1,22 @@
/**
* In-Memory Password Hashing Service
*
* Provides basic password hashing and comparison for demo/development purposes.
* NOT FOR PRODUCTION USE - uses a simple string reversal as "hashing".
*/
import type { IPasswordHashingService } from '@gridpilot/core/identity/domain/services/PasswordHashingService';
export class InMemoryPasswordHashingService implements IPasswordHashingService {
async hash(plain: string): Promise<string> {
// In a real application, use a robust hashing library like bcrypt or Argon2.
// For demo, we'll just reverse the password and add a salt-like prefix.
const salt = 'demo_salt_';
return Promise.resolve(salt + plain.split('').reverse().join(''));
}
async verify(plain: string, hash: string): Promise<boolean> {
const hashedPlain = await this.hash(plain);
return Promise.resolve(hashedPlain === hash);
}
}