diff --git a/server/src/auth/CustomAuthProvider.ts b/server/src/auth/CustomAuthProvider.ts index 73a6e33..122f462 100644 --- a/server/src/auth/CustomAuthProvider.ts +++ b/server/src/auth/CustomAuthProvider.ts @@ -1,14 +1,16 @@ import { BasicAuthProvider, AuthError, AuthErrorType, SHA1 } from './types' export class CustomAuthProvider extends BasicAuthProvider { + private sha1: Buffer constructor(private username: string, private password: string) { super() + this.sha1 = SHA1(this.password) } async getUserPasswordSHA1(username: string) { if (username !== this.username) { throw new AuthError(AuthErrorType.NoSuchUser, 'No such user') } - return Buffer.from(this.password, 'hex') + return this.sha1 } }