1
0
mirror of https://github.com/0rangebananaspy/authelia.git synced 2024-09-14 22:47:21 +07:00
authelia/server/src/lib/authentication/totp/TotpHandlerStub.spec.ts
Clement Michaud c82f910da3 Refactor configuration to remove optional sections from minimal template
Also move tests from dedicated directory to source dir with .spec.ts extension
2018-08-09 23:52:53 +02:00

22 lines
616 B
TypeScript

import Sinon = require("sinon");
import BluebirdPromise = require("bluebird");
import { ITotpHandler } from "./ITotpHandler";
import { TOTPSecret } from "../../../../types/TOTPSecret";
export class TotpHandlerStub implements ITotpHandler {
generateStub: Sinon.SinonStub;
validateStub: Sinon.SinonStub;
constructor() {
this.generateStub = Sinon.stub();
this.validateStub = Sinon.stub();
}
generate(label: string, issuer: string): TOTPSecret {
return this.generateStub(label, issuer);
}
validate(token: string, secret: string): boolean {
return this.validateStub(token, secret);
}
}