node-test.js 617 B

12345678910111213141516171819202122
  1. /*
  2. * Copyright 2018 Scytl Secure Electronic Voting SA
  3. *
  4. * All rights reserved
  5. *
  6. * See our extended copyright notice in *file 'Copyright.txt' which is part of this source code package
  7. */
  8. /* jshint node:true, jasmine:true */
  9. 'use strict';
  10. var secureRandom = require('../lib/index');
  11. try {
  12. var service_ = secureRandom.newService();
  13. var randomGenerator_ = service_.newRandomGenerator();
  14. randomGenerator_.nextBytes(10);
  15. randomGenerator_.nextBigIntegerByDigits(10);
  16. randomGenerator_.nextBigIntegerByDigits(10);
  17. } catch (e) {
  18. throw new Error('Secure random module cannot be used with node.js: ' + e);
  19. }