JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 20064
  • Score
    100M100P100Q156158F

Secure Remote Password (SRP)

Package Exports

  • fast-srp-hap
  • fast-srp-hap/lib/jsbn

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fast-srp-hap) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fast-srp

Is a pure NodeJS implementation of the SRP6a protocol.

It's a derived work of Jed Parson's node-srp and Tom Wu's jsbn.

Creating the Verifier

'use strict';

var srp6a = require('fast-srp');

/**
 * Computes the verifier of a user. Only needed to add the user to the auth system.
 *
 * I: (string)		Username to compute verifier
 * P: (string)		Password
 * callback: (function) Callback function with two params; error, verifier
 *
 * returns: verifier (Buffer)
 *
 */

var srp6a_create_user = function(I, P, callback) {
  srp6a.genKey(32, function(error, salt) {
      if(error) {
        callback(error);
      }
      var v = srp6a.computeVerifier(srp6a.params[4096], salt, new Buffer(I), new Buffer(P));
      callback(null, v);
  });
}

srp6a_create_user('Zarmack Tanen', '*****', function(error, verifier) {
  if(error)
    throw error;
  console.log("SRP6a verifier of Zarmack Tanen user is " + verifier.toString('hex'));
});