appstore-cli
Version:
A command-line interface (CLI) to interact with the Apple App Store Connect API.
58 lines (57 loc) • 2.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FastlaneTokenValidator = void 0;
var dataHandler_1 = require("../security/dataHandler");
/**
* Validates a Fastlane auth token
*/
var FastlaneTokenValidator = /** @class */ (function () {
function FastlaneTokenValidator() {
}
/**
* Validates that a Fastlane token is valid
* @param token The token to validate
* @returns True if valid, false otherwise
*/
FastlaneTokenValidator.validateToken = function (token) {
try {
// Check if token is provided
if (!token || token.trim().length === 0) {
dataHandler_1.safeLogger.error('Fastlane token is required');
return false;
}
// Check if token has reasonable length (Fastlane tokens are typically long)
if (token.length < 10) {
dataHandler_1.safeLogger.error('Fastlane token appears to be too short');
return false;
}
// Fastlane tokens are typically alphanumeric with possible special characters
// We won't be too restrictive here to avoid false negatives
dataHandler_1.safeLogger.debug('Fastlane token format is valid');
return true;
}
catch (error) {
dataHandler_1.safeLogger.error('Error validating Fastlane token', {
error: error.message
});
return false;
}
};
/**
* Checks if a string looks like a valid Fastlane token format
* @param token The token to check
* @returns True if the format looks valid, false otherwise
*/
FastlaneTokenValidator.isValidFormat = function (token) {
if (!token)
return false;
// Fastlane tokens are typically long strings with alphanumeric characters
// and may include special characters like dashes, underscores, or dots
// This is a basic check - actual validation should be done by Fastlane
var basicFormat = /^[A-Za-z0-9\-_.]+$/;
return basicFormat.test(token) && token.length >= 10;
};
return FastlaneTokenValidator;
}());
exports.FastlaneTokenValidator = FastlaneTokenValidator;
exports.default = FastlaneTokenValidator;