"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.verifyApiKey = void 0;
const callControlPlaneApi_1 = require("../callContolPlane/callControlPlaneApi");
const verifyApiKey = async (apiKey, controlPlaneUrl) => {
    try {
        const response = await (0, callControlPlaneApi_1.callControlPlane)(`/validate/apiKey`, {
            method: 'GET',
            params: { apiKey },
        }, '', controlPlaneUrl);
        if (response?.error) {
            throw new Error(response?.error);
        }
        if (!response?.status) {
            throw new Error('Error while verifying Api key');
        }
        return response?.response;
    }
    catch (error) {
        console.error('Error verifying apiKey:', error);
        throw error;
    }
};
exports.verifyApiKey = verifyApiKey;
//# sourceMappingURL=index.js.map