diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..b10b8cb
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,43 @@
+image: hosttoday/ht-docker-node:latest
+
+stages:
+- test
+- release
+- page
+
+testLTS:
+ stage: test
+ script:
+ - npmci test lts
+ tags:
+ - docker
+
+testSTABLE:
+ stage: test
+ script:
+ - npmci test stable
+ tags:
+ - docker
+
+release:
+ stage: release
+ script:
+ - npmci publish
+ only:
+ - tags
+ tags:
+ - docker
+
+pages:
+ stage: page
+ script:
+ - npmci test lts
+ - mkdir .public
+ - cp -r test/assets/docs/ .public
+ - cp -r test/assets/coverage/ .public
+ - mv .public public
+ artifacts:
+ paths:
+ - public
+ only:
+ - master
\ No newline at end of file
diff --git a/README.md b/README.md
index cbe90ca..ed8ca05 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,6 @@
setups SSH quickly and in a painless manner
> Attention: This is still alpha, so some things won't work, not all things are inplemented.
-I (Phil from Lossless) expect this to be ready 2016/05/01.
## Usage
diff --git a/dist/index.d.ts b/dist/index.d.ts
new file mode 100644
index 0000000..e5b1fa1
--- /dev/null
+++ b/dist/index.d.ts
@@ -0,0 +1,5 @@
+import "typings-global";
+export { Ssh } from "./smartssh.classes.ssh";
+export { SshKey } from "./smartssh.classes.sshkey";
+export { SshDir } from "./smartssh.classes.sshdir";
+export { SshConfig } from "./smartssh.classes.sshconfig";
diff --git a/dist/index.js b/dist/index.js
index 348fb0e..16172fb 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1,3 +1,12 @@
"use strict";
+require("typings-global");
+var smartssh_classes_ssh_1 = require("./smartssh.classes.ssh");
+exports.Ssh = smartssh_classes_ssh_1.Ssh;
+var smartssh_classes_sshkey_1 = require("./smartssh.classes.sshkey");
+exports.SshKey = smartssh_classes_sshkey_1.SshKey;
+var smartssh_classes_sshdir_1 = require("./smartssh.classes.sshdir");
+exports.SshDir = smartssh_classes_sshdir_1.SshDir;
+var smartssh_classes_sshconfig_1 = require("./smartssh.classes.sshconfig");
+exports.SshConfig = smartssh_classes_sshconfig_1.SshConfig;
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
+//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUNQLENBQUMsQ0FEc0I7QUFHdkIscUNBQWtCLHdCQUF3QixDQUFDO0FBQW5DLHlDQUFtQztBQUMzQyx3Q0FBcUIsMkJBQTJCLENBQUM7QUFBekMsa0RBQXlDO0FBQ2pELHdDQUFxQiwyQkFBMkIsQ0FBQztBQUF6QyxrREFBeUM7QUFDakQsMkNBQXdCLDhCQUE4QixDQUFDO0FBQS9DLDJEQUErQyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCJcclxuaW1wb3J0ICogYXMgcGx1Z2lucyBmcm9tIFwiLi9zbWFydHNzaC5wbHVnaW5zXCI7XHJcblxyXG5leHBvcnQge1NzaH0gZnJvbSBcIi4vc21hcnRzc2guY2xhc3Nlcy5zc2hcIjtcclxuZXhwb3J0IHtTc2hLZXl9IGZyb20gXCIuL3NtYXJ0c3NoLmNsYXNzZXMuc3Noa2V5XCI7XHJcbmV4cG9ydCB7U3NoRGlyfSBmcm9tIFwiLi9zbWFydHNzaC5jbGFzc2VzLnNzaGRpclwiO1xyXG5leHBvcnQge1NzaENvbmZpZ30gZnJvbSBcIi4vc21hcnRzc2guY2xhc3Nlcy5zc2hjb25maWdcIjsiXX0=
diff --git a/dist/smartssh.classes.helpers.d.ts b/dist/smartssh.classes.helpers.d.ts
new file mode 100644
index 0000000..b31a82d
--- /dev/null
+++ b/dist/smartssh.classes.helpers.d.ts
@@ -0,0 +1,4 @@
+import "typings-global";
+import { SshKey } from "./smartssh.classes.sshkey";
+export declare let sshKeyArrayFromDir: (dirArg: string) => SshKey[];
+export declare let getKeyIndex: (hostArg: string) => number;
diff --git a/dist/smartssh.classes.helpers.js b/dist/smartssh.classes.helpers.js
index 4b82e9e..a188046 100644
--- a/dist/smartssh.classes.helpers.js
+++ b/dist/smartssh.classes.helpers.js
@@ -1,4 +1,5 @@
"use strict";
+require("typings-global");
exports.sshKeyArrayFromDir = function (dirArg) {
var sshKeyArray = []; //TODO
return sshKeyArray;
@@ -7,4 +8,4 @@ exports.getKeyIndex = function (hostArg) {
return 0; //TODO
};
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLmNsYXNzZXMuaGVscGVycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBSVcsMEJBQWtCLEdBQUcsVUFBUyxNQUFhO0lBQ2xELElBQUksV0FBVyxHQUFHLEVBQUUsQ0FBQyxDQUFDLE1BQU07SUFDNUIsTUFBTSxDQUFDLFdBQVcsQ0FBQztBQUN2QixDQUFDLENBQUE7QUFFVSxtQkFBVyxHQUFHLFVBQVMsT0FBYztJQUM1QyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUMsT0FBTztBQUNyQixDQUFDLENBQUEiLCJmaWxlIjoic21hcnRzc2guY2xhc3Nlcy5oZWxwZXJzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9tYWluLmQudHNcIiAvPlxuaW1wb3J0IHBsdWdpbnMgPSByZXF1aXJlKFwiLi9zbWFydHNzaC5wbHVnaW5zXCIpO1xuaW1wb3J0IGNsYXNzZXMgPSByZXF1aXJlKFwiLi9zbW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pciA9IGZ1bmN0aW9uKGRpckFyZzpzdHJpbmcpOlNzaEtleVtde1xyXG4gICAgbGV0IHNzaEtleUFycmF5ID0gW107IC8vVE9ET1xyXG4gICAgcmV0dXJuIHNzaEtleUFycmF5O1xyXG59XHJcblxyXG5leHBvcnQgbGV0IGdldEtleUluZGV4ID0gZnVuY3Rpb24oaG9zdEFyZzpzdHJpbmcpe1xyXG4gICAgcmV0dXJuIDA7IC8vVE9ETyBcclxufSJdfQ==
diff --git a/dist/smartssh.classes.js b/dist/smartssh.classes.js
deleted file mode 100644
index 165896b..0000000
--- a/dist/smartssh.classes.js
+++ /dev/null
@@ -1,163 +0,0 @@
-"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 = new sshDir(optionsArg.sshDir);
- this.sshKeys = this.sshDir.getKeys();
- this.sshSync = optionsArg.sshSync;
- }
- ;
- ssh.prototype.addKey = function (sshKeyArg) {
- this.sshKeys.push(sshKeyArg);
- this.sync();
- };
- ;
- ssh.prototype.getKey = function (hostArg) {
- var filteredArray = this.sshKeys.filter(function (keyArg) {
- return (keyArg.host == hostArg);
- });
- if (filteredArray.length > 0) {
- return filteredArray[0];
- }
- else {
- return undefined;
- }
- };
- ;
- ssh.prototype.removeKey = function (sshKeyArg) {
- var keyIndex = helpers.getKeyIndex(sshKeyArg.host);
- this.sshKeys.splice(keyIndex, 1);
- this.sync();
- };
- ;
- ssh.prototype.replaceKey = function (sshKeyOldArg, sshKeyNewArg) {
- var keyIndex = helpers.getKeyIndex(sshKeyOldArg.host);
- this.sshKeys.splice(keyIndex, 1, sshKeyNewArg);
- this.sync();
- };
- ;
- ssh.prototype.sync = function () {
- if (this.sshSync) {
- this.sshDir.sync(this.sshConfig, this.sshKeys); // call sync method of sshDir class;
- }
- };
- ;
- return ssh;
-}());
-exports.ssh = ssh;
-var sshDir = (function () {
- function sshDir(sshDirPathArg) {
- this.path = sshDirPathArg;
- }
- sshDir.prototype.sync = function (sshConfigArg, sshKeysArg) {
- };
- ;
- sshDir.prototype.getKeys = function () {
- return helpers.sshKeyArrayFromDir(this.path);
- };
- return sshDir;
-}());
-var sshConfig = (function () {
- function sshConfig() {
- }
- return sshConfig;
-}());
-exports.sshConfig = sshConfig;
-var sshKey = (function () {
- function sshKey(optionsArg) {
- if (optionsArg === void 0) { optionsArg = {}; }
- this.privKey = optionsArg.private;
- this.pubKey = optionsArg.public;
- this.hostVar = optionsArg.host;
- }
- ;
- Object.defineProperty(sshKey.prototype, "host", {
- // getters
- get: function () {
- return this.hostVar;
- },
- // setters
- set: function (hostArg) {
- this.hostVar = hostArg;
- },
- enumerable: true,
- configurable: true
- });
- ;
- Object.defineProperty(sshKey.prototype, "privateKey", {
- get: function () {
- return this.privKey;
- },
- 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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLmNsYXNzZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDRDQUE0QztBQUM1QyxJQUFPLE9BQU8sV0FBVyxvQkFBb0IsQ0FBQyxDQUFDO0FBQy9DLElBQU8sT0FBTyxXQUFXLDRCQUE0QixDQUFDLENBQUM7QUFFdkQ7SUFLSSxhQUFZLFVBQStDO1FBQS9DLDBCQUErQyxHQUEvQyxlQUErQztRQUN2RCxJQUFJLENBQUMsTUFBTSxHQUFHLElBQUksTUFBTSxDQUFDLFVBQVUsQ0FBQyxNQUFNLENBQUMsQ0FBQztRQUM1QyxJQUFJLENBQUMsT0FBTyxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUMsT0FBTyxFQUFFLENBQUM7UUFDckMsSUFBSSxDQUFDLE9BQU8sR0FBRyxVQUFVLENBQUMsT0FBTyxDQUFDO0lBQ3RDLENBQUM7O0lBQ0Qsb0JBQU0sR0FBTixVQUFPLFNBQWdCO1FBQ25CLElBQUksQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFDO1FBQzdCLElBQUksQ0FBQyxJQUFJLEVBQUUsQ0FBQztJQUNoQixDQUFDOztJQUNELG9CQUFNLEdBQU4sVUFBTyxPQUFjO1FBQ2pCLElBQUksYUFBYSxHQUFHLElBQUksQ0FBQyxPQUFPLENBQUMsTUFBTSxDQUFDL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5mcy5lbnN1cmVEaXJTeW5jKGZpbGVQYXRoT2JqLmRpcik7XG4gICAgICAgICAgICB0aGlzLnN0b3JlKHBsdWdpbnMucGF0aC5qb2luKGZpbGVQYXRoT2JqLmRpcixcImtleS5wcml2XCIpKTsgLy8gY2FsbCB0aGlzIGZ1bmN0aW9uIHJlY3Vyc2l2bHlcbiAgICAgICAgICAgIHRoaXMuc3RvcmUocGx1Z2lucy5wYXRoLmpvaW4oZmlsZVBhdGhPYmouZGlyLFwia2V5LnByaXZcIikpOyAvLyBjYWxsIHRoaXMgZnVuY3Rpb24gcmVjdXJzaXZseVxuICAgICAgICB9XG4gICAgfVxufSJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
diff --git a/dist/smartssh.classes.ssh.d.ts b/dist/smartssh.classes.ssh.d.ts
new file mode 100644
index 0000000..0d58027
--- /dev/null
+++ b/dist/smartssh.classes.ssh.d.ts
@@ -0,0 +1,17 @@
+import "typings-global";
+import { SshKey } from "./smartssh.classes.sshkey";
+export declare class Ssh {
+ private sshConfig;
+ private sshDir;
+ private sshKeys;
+ private sshSync;
+ constructor(optionsArg?: {
+ sshDir?: string;
+ sshSync?: boolean;
+ });
+ addKey(sshKeyArg: SshKey): void;
+ getKey(hostArg: string): SshKey;
+ removeKey(sshKeyArg: SshKey): void;
+ replaceKey(sshKeyOldArg: SshKey, sshKeyNewArg: SshKey): void;
+ sync(): void;
+}
diff --git a/dist/smartssh.classes.ssh.js b/dist/smartssh.classes.ssh.js
new file mode 100644
index 0000000..daaf01a
--- /dev/null
+++ b/dist/smartssh.classes.ssh.js
@@ -0,0 +1,52 @@
+"use strict";
+require("typings-global");
+var helpers = require("./smartssh.classes.helpers");
+var smartssh_classes_sshdir_1 = require("./smartssh.classes.sshdir");
+var Ssh = (function () {
+ function Ssh(optionsArg) {
+ if (optionsArg === void 0) { optionsArg = {}; }
+ this.sshDir = new smartssh_classes_sshdir_1.SshDir(optionsArg.sshDir);
+ this.sshKeys = this.sshDir.getKeys();
+ this.sshSync = optionsArg.sshSync;
+ }
+ ;
+ Ssh.prototype.addKey = function (sshKeyArg) {
+ this.sshKeys.push(sshKeyArg);
+ this.sync();
+ };
+ ;
+ Ssh.prototype.getKey = function (hostArg) {
+ var filteredArray = this.sshKeys.filter(function (keyArg) {
+ return (keyArg.host == hostArg);
+ });
+ if (filteredArray.length > 0) {
+ return filteredArray[0];
+ }
+ else {
+ return undefined;
+ }
+ };
+ ;
+ Ssh.prototype.removeKey = function (sshKeyArg) {
+ var keyIndex = helpers.getKeyIndex(sshKeyArg.host);
+ this.sshKeys.splice(keyIndex, 1);
+ this.sync();
+ };
+ ;
+ Ssh.prototype.replaceKey = function (sshKeyOldArg, sshKeyNewArg) {
+ var keyIndex = helpers.getKeyIndex(sshKeyOldArg.host);
+ this.sshKeys.splice(keyIndex, 1, sshKeyNewArg);
+ this.sync();
+ };
+ ;
+ Ssh.prototype.sync = function () {
+ if (this.sshSync) {
+ this.sshDir.sync(this.sshConfig, this.sshKeys); // call sync method of sshDir class;
+ }
+ };
+ ;
+ return Ssh;
+}());
+exports.Ssh = Ssh;
+
+//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLmNsYXNzZXMuc3NoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUNQLENBQUMsQ0FEc0I7QUFFdkIsSUFBWSxPQUFPLFdBQU0sNEJBQTRCLENBQUMsQ0FBQTtBQUV0RCx3Q0FBcUIsMkJBQTJCLENBQUMsQ0FBQTtBQUlqRDtJQUtJLGFBQVksVUFBK0M7UUFBL0MsMEJBQStDLEdBQS9DLGVBQStDO1FBQ3ZELElBQUksQ0FBQyxNQUFNLEdBQUcsSUFBSSxnQ0FBTSxDQUFDLFVBQVUsQ0FBQyxNQUFNLENBQUMsQ0FBQztRQUM1QyxJQUFJLENBQUMsT0FBTyxHQUFHLElBQUksQ0FB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AgICAgaWYoZmlsdGVyZWRBcnJheS5sZW5ndGggPiAwKXtcclxuICAgICAgICAgICAgcmV0dXJuIGZpbHRlcmVkQXJyYXlbMF07XHJcbiAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcclxuICAgICAgICB9XHJcbiAgICB9O1xyXG4gICAgcmVtb3ZlS2V5KHNzaEtleUFyZzpTc2hLZXkpe1xyXG4gICAgICAgIGxldCBrZXlJbmRleCA9IGhlbHBlcnMuZ2V0S2V5SW5kZXgoc3NoS2V5QXJnLmhvc3QpO1xyXG4gICAgICAgIHRoaXMuc3NoS2V5cy5zcGxpY2Uoa2V5SW5kZXgsMSk7XHJcbiAgICAgICAgdGhpcy5zeW5jKCk7XHJcbiAgICB9O1xyXG4gICAgcmVwbGFjZUtleShzc2hLZXlPbGRBcmc6U3NoS2V5LHNzaEtleU5ld0FyZzpTc2hLZXkpe1xyXG4gICAgICAgIGxldCBrZXlJbmRleCA9IGhlbHBlcnMuZ2V0S2V5SW5kZXgoc3NoS2V5T2xkQXJnLmhvc3QpO1xyXG4gICAgICAgIHRoaXMuc3NoS2V5cy5zcGxpY2Uoa2V5SW5kZXgsMSxzc2hLZXlOZXdBcmcpO1xyXG4gICAgICAgIHRoaXMuc3luYygpO1xyXG4gICAgfTtcclxuICAgIHN5bmMoKXtcclxuICAgICAgICBpZih0aGlzLnNzaFN5bmMpe1xyXG4gICAgICAgICAgICB0aGlzLnNzaERpci5zeW5jKHRoaXMuc3NoQ29uZmlnLHRoaXMuc3NoS2V5cyk7IC8vIGNhbGwgc3luYyBtZXRob2Qgb2Ygc3NoRGlyIGNsYXNzO1xyXG4gICAgICAgIH1cclxuICAgIH07XHJcbn1cclxuXHJcblxyXG4iXX0=
diff --git a/dist/smartssh.classes.sshconfig.d.ts b/dist/smartssh.classes.sshconfig.d.ts
new file mode 100644
index 0000000..efe15e0
--- /dev/null
+++ b/dist/smartssh.classes.sshconfig.d.ts
@@ -0,0 +1,4 @@
+import "typings-global";
+export declare class SshConfig {
+ constructor();
+}
diff --git a/dist/smartssh.classes.sshconfig.js b/dist/smartssh.classes.sshconfig.js
new file mode 100644
index 0000000..d173182
--- /dev/null
+++ b/dist/smartssh.classes.sshconfig.js
@@ -0,0 +1,10 @@
+"use strict";
+require("typings-global");
+var SshConfig = (function () {
+ function SshConfig() {
+ }
+ return SshConfig;
+}());
+exports.SshConfig = SshConfig;
+
+//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLmNsYXNzZXMuc3NoY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFHeEI7SUFDSTtJQUVBLENBQUM7SUFDTCxnQkFBQztBQUFELENBSkEsQUFJQyxJQUFBO0FBSlksaUJBQVMsWUFJckIsQ0FBQSIsImZpbGUiOiJzbWFydHNzaC5jbGFzc2VzLnNzaGNvbmZpZy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XHJcbmltcG9ydCAqIGFzIHBsdWdpbnMgZnJvbSBcIi4vc21hcnRzc2gucGx1Z2luc1wiO1xyXG5pbXBvcnQgKiBhcyBoZWxwZXJzIGZyb20gXCIuL3NtYXJ0c3NoLmNsYXNzZXMuaGVscGVyc1wiO1xyXG5leHBvcnQgY2xhc3MgU3NoQ29uZmlnIHtcclxuICAgIGNvbnN0cnVjdG9yKCl7XHJcbiAgICAgICAgXHJcbiAgICB9XHJcbn0iXX0=
diff --git a/dist/smartssh.classes.sshdir.d.ts b/dist/smartssh.classes.sshdir.d.ts
new file mode 100644
index 0000000..16ac4af
--- /dev/null
+++ b/dist/smartssh.classes.sshdir.d.ts
@@ -0,0 +1,9 @@
+import "typings-global";
+import { SshKey } from "./smartssh.classes.sshkey";
+import { SshConfig } from "./smartssh.classes.sshconfig";
+export declare class SshDir {
+ path: string;
+ constructor(sshDirPathArg: string);
+ sync(sshConfigArg: SshConfig, sshKeysArg: SshKey[]): void;
+ getKeys(): SshKey[];
+}
diff --git a/dist/smartssh.classes.sshdir.js b/dist/smartssh.classes.sshdir.js
new file mode 100644
index 0000000..831feed
--- /dev/null
+++ b/dist/smartssh.classes.sshdir.js
@@ -0,0 +1,18 @@
+"use strict";
+require("typings-global");
+var helpers = require("./smartssh.classes.helpers");
+var SshDir = (function () {
+ function SshDir(sshDirPathArg) {
+ this.path = sshDirPathArg;
+ }
+ SshDir.prototype.sync = function (sshConfigArg, sshKeysArg) {
+ };
+ ;
+ SshDir.prototype.getKeys = function () {
+ return helpers.sshKeyArrayFromDir(this.path);
+ };
+ return SshDir;
+}());
+exports.SshDir = SshDir;
+
+//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLmNsYXNzZXMuc3NoZGlyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFFeEIsSUFBWSxPQUFPLFdBQU0sNEJBQTRCLENBQUMsQ0FBQTtBQUd0RDtJQUVJLGdCQUFZLGFBQW9CO1FBQzVCLElBQUksQ0FBQyxJQUFJLEdBQUcsYUFBYSxDQUFDO0lBQzlCLENBQUM7SUFDRCxxQkFBSSxHQUFKLFVBQUssWUFBc0IsRUFBQyxVQUFtQjtJQUUvQyxDQUFDOztJQUNELHdCQUFPLEdBQVA7UUFDSSxNQUFNLENBQUMsT0FBTyxDQUFDLGtCQUFrQixDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUNqRCxDQUFDO0lBQ0wsYUFBQztBQUFELENBWEEsQUFXQyxJQUFBO0FBWFksY0FBTSxTQVdsQixDQUFBIiwiZmlsZSI6InNtYXJ0c3NoLmNsYXNzZXMuc3NoZGlyLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIjtcclxuaW1wb3J0ICogYXMgcGx1Z2lucyBmcm9tIFwiLi9zbWFydHNzaC5wbHVnaW5zXCI7XHJcbmltcG9ydCAqIGFzIGhlbHBlcnMgZnJvbSBcIi4vc21hcnRzc2guY2xhc3Nlcy5oZWxwZXJzXCI7XHJcbmltcG9ydCB7U3NoS2V5fSBmcm9tIFwiLi9zbWFydHNzaC5jbGFzc2VzLnNzaGtleVwiO1xyXG5pbXBvcnQge1NzaENvbmZpZ30gZnJvbSBcIi4vc21hcnRzc2guY2xhc3Nlcy5zc2hjb25maWdcIjtcclxuZXhwb3J0IGNsYXNzIFNzaERpciB7IC8vIHNzaERpciBjbGFzcyAtPiBOT1QgRVhQT1JURUQsIE9OTFkgRk9SIElOVEVSTkFMIFVTRVxyXG4gICAgcGF0aDpzdHJpbmc7XHJcbiAgICBjb25zdHJ1Y3Rvcihzc2hEaXJQYXRoQXJnOnN0cmluZyl7XHJcbiAgICAgICAgdGhpcy5wYXRoID0gc3NoRGlyUGF0aEFyZztcclxuICAgIH1cclxuICAgIHN5bmMoc3NoQ29uZmlnQXJnOlNzaENvbmZpZyxzc2hLZXlzQXJnOlNzaEtleVtdKXtcclxuICAgICAgICBcclxuICAgIH07XHJcbiAgICBnZXRLZXlzKCl7XHJcbiAgICAgICAgcmV0dXJuIGhlbHBlcnMuc3NoS2V5QXJyYXlGcm9tRGlyKHRoaXMucGF0aCk7XHJcbiAgICB9XHJcbn0iXX0=
diff --git a/dist/smartssh.classes.sshkey.d.ts b/dist/smartssh.classes.sshkey.d.ts
new file mode 100644
index 0000000..c98ff79
--- /dev/null
+++ b/dist/smartssh.classes.sshkey.d.ts
@@ -0,0 +1,18 @@
+import "typings-global";
+export declare class SshKey {
+ private privKey;
+ private pubKey;
+ private hostVar;
+ constructor(optionsArg?: {
+ private?: string;
+ public?: string;
+ host?: string;
+ });
+ host: string;
+ privateKey: string;
+ privateKeyBase64: any;
+ publicKey: string;
+ publicKeyBase64: any;
+ type: string;
+ store(filePathArg?: string): void;
+}
diff --git a/dist/smartssh.classes.sshkey.js b/dist/smartssh.classes.sshkey.js
new file mode 100644
index 0000000..ca0ec2b
--- /dev/null
+++ b/dist/smartssh.classes.sshkey.js
@@ -0,0 +1,98 @@
+"use strict";
+require("typings-global");
+var plugins = require("./smartssh.plugins");
+var SshKey = (function () {
+ function SshKey(optionsArg) {
+ if (optionsArg === void 0) { optionsArg = {}; }
+ this.privKey = optionsArg.private;
+ this.pubKey = optionsArg.public;
+ this.hostVar = optionsArg.host;
+ }
+ ;
+ Object.defineProperty(SshKey.prototype, "host", {
+ // getters
+ get: function () {
+ return this.hostVar;
+ },
+ // setters
+ set: function (hostArg) {
+ this.hostVar = hostArg;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ ;
+ Object.defineProperty(SshKey.prototype, "privateKey", {
+ get: function () {
+ return this.privKey;
+ },
+ 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;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLmNsYXNzZXMuc3Noa2V5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDeEIsSUFBWSxPQUFPLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUc5QztJQUlJLGdCQUFZLFVBQTJEO1FBQTNELDBCQUEyRCxHQUEzRCxlQUEyRDtRQUNuRSxJQUFJLENBQUMsT0FBTyxHQUFHLFVBQVUsQ0FBQyxPQUFPLENBQUM7UUFDbEMsSUFBSSxDQUFDLE1BQU0sR0FBRyxVQUFVLENBQUMsTUFBTSxDQUFDO1FBQ2hDLElBQUksQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDLElBQUksQ0FBQztJQUNuQyxDQUFDOztJQUdELHNCQUFJLHdCQUFJO1FBRFIsVUFBVTthQUNWO1lBQ0ksTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7UUFDeEIsQ0FBQztRQXVCRCxVQUFVO2FBQ1YsVUFBUyxPQUFjO1lBQ25CLElBQUksQ0FBQyxPQUFPLEdBQUcsT0FBTyxDQUFDO1FBQzNCLENBQUM7OztPQTFCQTs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xuICAgIGdldCBob3N0KCl7XHJcbiAgICAgICAgcmV0dXJuIHRoaXMuaG9zdFZhcjtcclxuICAgIH07XHJcbiAgICBnZXQgcHJpdmF0ZUtleSgpe1xyXG4gICAgICAgIHJldHVybiB0aGlzLnByaXZLZXk7XHJcbiAgICB9O1xyXG4gICAgZ2V0IHByaXZhdGVLZXlCYXNlNjQoKXtcclxuICAgICAgICByZXR1cm4gcGx1Z2lucy5iYXNlNjQuZW5jb2RlKHRoaXMucHJpdktleSk7XHJcbiAgICB9XHJcbiAgICBnZXQgcHVibGljS2V5KCl7XHJcbiAgICAgICAgcmV0dXJuIHRoaXMucHVibGljS2V5O1xyXG4gICAgfVxyXG4gICAgZ2V0IHB1YmxpY0tleUJhc2U2NCgpe1xyXG4gICAgICAgIHJldHVybiBwbHVnaW5zLmJhc2U2NC5lbmNvZGUodGhpcy5wdWJLZXkpO1xyXG4gICAgfVxyXG4gICAgZ2V0IHR5cGUoKXtcclxuICAgICAgICBpZih0aGlzLnByaXZLZXkgJiYgdGhpcy5wdWJLZXkpe1xyXG4gICAgICAgICAgICByZXR1cm4gXCJkdXBsZXhcIjtcclxuICAgICAgICB9IGVsc2UgaWYodGhpcy5wcml2S2V5KXtcclxuICAgICAgICAgICAgcmV0dXJuIFwicHJpdmF0ZVwiO1xyXG4gICAgICAgIH0gZWxzZSBpZih0aGlzLnB1YktleSl7XHJcbiAgICAgICAgICAgIHJldHVybiBcInB1YmxpY1wiO1xyXG4gICAgICAgIH1cclxuICAgIH07XHJcbiAgICBcclxuICAgIC8vIHNldHRlcnNcclxuICAgIHNldCBob3N0KGhvc3RBcmc6c3RyaW5nKXtcclxuICAgICAgICB0aGlzLmhvc3RWYXIgPSBob3N0QXJnO1xyXG4gICAgfTtcclxuICAgIHNldCBwcml2YXRlS2V5KHByaXZhdGVLZXlBcmc6c3RyaW5nKXtcclxuICAgICAgICB0aGlzLnByaXZLZXkgPSBwcml2YXRlS2V5QXJnO1xyXG4gICAgfTtcclxuICAgI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RoaXMgZnVuY3Rpb24gcmVjdXJzaXZseVxyXG4gICAgICAgICAgICB0aGlzLnN0b3JlKHBsdWdpbnMucGF0aC5qb2luKGZpbGVQYXRoT2JqLmRpcixcImtleS5wcml2XCIpKTsgLy8gY2FsbCB0aGlzIGZ1bmN0aW9uIHJlY3Vyc2l2bHlcclxuICAgICAgICB9XHJcbiAgICB9XHJcbn0iXX0=
diff --git a/dist/smartssh.plugins.d.ts b/dist/smartssh.plugins.d.ts
new file mode 100644
index 0000000..8e8e48f
--- /dev/null
+++ b/dist/smartssh.plugins.d.ts
@@ -0,0 +1,6 @@
+import "typings-global";
+export declare let beautylog: any;
+export declare let base64: any;
+export declare let fs: any;
+export declare let path: any;
+export declare let smartfile: any;
diff --git a/dist/smartssh.plugins.js b/dist/smartssh.plugins.js
index bb53b1f..f9d6e00 100644
--- a/dist/smartssh.plugins.js
+++ b/dist/smartssh.plugins.js
@@ -1,9 +1,9 @@
"use strict";
-///
+require("typings-global");
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDRDQUE0QztBQUNqQyxpQkFBUyxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQztBQUNqQyxjQUFNLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDLE1BQU0sQ0FBQztBQUNyQyxVQUFFLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO0FBQ3pCLFlBQUksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUM7QUFDdkIsaUJBQVMsR0FBRyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUMiLCJmaWxlIjoic21hcnRzc2gucGx1Z2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V4cG9ydCBsZXQgYmFzZTY0ID0gcmVxdWlyZShcImpzLWJhc2U2NFwiKS5CYXNlNjQ7XHJcbmV4cG9ydCBsZXQgZnMgPSByZXF1aXJlKFwiZnMtZXh0cmFcIik7XHJcbmV4cG9ydCBsZXQgcGF0aCA9IHJlcXVpcmUoXCJwYXRoXCIpO1xyXG5leHBvcnQgbGV0IHNtYXJ0ZmlsZSA9IHJlcXVpcmUoXCJzbWFydGZpbGVcIik7Il19
diff --git a/npmts.json b/npmts.json
new file mode 100644
index 0000000..e1e7dec
--- /dev/null
+++ b/npmts.json
@@ -0,0 +1,4 @@
+{
+ "mode":"default",
+ "coverageTreshold":50
+}
\ No newline at end of file
diff --git a/test/test.d.ts b/test/test.d.ts
new file mode 100644
index 0000000..e7cc8ee
--- /dev/null
+++ b/test/test.d.ts
@@ -0,0 +1 @@
+import "typings-test";
diff --git a/test/test.js b/test/test.js
index 6e2a415..1107edb 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1,5 +1,6 @@
-///
+"use strict";
+require("typings-test");
var should = require("should");
var smartssh = require("../dist/index.js");
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztBQUMvQixJQUFJLFFBQVEsR0FBRyxPQUFPLENBQUMsa0JBQWtCLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4uL3RzL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbmxldCBzaG91bGQgPSByZXF1aXJlKFwic2hvdWxkXCIpO1xubGV0IHNtYXJ0c3NoID0gcmVxdWlyZShcIi4uL2Rpc3QvaW5kZXguanNcIik7XG4iXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
+//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FDUCxDQUFDLENBRG9CO0FBQ3JCLElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztBQUMvQixJQUFJLFFBQVEsR0FBRyxPQUFPLENBQUMsa0JBQWtCLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy10ZXN0XCJcclxubGV0IHNob3VsZCA9IHJlcXVpcmUoXCJzaG91bGRcIik7XHJcbmxldCBzbWFydHNzaCA9IHJlcXVpcmUoXCIuLi9kaXN0L2luZGV4LmpzXCIpO1xyXG4iXX0=
diff --git a/ts/index.ts b/ts/index.ts
index 3228763..7ae3ffd 100644
--- a/ts/index.ts
+++ b/ts/index.ts
@@ -1,3 +1,7 @@
import "typings-global"
import * as plugins from "./smartssh.plugins";
-import {} from "./smartssh.classes.ssh";
\ No newline at end of file
+
+export {Ssh} from "./smartssh.classes.ssh";
+export {SshKey} from "./smartssh.classes.sshkey";
+export {SshDir} from "./smartssh.classes.sshdir";
+export {SshConfig} from "./smartssh.classes.sshconfig";
\ No newline at end of file
diff --git a/ts/smartssh.classes.helpers.ts b/ts/smartssh.classes.helpers.ts
index a88b78b..9e33220 100644
--- a/ts/smartssh.classes.helpers.ts
+++ b/ts/smartssh.classes.helpers.ts
@@ -1,8 +1,8 @@
import "typings-global"
-import plugins = require("./smartssh.plugins");
-import classes = require("./smartssh.classes");
+import * as plugins from "./smartssh.plugins";
+import {SshKey} from "./smartssh.classes.sshkey";
-export let sshKeyArrayFromDir = function(dirArg:string):classes.sshKey[]{
+export let sshKeyArrayFromDir = function(dirArg:string):SshKey[]{
let sshKeyArray = []; //TODO
return sshKeyArray;
}
diff --git a/ts/smartssh.classes.ssh.ts b/ts/smartssh.classes.ssh.ts
index 8a070c8..a5323b5 100644
--- a/ts/smartssh.classes.ssh.ts
+++ b/ts/smartssh.classes.ssh.ts
@@ -2,19 +2,21 @@ import "typings-global"
import * as plugins from "./smartssh.plugins";
import * as helpers from "./smartssh.classes.helpers";
-import {sshDir} from "./smartssh.classes.sshdir";
+import {SshDir} from "./smartssh.classes.sshdir";
+import {SshConfig} from "./smartssh.classes.sshconfig";
+import {SshKey} from "./smartssh.classes.sshkey";
-export class ssh {
- private sshConfig:sshConfig; // points to sshConfig class instance
- private sshDir:sshDir; // points to sshDir class instance.
- private sshKeys:sshKey[]; //holds all ssh keys
+export class Ssh {
+ private sshConfig:SshConfig; // points to sshConfig class instance
+ private sshDir:SshDir; // points to sshDir class instance.
+ private sshKeys:SshKey[]; //holds all ssh keys
private sshSync:boolean; // if set to true, the ssh dir will be kept in sync automatically
constructor(optionsArg:{sshDir?:string,sshSync?:boolean}={}){
- this.sshDir = new sshDir(optionsArg.sshDir);
+ this.sshDir = new SshDir(optionsArg.sshDir);
this.sshKeys = this.sshDir.getKeys();
this.sshSync = optionsArg.sshSync;
};
- addKey(sshKeyArg:sshKey){
+ addKey(sshKeyArg:SshKey){
this.sshKeys.push(sshKeyArg);
this.sync();
};
@@ -28,12 +30,12 @@ export class ssh {
return undefined;
}
};
- removeKey(sshKeyArg:sshKey){
+ removeKey(sshKeyArg:SshKey){
let keyIndex = helpers.getKeyIndex(sshKeyArg.host);
this.sshKeys.splice(keyIndex,1);
this.sync();
};
- replaceKey(sshKeyOldArg:sshKey,sshKeyNewArg:sshKey){
+ replaceKey(sshKeyOldArg:SshKey,sshKeyNewArg:SshKey){
let keyIndex = helpers.getKeyIndex(sshKeyOldArg.host);
this.sshKeys.splice(keyIndex,1,sshKeyNewArg);
this.sync();
diff --git a/ts/smartssh.classes.sshconfig.ts b/ts/smartssh.classes.sshconfig.ts
index 4b1ea99..6bff9ce 100644
--- a/ts/smartssh.classes.sshconfig.ts
+++ b/ts/smartssh.classes.sshconfig.ts
@@ -1,7 +1,7 @@
import "typings-global";
import * as plugins from "./smartssh.plugins";
import * as helpers from "./smartssh.classes.helpers";
-export class sshConfig {
+export class SshConfig {
constructor(){
}
diff --git a/ts/smartssh.classes.sshdir.ts b/ts/smartssh.classes.sshdir.ts
index 74d1e79..7172f9f 100644
--- a/ts/smartssh.classes.sshdir.ts
+++ b/ts/smartssh.classes.sshdir.ts
@@ -1,13 +1,14 @@
import "typings-global";
import * as plugins from "./smartssh.plugins";
import * as helpers from "./smartssh.classes.helpers";
-import {sshKey} from "./smartssh.classes.sshkey";
-export class sshDir { // sshDir class -> NOT EXPORTED, ONLY FOR INTERNAL USE
+import {SshKey} from "./smartssh.classes.sshkey";
+import {SshConfig} from "./smartssh.classes.sshconfig";
+export class SshDir { // sshDir class -> NOT EXPORTED, ONLY FOR INTERNAL USE
path:string;
constructor(sshDirPathArg:string){
this.path = sshDirPathArg;
}
- sync(sshConfigArg:sshConfig,sshKeysArg:sshKey[]){
+ sync(sshConfigArg:SshConfig,sshKeysArg:SshKey[]){
};
getKeys(){
diff --git a/ts/smartssh.classes.sshkey.ts b/ts/smartssh.classes.sshkey.ts
index 123b35a..9754c27 100644
--- a/ts/smartssh.classes.sshkey.ts
+++ b/ts/smartssh.classes.sshkey.ts
@@ -2,7 +2,7 @@ import "typings-global";
import * as plugins from "./smartssh.plugins";
import * as helpers from "./smartssh.classes.helpers";
-export class sshKey {
+export class SshKey {
private privKey:string;
private pubKey:string;
private hostVar:string;