"use strict"; require("typings-global"); var plugins = require("./smartssh.plugins"); var SshConfig = (function () { function SshConfig(sshKeyArrayArg) { this.sshKeyArray = sshKeyArrayArg; } /** * stores a config file */ SshConfig.prototype.store = function (dirPathArg) { var done = plugins.q.defer(); var configArray = []; var configString; for (var key in this.sshKeyArray) { var sshKey = this.sshKeyArray[key]; if (sshKey.host) { configString = "Host " + sshKey.host + "\n" + " HostName " + sshKey.host + "\n" + " IdentityFile ~/.ssh/" + sshKey.host + "\n" + " StrictHostKeyChecking no" + "\n"; } configArray.push({ configString: configString, authorized: sshKey.authorized, sshKey: sshKey }); } var configFile = ""; for (var key in configArray) { configFile = configFile + configArray[key].configString + "\n"; } ; plugins.smartfile.memory.toFsSync(configFile, plugins.path.join(dirPathArg, "config")); return done.promise; }; SshConfig.prototype.read = function (dirPathArg) { var done = plugins.q.defer(); var configArray; return done.promise; }; return SshConfig; }()); exports.SshConfig = SshConfig; ; ; //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLmNsYXNzZXMuc3NoY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDeEIsSUFBWSxPQUFPLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUk5QztJQUVJLG1CQUFZLGNBQXVCO1FBQy9CLElBQUksQ0FBQyxXQUFXLEdBQUcsY0FBYyxDQUFDO0lBQ3RDLENBQUM7SUFFRDs7T0FFRztJQUNILHlCQUFLLEdBQUwsVUFBTSxVQUFpQjtRQUNuQixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO1FBQzdCLElBQUksV0FBVyxHQUFrQixFQUFFLENBQUM7UUFDcEMsSUFBSSxZQUFZLENBQUM7UUFDakIsR0FBRyxDQUFBLENBQUMsSUFBSSxHQUFHLElBQUksSUFBS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maWdTdHJpbmc7XG4gICAgICAgIGZvcihsZXQga2V5IGluIHRoaXMuc3NoS2V5QXJyYXkpe1xuICAgICAgICAgICAgbGV0IHNzaEtleSA9IHRoaXMuc3NoS2V5QXJyYXlba2V5XTtcbiAgICAgICAgICAgIGlmKHNzaEtleS5ob3N0KXtcbiAgICAgICAgICAgICAgICBjb25maWdTdHJpbmcgPSBcIkhvc3QgXCIgKyBzc2hLZXkuaG9zdCArIFwiXFxuXCIgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIiAgSG9zdE5hbWUgXCIgKyBzc2hLZXkuaG9zdCArIFwiXFxuXCIgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIiAgSWRlbnRpdHlGaWxlIH4vLnNzaC9cIiArIHNzaEtleS5ob3N0ICsgXCJcXG5cIiArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiICBTdHJpY3RIb3N0S2V5Q2hlY2tpbmcgbm9cIiArIFwiXFxuXCJcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbmZpZ0FycmF5LnB1c2goe1xuICAgICAgICAgICAgICAgIGNvbmZpZ1N0cmluZzpjb25maWdTdHJpbmcsXG4gICAgICAgICAgICAgICAgYXV0aG9yaXplZDogc3NoS2V5LmF1dGhvcml6ZWQsXG4gICAgICAgICAgICAgICAgc3NoS2V5OiBzc2hLZXlcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGxldCBjb25maWdGaWxlOnN0cmluZyA9IFwiXCI7XG4gICAgICAgIGZvcihsZXQga2V5IGluIGNvbmZpZ0FycmF5KXtcbiAgICAgICAgICAgIGNvbmZpZ0ZpbGUgPSBjb25maWdGaWxlICsgY29uZmlnQXJyYXlba2V5XS5jb25maWdTdHJpbmcgKyBcIlxcblwiO1xuICAgICAgICB9O1xuICAgICAgICBwbHVnaW5zLnNtYXJ0ZmlsZS5tZW1vcnkudG9Gc1N5bmMoY29uZmlnRmlsZSxwbHVnaW5zLnBhdGguam9pbihkaXJQYXRoQXJnLFwiY29uZmlnXCIpKTtcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcbiAgICB9XG4gICAgcmVhZChkaXJQYXRoQXJnKXtcbiAgICAgICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcbiAgICAgICAgbGV0IGNvbmZpZ0FycmF5OmNvbmZpZ09iamVjdFtdO1xuICAgICAgICBcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcbiAgICB9XG59O1xuXG5leHBvcnQgaW50ZXJmYWNlIGNvbmZpZ09iamVjdCB7XG4gICAgY29uZmlnU3RyaW5nOnN0cmluZztcbiAgICBhdXRob3JpemVkOmJvb2xlYW47XG4gICAgc3NoS2V5OlNzaEtleTtcbn07XG5cbiJdfQ==