All files totp.js

83.33% Statements 10/12
50% Branches 3/6
100% Functions 1/1
83.33% Lines 10/12
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24    2x 2x   1x 1x   1x 1x 1x   1x 1x                 2x  
"use strict";
// https://tools.ietf.org/html/rfc6238
Object.defineProperty(exports, "__esModule", { value: true });
const hotp_1 = require("./hotp");
function default_1(parameters) {
    let { secret, time, timestamp, codeDigits, addChecksum, truncationOffset, hmacAlgorithm } = parameters;
    Iif (!secret)
        throw new Error('no secret value');
    Eif (!time)
        time = 30;
    Iif (!timestamp)
        timestamp = new Date().getTime();
    const movingFactor = Math.floor(timestamp / 1000 / time);
    return hotp_1.default({
        secret,
        movingFactor,
        codeDigits,
        addChecksum,
        truncationOffset,
        hmacAlgorithm
    });
}
exports.default = default_1;