Skip to content

Using the epoch Parameter #2

@ingk

Description

@ingk

Hello @olsio and thanks for creating otp-client!

In index.test.js you're passing epoch as an option:

const epoch = new Date('Mon, 25 Dec 1995 12:00:15 UTC').getTime()
const otp = new OTP(secret, { epoch })

I was wondering if you consider the epoch parameter as public API. Especially for writing tests in an application it's really helpful to create a token in a specific point in time. Otherwise it's only possible to test for an expected output format.
Unfortunately this parameter is not documented. By it's name and the code example I imply it to be Unix time in milliseconds.
Would you consider adding this part to the documentation or accepting pull requests for it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions