index.js
function redisSetCertificateKeypair(options, keypair, callback) {
    _debug('le-store-redis.redisSetCertificateKeypair', '\nkeypair:', keypair);
    var keypairId = 'keypair-' + crypto.createHash('sha256')
      .update(keypair.publicKeyPem).digest('hex');
    var jsonKeypair = JSON.stringify(keypair);

    async.parallel([
      function(callback) {
        // write the cert to the database
        client.set(keypairId, jsonKeypair, callback);
        return client.expire(keypairId, moduleOptions.certExpiry);
      },
      function(callback) {
        if(options.domains) {
          // create a domain to keypair index
          return async.each(options.domains, function(domain, callback) {
            _createIndex('idx-d2k', domain, keypairId,
              moduleOptions.certExpiry, callback);
          }, function(err) {
            callback(err);
          });
        }
        callback();
      }], function(err) {
        if(err) {
          return callback(err);
        }
        callback(null, keypair);
    });
  }
function redisSetCertificateKeypair(options, keypair, callback) {
    _debug('le-store-redis.redisSetCertificateKeypair', '\nkeypair:', keypair);
    var keypairId = 'keypair-' + crypto.createHash('sha256')
      .update(keypair.publicKeyPem).digest('hex');
    var jsonKeypair = JSON.stringify(keypair);

    async.parallel([
      function(callback) {
        // write the cert to the database
        client.set(keypairId, jsonKeypair, callback);
        return client.expire(keypairId, moduleOptions.certExpiry);
      },
      function(callback) {
        if(options.domains) {
          // create a domain to keypair index
          return async.each(options.domains, function(domain, callback) {
            _createIndex('idx-d2k', domain, keypairId,
              moduleOptions.certExpiry, callback);
          }, function(err) {
            callback(err);
          });
        }
        callback();
      }], function(err) {
        if(err) {
          return callback(err);
        }
        callback(null, keypair);
    });
  }
function redisSetCertificateKeypair ( options , keypair , callback ) { _debug ( 'le-store-redis.redisSetCertificateKeypair' , '\nkeypair:' , keypair ) ; var keypairId = 'keypair-' + crypto . createHash ( 'sha256' ) . update ( keypair . publicKeyPem ) . digest ( 'hex' ) ; var jsonKeypair = JSON . stringify ( keypair ) ; async . parallel ( [ function ( callback ) { // write the cert to the database client . set ( keypairId , jsonKeypair , callback ) ; return client . expire ( keypairId , moduleOptions . certExpiry ) ; } , function ( callback ) { if ( options . domains ) { // create a domain to keypair index return async . each ( options . domains , function ( domain , callback ) { _createIndex ( 'idx-d2k' , domain , keypairId , moduleOptions . certExpiry , callback ) ; } , function ( err ) { callback ( err ) ; } ) ; } callback ( ) ; } ] , function ( err ) { if ( err ) { return callback ( err ) ; } callback ( null , keypair ) ; } ) ; }
Stores a keypair associated with a certificate in the database.

@param {Object[]} options - options passed to storage call
@param {string} options[].domains - domains that should be associated
with the certificate via database indexes (to aid in lookups).
@param {Function} callback(err, keypair) - called when an error occurs, or
when a keypair is successfully written to the database.
Stores a keypair associated with a certificate in the database .