{"size": 2120, "ext": "js", "max_stars_repo_path": "node_modules/botframework-connector/lib/auth/certificateAppCredentials.js", "max_stars_repo_name": "mrismail91/drtemp", "max_stars_repo_stars_event_min_datetime": "2020-06-04T01:39:04.000Z", "max_stars_repo_stars_event_max_datetime": "2020-06-04T01:39:04.000Z", "max_issues_repo_path": "node_modules/botframework-connector/lib/auth/certificateAppCredentials.js", "max_issues_repo_name": "mrismail91/drtemp", "max_issues_repo_issues_event_min_datetime": "2018-12-06T17:03:26.000Z", "max_issues_repo_issues_event_max_datetime": "2020-09-12T16:57:44.000Z", "max_forks_repo_path": "node_modules/botframework-connector/lib/auth/certificateAppCredentials.js", "max_forks_repo_name": "mrismail91/drtemp", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 10, "max_forks_count": null, "avg_line_length": 45.1063829787, "max_line_length": 197, "alphanum_fraction": 0.6216981132}
"use strict";
/**
 * @module botbuilder
 */
/**
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License.
 */
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
const appCredentials_1 = require("./appCredentials");
/**
 * CertificateAppCredentials auth implementation
 */
class CertificateAppCredentials extends appCredentials_1.AppCredentials {
    constructor(appId, certificateThumbprint, certificatePrivateKey, channelAuthTenant, oAuthScope) {
        super(appId, channelAuthTenant, oAuthScope);
        this.certificateThumbprint = certificateThumbprint;
        this.certificatePrivateKey = certificatePrivateKey;
    }
    refreshToken() {
        return __awaiter(this, void 0, void 0, function* () {
            if (!this.refreshingToken) {
                this.refreshingToken = new Promise((resolve, reject) => {
                    this.authenticationContext.acquireTokenWithClientCertificate(this.oAuthScope, this.appId, this.certificatePrivateKey, this.certificateThumbprint, function (err, tokenResponse) {
                        if (err) {
                            reject(err);
                        }
                        else {
                            resolve(tokenResponse);
                        }
                    });
                });
            }
            return this.refreshingToken;
        });
    }
}
exports.CertificateAppCredentials = CertificateAppCredentials;
//# sourceMappingURL=certificateAppCredentials.js.map