+34 91 288 73 76 info@nomorepass.com

Node.js module

If you are writing a hybrid application with Node. js and want to use NoMorePass for your login system, now you have the libraries, with Apache 2.0 license in this repository:

https://github.com/yoprogramo/nomorepass

Installation

npm install nomorepass

Usage

To receive passwords:

 var nmp = require('nomorepass');
// Initialize the environment (do it each time you need)
 nmp.init();
 // Launch the process for testsite (replace with you app-id)
 nmp.getQrText('testsite', function(text){
    if (text==false) {
        console.log("Error calling nomorepass");
    } else {
        console.log(text);
        // Show the qr generated for text
        // Start waiting for mobile app scanning 
        nmp.start(function(error,data){
            if (error) {
                console.log("Error "+data);
            } else {
                console.log(data);
                // Use the data provided:
                // {user: 'username', password: 'password', extra: json-encoded-extra-info}
            }
         });
        // Stop after 1 minute (you can stop manually calling nmp.stop())
        setTimeout(nmp.stop,60000);
    }
 });

To send passwords:

var nmp = require('nomorepass');
// Initialize the environment (do it each time you need)
nmp.init();
var user = 'usernametosend';
var pass = 'thepasstosend';
nmp.getQrSend (null,user,pass,{type:'pwd'}, 
    function (text){
        if (text==false){
            console.log("Error calling nmp");
        } else {
            console.log(text);
            // Show the qr with this text
            // wait to be scanned and received
            // by the app
            nmp.send (function(data){
                console.log(data);
                // hide qr here.
            })
        }
    }
);

Any questions/comments/improvements can be left in the repository.