UNPKG

@awhere/api

Version:

The awesome aWhere API for JavaScript.

115 lines 3.96 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var randomstring_1 = __importDefault(require("randomstring")); var PrototypeBase_1 = __importDefault(require("../PrototypeBase")); var OAuthGrantCode = /** @class */ (function (_super) { __extends(OAuthGrantCode, _super); function OAuthGrantCode(props) { if (props === void 0) { props = {}; } var _this = _super.call(this, props) || this; _this._id = props._id || OAuthGrantCode.generateId(); if (props.code !== undefined) { _this.code = props.code; } else { _this.code = OAuthGrantCode.generateAuthorizationCode(); } if (props.client !== undefined) { _this.client = props.client; } if (props.user !== undefined) { _this.user = props.user; } if (props.expiresAt !== undefined) { _this.expiresAt = props.expiresAt; } return _this; } OAuthGrantCode.generateId = function () { return _super.generateId.call(this, 'awhere.core.oauth-grant-code'); }; OAuthGrantCode.generateAuthorizationCode = function () { return randomstring_1.default.generate(16); }; Object.defineProperty(OAuthGrantCode.prototype, "code", { get: function () { return this._code; }, set: function (value) { this._code = value; }, enumerable: false, configurable: true }); Object.defineProperty(OAuthGrantCode.prototype, "client", { get: function () { return this._client; }, set: function (value) { this._client = value; }, enumerable: false, configurable: true }); Object.defineProperty(OAuthGrantCode.prototype, "user", { get: function () { return this._user; }, set: function (value) { this._user = value; }, enumerable: false, configurable: true }); Object.defineProperty(OAuthGrantCode.prototype, "codeChallenge", { get: function () { return this._codeChallenge; }, set: function (v) { this._codeChallenge = v; }, enumerable: false, configurable: true }); Object.defineProperty(OAuthGrantCode.prototype, "codeChallengeMethod", { get: function () { return this._codeChallengeMethod; }, set: function (v) { this._codeChallengeMethod = v; }, enumerable: false, configurable: true }); Object.defineProperty(OAuthGrantCode.prototype, "expiresAt", { get: function () { return this._expiresAt; }, set: function (value) { this._expiresAt = value; }, enumerable: false, configurable: true }); return OAuthGrantCode; }(PrototypeBase_1.default)); exports.default = OAuthGrantCode; //# sourceMappingURL=OAuthGrantCode.js.map