text: "use strict";
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports["default"] = void 0;
  
  var _jsonwebtoken = _interopRequireDefault(require("jsonwebtoken"));
  
  require("dotenv/config");
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  
  var nextDay = new Date().setDate(new Date().getDate() + 1);
  
  var Token = /*#__PURE__*/function () {
    function Token() {
      _classCallCheck(this, Token);
    }
  
    _createClass(Token, null, [{
      key: "generateToken",
      value: function () {
        var _generateToken = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(payload) {
          var exp,
              details,
              token,
              _args = arguments;
          return regeneratorRuntime.wrap(function _callee$(_context) {
            while (1) {
              switch (_context.prev = _context.next) {
                case 0:
                  exp = _args.length > 1 && _args[1] !== undefined ? _args[1] : nextDay;
                  details = {
                    iss: 'codeSecret',
                    sub: payload.id,
                    iat: new Date().getTime(),
                    exp: exp
                  };
                  _context.next = 4;
                  return _jsonwebtoken["default"].sign(details, process.env.JWT_SECRET);
  
                case 4:
                  token = _context.sent;
                  return _context.abrupt("return", token);
  
                case 6:
                case "end":
                  return _context.stop();
              }
            }
          }, _callee);
        }));
  
        function generateToken(_x) {
          return _generateToken.apply(this, arguments);
        }
  
        return generateToken;
      }()
    }]);
  
    return Token;
  }();
  
  var _default = Token;
  exports["default"] = _default;