generate and verify ephemeral key-value pairs
npm install https://pkg.mkr.sx/one-time-value/2.0.0.tgz
var otv = require('one-time-value')
// Basic usage
var value = otv(generator)
var val = value('key')
value.verify('key', val) // true
value.verify('key', val) // false
function generator () {
return Math.random()
.toString(32)
.substr(2)
}
// With TTL (in milliseconds)
var value = otv(generator, 1000)
var val = value('key')
value.expiry('key') // timestamp
setTimeout(function () {
value.verify('key', val) // false
}, 1500)