FA.validate()

Validates the given code compared to user's key.

Usage

Hover over inputs/exits for more info.

var FA = require('machinepack-2fa');


// Validates the given code compared to user's key.

FA.validate({

key: '44xtha1v228542u5q6ddxzdoukji1m74',

code: '123456',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// Valid code.

valid: function () {

 

},

// OK.

invalid: function () {

 

},

});

Inputs

key required

The secret key, which is to be stored with the userdata.

'44xtha1v228542u5q6ddxzdoukji1m74'
code required

The code the user entered to be validated.

'123456'

Exits

error

An unexpected error occurred.

valid

Valid code.

invalid

OK.