@contentstack/cli-auth
Version:
Contentstack CLI plugin for authentication activities
56 lines (55 loc) • 1.75 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.askTokenType = exports.askUsername = exports.askOTP = exports.askOTPChannel = exports.askPassword = void 0;
const cli_utilities_1 = require("@contentstack/cli-utilities");
const askPassword = async () => {
return cli_utilities_1.cliux.inquire({
type: 'input',
message: 'CLI_AUTH_LOGIN_ENTER_PASSWORD',
name: 'password',
transformer: (pswd) => {
return '*'.repeat(pswd.length);
},
});
};
exports.askPassword = askPassword;
const askOTPChannel = async () => {
return cli_utilities_1.cliux.inquire({
type: 'list',
name: 'otpChannel',
message: 'CLI_AUTH_LOGIN_ASK_CHANNEL_FOR_OTP',
choices: [
{ name: 'Authenticator App', value: 'authenticator_app' },
{ name: 'SMS', value: 'sms' },
],
});
};
exports.askOTPChannel = askOTPChannel;
const askOTP = async () => {
return cli_utilities_1.cliux.inquire({
type: 'input',
message: 'CLI_AUTH_LOGIN_ENTER_SECURITY_CODE',
name: 'tfaToken',
});
};
exports.askOTP = askOTP;
const askUsername = async () => {
return cli_utilities_1.cliux.inquire({
type: 'input',
message: 'CLI_AUTH_LOGIN_ENTER_EMAIL_ADDRESS',
name: 'username',
});
};
exports.askUsername = askUsername;
const askTokenType = async () => {
return cli_utilities_1.cliux.inquire({
type: 'list',
name: 'tokenType',
message: 'CLI_SELECT_TOKEN_TYPE',
choices: [
{ name: 'Management Token', value: 'management' },
{ name: 'Delivery Token', value: 'delivery' },
],
});
};
exports.askTokenType = askTokenType;