2016-05-31 17:16:45 +00:00
|
|
|
"use strict";
|
|
|
|
require("typings-global");
|
2016-06-01 00:31:29 +00:00
|
|
|
var plugins = require("./smartssh.plugins");
|
2016-05-31 17:16:45 +00:00
|
|
|
var helpers = require("./smartssh.classes.helpers");
|
|
|
|
var SshDir = (function () {
|
2016-06-25 00:29:34 +00:00
|
|
|
function SshDir(sshKeyArray, sshDirPathArg) {
|
|
|
|
this.sshKeyArray = sshKeyArray;
|
2016-06-01 00:31:29 +00:00
|
|
|
if (sshDirPathArg) {
|
2016-06-25 00:29:34 +00:00
|
|
|
this.path = sshDirPathArg;
|
2016-06-01 00:31:29 +00:00
|
|
|
}
|
|
|
|
else {
|
2016-06-25 00:29:34 +00:00
|
|
|
this.path = plugins.path.join(plugins.smartpath.get.home(), ".ssh/");
|
2016-06-01 00:31:29 +00:00
|
|
|
}
|
2016-06-25 00:29:34 +00:00
|
|
|
;
|
2016-05-31 17:16:45 +00:00
|
|
|
}
|
2016-06-24 00:49:55 +00:00
|
|
|
SshDir.prototype.writeToDir = function () {
|
2016-06-25 00:29:34 +00:00
|
|
|
var _this = this;
|
|
|
|
this.sshKeyArray.forEach(function (sshKeyArg) {
|
|
|
|
sshKeyArg.store(_this.path);
|
|
|
|
});
|
2016-05-31 17:16:45 +00:00
|
|
|
};
|
|
|
|
;
|
2016-06-24 00:49:55 +00:00
|
|
|
SshDir.prototype.readFromDir = function () {
|
2016-06-01 00:31:29 +00:00
|
|
|
};
|
2016-05-31 17:16:45 +00:00
|
|
|
SshDir.prototype.getKeys = function () {
|
|
|
|
return helpers.sshKeyArrayFromDir(this.path);
|
|
|
|
};
|
|
|
|
return SshDir;
|
|
|
|
}());
|
|
|
|
exports.SshDir = SshDir;
|
|
|
|
|
2016-06-25 00:29:34 +00:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLmNsYXNzZXMuc3NoZGlyLnRzIl0sIm5h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