refactor: introduce bindThis decorator to bind this automaticaly

This commit is contained in:
syuilo
2022-12-04 15:03:09 +09:00
parent e73581f715
commit bbb49457f9
199 changed files with 969 additions and 96 deletions

View File

@@ -103,6 +103,7 @@ function PEMString(pemBuffer: Buffer, type = 'CERTIFICATE') {
`\n-----END ${type}-----\n`
);
}
import { bindThis } from '@/decorators.js';
@Injectable()
export class TwoFactorAuthenticationService {
@@ -115,6 +116,7 @@ export class TwoFactorAuthenticationService {
) {
}
@bindThis
public hash(data: Buffer) {
return crypto
.createHash('sha256')
@@ -122,6 +124,7 @@ export class TwoFactorAuthenticationService {
.digest();
}
@bindThis
public verifySignin({
publicKey,
authenticatorData,
@@ -159,6 +162,7 @@ export class TwoFactorAuthenticationService {
.verify(PEMString(publicKey), signature);
}
@bindThis
public getProcedures() {
return {
none: {