diff --git a/dist/index.js b/dist/index.js
new file mode 100644
index 0000000..348fb0e
--- /dev/null
+++ b/dist/index.js
@@ -0,0 +1,3 @@
+"use strict";
+
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
diff --git a/dist/smartssh.classes.helpers.js b/dist/smartssh.classes.helpers.js
new file mode 100644
index 0000000..8920ebc
--- /dev/null
+++ b/dist/smartssh.classes.helpers.js
@@ -0,0 +1,7 @@
+"use strict";
+exports.sshKeyArrayFromDir = function (dirArg) {
+ var sshKeyArray = [];
+ return sshKeyArray;
+};
+
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLmNsYXNzZXMuaGVscGVycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBSVcsMEJBQWtCLEdBQUcsVUFBUyxNQUFhO0lBQ2xELElBQUksV0FBVyxHQUFHLEVBQUUsQ0FBQztJQUNyQixNQUFNLENBQUMsV0FBVyxDQUFDO0FBQ3ZCLENBQUMsQ0FBQSIsImZpbGUiOiJzbWFydHNzaC5jbGFzc2VzLmhlbHBlcnMuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLy8gPHJlZmVyZW5jZSBwYXRoPVwiLi90eXBpbmdzL21haW4uZC50c1wiIC8+XG5pbXBvcnQgcGx1Z2lucyA9IHJlcXVpcmUoXCIuL3NtYXJ0c3NoLnBsdWdpbnNcIik7XG5pbXBvcnQgY2xhc3NlcyA9IHJlcXVpcmUoXCIuL3NtYXJ0c3NoLmNsYXNzZXNcIik7XG5cbmV4cG9ydCBsZXQgc3NoS2V5QXJyYXlGcm9tRGlyID0gZnVuY3Rpb24oZGlyQXJnOnN0cmluZyk6Y2xhc3Nlcy5zc2hLZXlbXXtcbiAgICBsZXQgc3NoS2V5QXJyYXkgPSBbXTtcbiAgICByZXR1cm4gc3NoS2V5QXJyYXk7XG59Il0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9
diff --git a/dist/smartssh.classes.js b/dist/smartssh.classes.js
new file mode 100644
index 0000000..b7e7e65
--- /dev/null
+++ b/dist/smartssh.classes.js
@@ -0,0 +1,106 @@
+"use strict";
+///
+var plugins = require("./smartssh.plugins");
+var helpers = require("./smartssh.classes.helpers");
+var ssh = (function () {
+ function ssh(optionsArg) {
+ if (optionsArg === void 0) { optionsArg = {}; }
+ this.sshDir = optionsArg.sshDir;
+ this.sshDir ?
+ this.sshKeys = helpers.sshKeyArrayFromDir(this.sshDir)
+ : void (0);
+ this.sync = optionsArg.sync;
+ }
+ ;
+ return ssh;
+}());
+exports.ssh = ssh;
+var sshConfig = (function () {
+ function sshConfig() {
+ }
+ return sshConfig;
+}());
+exports.sshConfig = sshConfig;
+var sshKey = (function () {
+ function sshKey(optionsArg) {
+ if (!optionsArg)
+ optionsArg = { private: undefined, public: undefined };
+ this.privKey = optionsArg.private;
+ this.pubKey = optionsArg.public;
+ }
+ ;
+ Object.defineProperty(sshKey.prototype, "privateKey", {
+ // getters
+ get: function () {
+ return this.privKey;
+ },
+ // setters
+ set: function (privateKeyArg) {
+ this.privKey = privateKeyArg;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ ;
+ Object.defineProperty(sshKey.prototype, "privateKeyBase64", {
+ get: function () {
+ return plugins.base64.encode(this.privKey);
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(sshKey.prototype, "publicKey", {
+ get: function () {
+ return this.publicKey;
+ },
+ // setters
+ set: function (publicKeyArg) {
+ this.pubKey = publicKeyArg;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(sshKey.prototype, "publicKeyBase64", {
+ get: function () {
+ return plugins.base64.encode(this.pubKey);
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(sshKey.prototype, "type", {
+ get: function () {
+ if (this.privKey && this.pubKey) {
+ return "duplex";
+ }
+ else if (this.privKey) {
+ return "private";
+ }
+ else if (this.pubKey) {
+ return "public";
+ }
+ },
+ enumerable: true,
+ configurable: true
+ });
+ ;
+ ;
+ ;
+ sshKey.prototype.store = function (filePathArg) {
+ var filePathObj = plugins.path.parse(filePathArg);
+ if (filePathObj.ext = ".priv") {
+ plugins.smartfile.memory.toFsSync(this.privKey, { fileName: filePathObj.name + filePathObj.ext, filePath: filePathObj.dir });
+ }
+ else if (filePathObj.ext = ".pub") {
+ plugins.smartfile.memory.toFsSync(this.pubKey, { fileName: filePathObj.name + filePathObj.ext, filePath: filePathObj.dir });
+ }
+ else {
+ plugins.fs.ensureDirSync(filePathObj.dir);
+ this.store(plugins.path.join(filePathObj.dir, "key.priv")); // call this function recursivly
+ this.store(plugins.path.join(filePathObj.dir, "key.priv")); // call this function recursivly
+ }
+ };
+ return sshKey;
+}());
+exports.sshKey = sshKey;
+
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLmNsYXNzZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDRDQUE0QztBQUM1QyxJQUFPLE9BQU8sV0FBVyxvQkFBb0IsQ0FBQyxDQUFDO0FBQy9DLElBQU8sT0FBTyxXQUFXLDRCQUE0QixDQUFDLENBQUM7QUFFdkQ7SUFJSSxhQUFZLFVBQTRDO1FBQTVDLDBCQUE0QyxHQUE1QyxlQUE0QztRQUNwRCxJQUFJLENBQUMsTUFBTSxHQUFHLFVBQVUsQ0FBQyxNQUFNLENBQUE7UUFDL0IsSUFBSSxDQUFDLE1BQU07WUFDUCxJQUFJLENBQUMsT0FBTyxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDO2NBQ3BELEtBQUksQ0FBQyxDQU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cml2XCIpKTsgLy8gY2FsbCB0aGlzIGZ1bmN0aW9uIHJlY3Vyc2l2bHlcbiAgICAgICAgfVxuICAgIH1cbn0iXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
diff --git a/dist/smartssh.plugins.js b/dist/smartssh.plugins.js
new file mode 100644
index 0000000..bb53b1f
--- /dev/null
+++ b/dist/smartssh.plugins.js
@@ -0,0 +1,9 @@
+"use strict";
+///
+exports.beautylog = require("beautylog");
+exports.base64 = require("js-base64").Base64;
+exports.fs = require("fs-extra");
+exports.path = require("path");
+exports.smartfile = require("smartfile");
+
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDRDQUE0QztBQUNqQyxpQkFBUyxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQztBQUNqQyxjQUFNLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDLE1BQU0sQ0FBQztBQUNyQyxVQUFFLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO0FBQ3pCLFlBQUksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUM7QUFDdkIsaUJBQVMsR0FBRyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUMiLCJmaWxlIjoic21hcnRzc2gucGx1Z2lucy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vLyA8cmVmZXJlbmNlIHBhdGg9XCIuL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbmV4cG9ydCBsZXQgYmVhdXR5bG9nID0gcmVxdWlyZShcImJlYXV0eWxvZ1wiKTtcbmV4cG9ydCBsZXQgYmFzZTY0ID0gcmVxdWlyZShcImpzLWJhc2U2NFwiKS5CYXNlNjQ7XG5leHBvcnQgbGV0IGZzID0gcmVxdWlyZShcImZzLWV4dHJhXCIpO1xuZXhwb3J0IGxldCBwYXRoID0gcmVxdWlyZShcInBhdGhcIik7XG5leHBvcnQgbGV0IHNtYXJ0ZmlsZSA9IHJlcXVpcmUoXCJzbWFydGZpbGVcIik7Il0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9
diff --git a/package.json b/package.json
index 2852da8..825c30a 100644
--- a/package.json
+++ b/package.json
@@ -20,5 +20,15 @@
"bugs": {
"url": "https://github.com/pushrocks/smartssh/issues"
},
- "homepage": "https://github.com/pushrocks/smartssh#readme"
+ "homepage": "https://github.com/pushrocks/smartssh#readme",
+ "dependencies": {
+ "beautylog": "^4.1.2",
+ "fs-extra": "^0.28.0",
+ "js-base64": "^2.1.9",
+ "smartfile": "^3.0.5"
+ },
+ "devDependencies": {
+ "npmts": "^5.0.4",
+ "should": "^8.3.1"
+ }
}
diff --git a/test/test.js b/test/test.js
new file mode 100644
index 0000000..6e2a415
--- /dev/null
+++ b/test/test.js
@@ -0,0 +1,5 @@
+///
+var should = require("should");
+var smartssh = require("../dist/index.js");
+
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztBQUMvQixJQUFJLFFBQVEsR0FBRyxPQUFPLENBQUMsa0JBQWtCLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4uL3RzL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbmxldCBzaG91bGQgPSByZXF1aXJlKFwic2hvdWxkXCIpO1xubGV0IHNtYXJ0c3NoID0gcmVxdWlyZShcIi4uL2Rpc3QvaW5kZXguanNcIik7XG4iXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
diff --git a/test/test.ts b/test/test.ts
new file mode 100644
index 0000000..d24580f
--- /dev/null
+++ b/test/test.ts
@@ -0,0 +1,3 @@
+///
+let should = require("should");
+let smartssh = require("../dist/index.js");
diff --git a/ts/index.ts b/ts/index.ts
new file mode 100644
index 0000000..9c058b4
--- /dev/null
+++ b/ts/index.ts
@@ -0,0 +1,3 @@
+///
+import plugins = require("./smartssh.plugins");
+import classes = require("./smartssh.classes");
\ No newline at end of file
diff --git a/ts/smartssh.classes.helpers.ts b/ts/smartssh.classes.helpers.ts
new file mode 100644
index 0000000..887dbaf
--- /dev/null
+++ b/ts/smartssh.classes.helpers.ts
@@ -0,0 +1,8 @@
+///
+import plugins = require("./smartssh.plugins");
+import classes = require("./smartssh.classes");
+
+export let sshKeyArrayFromDir = function(dirArg:string):classes.sshKey[]{
+ let sshKeyArray = [];
+ return sshKeyArray;
+}
\ No newline at end of file
diff --git a/ts/smartssh.classes.ts b/ts/smartssh.classes.ts
new file mode 100644
index 0000000..dbef45a
--- /dev/null
+++ b/ts/smartssh.classes.ts
@@ -0,0 +1,78 @@
+///
+import plugins = require("./smartssh.plugins");
+import helpers = require("./smartssh.classes.helpers");
+
+export class ssh {
+ private sshDir:string;
+ private sshKeys:sshKey[];
+ private sync:boolean; // if set to true, the ssh dir will be kept in sync automatically
+ constructor(optionsArg:{sshDir?:string,sync?:boolean}={}){
+ this.sshDir = optionsArg.sshDir
+ this.sshDir ?
+ this.sshKeys = helpers.sshKeyArrayFromDir(this.sshDir)
+ : void(0);
+ this.sync = optionsArg.sync;
+ };
+
+}
+
+export class sshConfig {
+ constructor(){
+
+ }
+}
+
+export class sshKey {
+ private privKey:string;
+ private pubKey:string;
+ constructor(optionsArg:{private:string,public:string}){
+ if(!optionsArg) optionsArg = {private:undefined,public:undefined};
+ this.privKey = optionsArg.private;
+ this.pubKey = optionsArg.public;
+ };
+
+ // getters
+ get privateKey(){
+ return this.privKey;
+ };
+ get privateKeyBase64(){
+ return plugins.base64.encode(this.privKey);
+ }
+ get publicKey(){
+ return this.publicKey;
+ }
+ get publicKeyBase64(){
+ return plugins.base64.encode(this.pubKey);
+ }
+ get type(){
+ if(this.privKey && this.pubKey){
+ return "duplex";
+ } else if(this.privKey){
+ return "private";
+ } else if(this.pubKey){
+ return "public";
+ }
+ };
+
+ // setters
+ set privateKey(privateKeyArg:string){
+ this.privKey = privateKeyArg;
+ };
+ // setters
+ set publicKey(publicKeyArg:string){
+ this.pubKey = publicKeyArg;
+ };
+
+ store(filePathArg?:string){
+ let filePathObj = plugins.path.parse(filePathArg);
+ if(filePathObj.ext = ".priv"){
+ plugins.smartfile.memory.toFsSync(this.privKey,{fileName:filePathObj.name + filePathObj.ext,filePath:filePathObj.dir});
+ } else if (filePathObj.ext = ".pub"){
+ plugins.smartfile.memory.toFsSync(this.pubKey,{fileName:filePathObj.name + filePathObj.ext,filePath:filePathObj.dir});
+ } else { //we assume we are given a directory as filePathArg, so we store the whole key
+ plugins.fs.ensureDirSync(filePathObj.dir);
+ this.store(plugins.path.join(filePathObj.dir,"key.priv")); // call this function recursivly
+ this.store(plugins.path.join(filePathObj.dir,"key.priv")); // call this function recursivly
+ }
+ }
+}
\ No newline at end of file
diff --git a/ts/smartssh.plugins.ts b/ts/smartssh.plugins.ts
new file mode 100644
index 0000000..f8efa78
--- /dev/null
+++ b/ts/smartssh.plugins.ts
@@ -0,0 +1,6 @@
+///
+export let beautylog = require("beautylog");
+export let base64 = require("js-base64").Base64;
+export let fs = require("fs-extra");
+export let path = require("path");
+export let smartfile = require("smartfile");
\ No newline at end of file
diff --git a/ts/typings.json b/ts/typings.json
new file mode 100644
index 0000000..16d0dcf
--- /dev/null
+++ b/ts/typings.json
@@ -0,0 +1,8 @@
+{
+ "version": false,
+ "dependencies": {},
+ "ambientDependencies": {
+ "colors": "registry:dt/colors#0.6.0-1+20160317120654",
+ "node": "registry:dt/node#4.0.0+20160423143914"
+ }
+}