nomorepass

1.4.7 • Public • Published

nomorepass

Libraries to use nomorepass.com security services

nomorepass is a library to use nomorepass in Node or browser. It is intended to use in any environment, so it does not generate / print the qr-code needed, instead provides the text that should be included in the qrcode (you can generate using any qrcode libraries).

Node Installation

npm install nomorepass

Usage

To receive passwords:

 var nmp = require('nomorepass');
// Initialize the environment (do it each time you need)
 nmp.init({'apikey':'MYAPIKEY'});
 // 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({'apikey':'MYAPIKEY'});
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.
            })
        }
    }
);

In the browser

There are included libraries to use directly on the browser. You'll find inside the www directory. To use inside your page you should include this files:

<script src="js/aes.js"></script>
<script src="js/nomorepass.js"></script>

We have included for demo purpouses the QRCode for Javascript library from http://jeromeetienne.github.com/jquery-qrcode/

<script src="js/qrcode.js"></script>

Designate a div where show the qr (#qrcode in the example).

To receive a password (using QRCode to show the qr) and fill two fields (#username and #password):

var qrelement = document.querySelector('#qrcode');
NomorePass.init({'apikey':'MYAPIKEY'});
NomorePass.getQrText(window.location.href,function(text){
    qrelement.innerHTML="";
    qrelement.style.display="block";
    new QRCode(qrelement, text);
    qrelement.onclick=function(e){
        window.open(text,'_system');
    };
    // Waiting...
    NomorePass.start(function(error,data){
        if (error)
            alert (data);
        else {
            document.querySelector('#username').value=data.user;
            document.querySelector('#password').value=data.password;
            qrelement.innerHTML="";
        }
    });
});

To send user and pass to the phone:

var qrelement = document.querySelector('#qrcode');
NomorePass.init({'apikey':'MYAPIKEY'});
NomorePass.getQrSend ('testpage',user,pass,{type:'pwd'}, 
    function (text){
        if (text==false){
            alert("Error calling nmp");
        } else {
            // Show the qr with this text
            qrelement.innerHTML="";
            qrelement.style.display="block";
            new QRCode(qrelement, text);
            qrelement.onclick=function(e){
                window.open(text,'_system');
            };
            // wait to be scanned and received
            // by the app (optional)
            NomorePass.send (function(data){
                qrelement.innerHTML="<p>Password received</p>";
                console.log(data);
                // hide qr here.
            })
        }
    }
);

test

You can test the browser libraries by opening www/test.html in your favourite browser and receive / send passwords.

How to use NoMorePass

  1. Download and install the mobile app
  1. Open it and create a new password (or use some of yours)
  2. Then you can scan the qrcode generated by the library to send securely this password to your app or send/update passwords from your code to the app.

Help / more info

Visit nomorepass.com or leave an Issue

(C) 2021 Nomorepass.com

Package Sidebar

Install

npm i nomorepass

Weekly Downloads

1

Version

1.4.7

License

Apache-2.0

Unpacked Size

118 kB

Total Files

11

Last publish

Collaborators

  • yoprogramo