olsio / otp-client

MIT License
11 stars 6 forks source link

Using the epoch Parameter #2

Open ingk opened 5 years ago

ingk commented 5 years ago

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?

olsio commented 5 years ago

Sure just send me a PR.