Booster.js 514 B

1234567891011121314151617181920212223
  1. var CryptoJS = require('crypto-js');
  2. const SHA = CryptoJS.SHA256;
  3. // var salt = CryptoJS.lib.WordArray.random(128 / 8).toString();
  4. class Booster {
  5. constructor(user) {
  6. if(!user) throw Error("Booster must be owned by a user!");
  7. this.id = this.randomID();
  8. this.treasure = this.randomTreasure();
  9. this.user = user;
  10. }
  11. randomID() {
  12. return CryptoJS.lib.WordArray.random(128 / 8).toString();
  13. }
  14. randomTreasure() {
  15. return CryptoJS.lib.WordArray.random(256 / 8).toString();
  16. }
  17. }
  18. module.exports = Booster;