@jovijovi/two-fa.js
Version:
A two-factor authentication(2FA) based on HOTP & TOTP written in TypeScript
40 lines • 1.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WithQR = exports.WithHashFunc = exports.WithDefaultHashFunc = exports.NewOptions = void 0;
const hash_1 = require("./hash");
// NewOptions returns new options
function NewOptions(...optionFunc) {
const opts = {
HashFunc: (0, hash_1.DefaultHashFunc)(),
withHash: false,
withQR: false,
};
for (const f of optionFunc) {
f(opts);
}
return opts;
}
exports.NewOptions = NewOptions;
// WithDefaultHashFunc option to configure default hash function (sha1)
function WithDefaultHashFunc() {
return (o) => {
o.withHash = true;
};
}
exports.WithDefaultHashFunc = WithDefaultHashFunc;
// WithHashFunc option to configure hash function
function WithHashFunc(hashFunc) {
return (o) => {
o.HashFunc = hashFunc;
o.withHash = true;
};
}
exports.WithHashFunc = WithHashFunc;
// WithQR option to configure QR
function WithQR(isDryRun) {
return (o) => {
o.withQR = isDryRun;
};
}
exports.WithQR = WithQR;
//# sourceMappingURL=options.js.map