Binds the store to one directory on one filesystem.
Injected filesystem access.
Absolute OTP_REQUESTS_PATH; every file name derives from it.
Publishes a new request as its own file.
The bank the OTP is for.
Time-to-live in milliseconds before the request expires.
Current time in epoch ms (defaults to Date.now()).
The created request.
Lists the live requests that have no answer yet, oldest first.
Current time in epoch ms (defaults to Date.now()).
The pending requests; none when the directory cannot be read.
Publishes the user's code as a live request's answer.
Once the code is published, the request is read again: an importer that gives the request up removes the request file before its last look at the answer, so a missing request means that look may be over. The code is then withdrawn, unless the importer has already used it.
The request id to submit against.
The OTP code entered by the user.
Current time in epoch ms (defaults to Date.now()).
True when the code was accepted; false when there is no such live request, it already has an answer, or the importer gave it up while the code was being published.
Looks for the answer to a request, settling it once there is one or the deadline is reached.
A code ends the request: it is returned, the request file removed and the code replaced by a tombstone, all best-effort, so a code that has arrived is never withheld. Settling, with a code or an expiry, also removes any staged copy of the answer a publish left behind. At the deadline the importer races the portal for the answer: winning records the expiry, and losing means the portal published a code in time, which is returned. If the expiry cannot be recorded, the importer gives the request up, still taking a code that has arrived.
The request create returned.
Current time in epoch ms (defaults to Date.now()).
Whether to keep waiting, the code, or that the request expired.
Removes the OTP files nothing will read again.
How many were removed, or why the directory could not be read.
Persists app-OTP requests and their answers as files on a shared volume.