Ignore:
Timestamp:
03/19/14 21:33:13 (11 years ago)
Author:
hendrikvanantwerpen
Message:
  • Allow empty subcodes.
  • Use HTTPResult exclusively on server (no more q).
  • Set readonly & disabled on ourselves as well in _ComplexValueMixin
  • Split server into several modules.
  • Check codes on the variable level, not question level.
  • We can add modules in design documents now.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/server/util/crypto-token.js

    r487 r525  
    1 var Q = require('q')
     1var HTTPResult = require('./http-result')
    22  , crypto = require('crypto');
    33
    44module.exports = function(bytes) {
    5     var q = Q.defer();
    6     crypto.randomBytes(bytes || 8, function(ex, buf) {
    7         if ( ex ) {
    8             q.reject(ex);
    9         } else {
    10             q.resolve(buf.toString('hex'));
    11         }
    12     });
    13     return q.promise;
     5    bytes  =bytes || 8;
     6    var result = new HTTPResult();
     7    crypto.randomBytes(bytes, result.asCallback(201));
     8    return result
     9        .then(function(buf){
     10            return buf.toString('hex');
     11        });
    1412};
Note: See TracChangeset for help on using the changeset viewer.