Program for doing giveaways with JSON Web Tokens

Usage no npm install needed!

<script type="module">
  import jwtGiveaway from 'https://cdn.skypack.dev/jwt-giveaway';


JWT Giveaway

Node program for running a giveaway through the use of JSON Web Tokens (jwt). Each participant that enters will receive a JWT. They can decode this token at jwt.io to determine if they are a winner.


const JWTGiveaway = require('jwt-giveaway');
const giveaway = new JWTGiveaway(1); //create giveaway where 1 represents the number of winners
giveaway.start(); //starts the giveaway and accepting entries
giveaway.enter("<USERNAME>"); //enters the username into the giveaway
const {err, data : { userToTokenMap } } = giveaway.stop(); //stops the giveaways and returns a map of username entries to JWTs
const {err, data: { msg } } = giveaway.checkForWinner("<USERNAME>", "<TOKEN>") //validates whether or not the token is valid for the given usernameå