source: Dev/trunk/src/server/util/crypto-token.js @ 531

Last change on this file since 531 was 525, checked in by hendrikvanantwerpen, 11 years ago
  • 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 size: 326 bytes
Line 
1var HTTPResult = require('./http-result')
2  , crypto = require('crypto');
3
4module.exports = function(bytes) {
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        });
12};
Note: See TracBrowser for help on using the repository browser.