Skip to content

generate and verify ephemeral key-value pairs (212 B)

Notifications You must be signed in to change notification settings

michaelrhodes/one-time-value

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

one-time-value

generate and verify ephemeral key-value pairs

ci

install

npm install https://pkg.mkr.sx/one-time-value/2.0.0.tgz

use

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)

obey

CC0-1.0

About

generate and verify ephemeral key-value pairs (212 B)

Resources

Stars

Watchers

Forks