const redis = require('redis-mock');
const client = redis.createClient();
const vCaptcha = require('vcaptcha')({ client });
const userId = 'userId';
vCaptcha.create({
userId,
language: 'en',
length: 2
}, (err, captcha, count) => {
console.log(captcha.phrase);
const guess = [0, 1];
vCaptcha.solve({
userId,
unique: captcha.unique,
solution: guess
}, valid => {
console.log(valid ? 'RIGHT ANSWER' : 'WRONG ANSWER');
});
});