16 Commits

Author SHA1 Message Date
5091625953 1.1.5 2016-06-26 16:16:28 +02:00
f74b3a51b0 now creating config as standard 2016-06-26 16:16:12 +02:00
062f3ad060 1.1.4 2016-06-26 04:23:48 +02:00
ecd0fd8fad now setting rights for stored keys 2016-06-26 04:23:45 +02:00
742bf694e4 1.1.3 2016-06-26 04:07:37 +02:00
38165f11db some updates 2016-06-26 04:07:03 +02:00
ef2b31b4b2 1.1.2 2016-06-25 15:31:03 +02:00
5b1f800067 update structure 2016-06-25 15:30:57 +02:00
6339a3ed9b update SshKey.store() 2016-06-25 14:13:26 +02:00
bf27aaf167 update structure 2016-06-25 13:07:24 +02:00
9bc3aea59c 1.1.1 2016-06-25 02:53:09 +02:00
f5ff302d4d updated structure of SshConfig 2016-06-25 02:53:05 +02:00
cac8203bf5 1.1.0 2016-06-25 02:29:51 +02:00
e4532271cc major structural update 2016-06-25 02:29:34 +02:00
faf6c91199 update 2016-06-25 02:10:53 +02:00
d0009e7a9c update stucture 2016-06-24 20:58:55 +02:00
22 changed files with 374 additions and 172 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ docs/
ts/typings/
ts/*.js
ts/*.js.map
test/temp/

5
Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM hosttoday/ht-docker-node:npmts
COPY ./ /node-app
WORKDIR /node-app
RUN npm install
RUN npmts

View File

@ -1,4 +1,16 @@
import "typings-global";
import { SshKey } from "./smartssh.classes.sshkey";
export declare class SshConfig {
constructor();
sshKeyArray: SshKey[];
constructor(sshKeyArrayArg: SshKey[]);
/**
* stores a config file
*/
store(dirPathArg: string): any;
read(dirPathArg: any): any;
}
export interface configObject {
configString: string;
authorized: boolean;
sshKey: SshKey;
}

View File

@ -1,10 +1,48 @@
"use strict";
require("typings-global");
var plugins = require("./smartssh.plugins");
var SshConfig = (function () {
function SshConfig() {
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLmNsYXNzZXMuc3NoY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFHeEI7SUFDSTtJQUVBLENBQUM7SUFDTCxnQkFBQztBQUFELENBSkEsQUFJQyxJQUFBO0FBSlksaUJBQVMsWUFJckIsQ0FBQSIsImZpbGUiOiJzbWFydHNzaC5jbGFzc2VzLnNzaGNvbmZpZy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XG5pbXBvcnQgKiBhcyBwbHVnaW5zIGZyb20gXCIuL3NtYXJ0c3NoLnBsdWdpbnNcIjtcbmltcG9ydCAqIGFzIGhlbHBlcnMgZnJvbSBcIi4vc21hcnRzc2guY2xhc3Nlcy5oZWxwZXJzXCI7XG5leHBvcnQgY2xhc3MgU3NoQ29uZmlnIHtcbiAgICBjb25zdHJ1Y3Rvcigpe1xuICAgICAgICBcbiAgICB9XG59Il19
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJza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FwiXFxuXCJcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbmZpZ0FycmF5LnB1c2goe1xuICAgICAgICAgICAgICAgIGNvbmZpZ1N0cmluZzpjb25maWdTdHJpbmcsXG4gICAgICAgICAgICAgICAgYXV0aG9yaXplZDogc3NoS2V5LmF1dGhvcml6ZWQsXG4gICAgICAgICAgICAgICAgc3NoS2V5OiBzc2hLZXlcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGxldCBjb25maWdGaWxlOnN0cmluZyA9IFwiXCI7XG4gICAgICAgIGZvcihsZXQga2V5IGluIGNvbmZpZ0FycmF5KXtcbiAgICAgICAgICAgIGNvbmZpZ0ZpbGUgPSBjb25maWdGaWxlICsgY29uZmlnQXJyYXlba2V5XS5jb25maWdTdHJpbmcgKyBcIlxcblwiO1xuICAgICAgICB9O1xuICAgICAgICBwbHVnaW5zLnNtYXJ0ZmlsZS5tZW1vcnkudG9Gc1N5bmMoY29uZmlnRmlsZSxwbHVnaW5zLnBhdGguam9pbihkaXJQYXRoQXJnLFwiY29uZmlnXCIpKTtcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcbiAgICB9XG4gICAgcmVhZChkaXJQYXRoQXJnKXtcbiAgICAgICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcbiAgICAgICAgbGV0IGNvbmZpZ0FycmF5OmNvbmZpZ09iamVjdFtdO1xuICAgICAgICBcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcbiAgICB9XG59O1xuXG5leHBvcnQgaW50ZXJmYWNlIGNvbmZpZ09iamVjdCB7XG4gICAgY29uZmlnU3RyaW5nOnN0cmluZztcbiAgICBhdXRob3JpemVkOmJvb2xlYW47XG4gICAgc3NoS2V5OlNzaEtleTtcbn07XG5cbiJdfQ==

View File

@ -1,11 +1,13 @@
import "typings-global";
import { SshInstance } from "./smartssh.classes.sshinstance";
import { SshKey } from "./smartssh.classes.sshkey";
import { SshConfig } from "./smartssh.classes.sshconfig";
export declare class SshDir {
path: string;
sshInstance: SshInstance;
constructor(sshInstanceArg: SshInstance, sshDirPathArg?: string);
private _path;
private _sshKeyArray;
private _sshConfig;
constructor(sshKeyArray: SshKey[], sshConfig: SshConfig, sshDirPathArg?: string);
writeToDir(): void;
readFromDir(): void;
updateDirPath(dirPathArg: string): void;
getKeys(): SshKey[];
}

View File

@ -3,26 +3,36 @@ require("typings-global");
var plugins = require("./smartssh.plugins");
var helpers = require("./smartssh.classes.helpers");
var SshDir = (function () {
function SshDir(sshInstanceArg, sshDirPathArg) {
var sshDirPath;
function SshDir(sshKeyArray, sshConfig, sshDirPathArg) {
this._sshKeyArray = sshKeyArray;
this._sshConfig = sshConfig;
if (sshDirPathArg) {
sshDirPath = sshDirPathArg;
this._path = sshDirPathArg;
}
else {
sshDirPath = plugins.smartpath.get.home();
this._path = plugins.path.join(plugins.smartpath.get.home(), ".ssh/");
}
this.path = sshDirPath;
;
}
SshDir.prototype.writeToDir = function () {
var _this = this;
this._sshKeyArray.forEach(function (sshKeyArg) {
sshKeyArg.store(_this._path);
});
this._sshConfig.store(this._path);
};
;
SshDir.prototype.readFromDir = function () {
};
SshDir.prototype.updateDirPath = function (dirPathArg) {
this._path = dirPathArg;
};
;
SshDir.prototype.getKeys = function () {
return helpers.sshKeyArrayFromDir(this.path);
return helpers.sshKeyArrayFromDir(this._path);
};
return SshDir;
}());
exports.SshDir = SshDir;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLmNsYXNzZXMuc3NoZGlyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDeEIsSUFBWSxPQUFPLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUM5QyxJQUFZLE9BQU8sV0FBTSw0QkFBNEIsQ0FBQyxDQUFBO0FBSX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mlnLHNzaERpclBhdGhBcmc/OnN0cmluZyl7XG4gICAgICAgIHRoaXMuX3NzaEtleUFycmF5ID0gc3NoS2V5QXJyYXk7XG4gICAgICAgIHRoaXMuX3NzaENvbmZpZyA9IHNzaENvbmZpZztcbiAgICAgICAgaWYoc3NoRGlyUGF0aEFyZyl7XG4gICAgICAgICAgICB0aGlzLl9wYXRoID0gc3NoRGlyUGF0aEFyZztcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMuX3BhdGggPSBwbHVnaW5zLnBhdGguam9pbihwbHVnaW5zLnNtYXJ0cGF0aC5nZXQuaG9tZSgpLFwiLnNzaC9cIik7XG4gICAgICAgIH07XG4gICAgfVxuICAgIHdyaXRlVG9EaXIoKXsgLy8gc3luY3Mgc3NoSW5zdGFuY2UgdG8gZGlyZWN0b3J5XG4gICAgICAgIHRoaXMuX3NzaEtleUFycmF5LmZvckVhY2goKHNzaEtleUFyZykgPT4ge1xuICAgICAgICAgICAgc3NoS2V5QXJnLnN0b3JlKHRoaXMuX3BhdGgpO1xuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5fc3NoQ29uZmlnLnN0b3JlKHRoaXMuX3BhdGgpO1xuICAgIH07XG4gICAgcmVhZEZyb21EaXIoKXsgLy8gc3luY3Mgc3NoSW5zdGFuY2UgZnJvbSBkaXJlY3RvcnlcbiAgICAgICAgXG4gICAgfVxuICAgIHVwZGF0ZURpclBhdGgoZGlyUGF0aEFyZzpzdHJpbmcpe1xuICAgICAgICB0aGlzLl9wYXRoID0gZGlyUGF0aEFyZztcbiAgICB9O1xuICAgIGdldEtleXMoKXtcbiAgICAgICAgcmV0dXJuIGhlbHBlcnMuc3NoS2V5QXJyYXlGcm9tRGlyKHRoaXMuX3BhdGgpO1xuICAgIH1cbn0iXX0=

View File

@ -1,10 +1,9 @@
import "typings-global";
import { SshDir } from "./smartssh.classes.sshdir";
import { SshKey } from "./smartssh.classes.sshkey";
export declare class SshInstance {
private _sshKeyArray;
private _sshConfig;
sshDir: SshDir;
protected sshKeyArray: SshKey[];
private _sshDir;
private _sshSync;
constructor(optionsArg?: {
sshDirPath?: string;
@ -23,6 +22,7 @@ export declare class SshInstance {
* read ab SshInstance from disk
*/
readFromDisk(): void;
private _makeConfig();
/**
* method to invoke SshInstance _sync automatically when sshSync is true
*/

File diff suppressed because one or more lines are too long

View File

@ -1,18 +1,22 @@
import "typings-global";
export declare class SshKey {
private privKey;
private pubKey;
private hostVar;
private _privKey;
private _pubKey;
private _hostVar;
private _authorized;
constructor(optionsArg?: {
private?: string;
public?: string;
host?: string;
authorized?: boolean;
});
host: string;
privateKey: string;
privateKeyBase64: string;
publicKey: string;
publicKeyBase64: string;
type: string;
store(filePathArg?: string): void;
privKey: string;
privKeyBase64: string;
pubKey: string;
pubKeyBase64: string;
authorized: boolean;
type: any;
read(filePathArg: any): void;
store(dirPathArg: string): void;
}

File diff suppressed because one or more lines are too long

View File

@ -4,5 +4,7 @@ export declare let base64: any;
export declare let fs: any;
export declare let minimatch: any;
export import path = require("path");
export declare let q: any;
export declare let shelljs: any;
export import smartfile = require("smartfile");
export import smartpath = require("smartpath");

View File

@ -5,7 +5,9 @@ exports.base64 = require("js-base64").Base64;
exports.fs = require("fs-extra");
exports.minimatch = require("minimatch");
exports.path = require("path");
exports.q = require("q");
exports.shelljs = require("shelljs");
exports.smartfile = require("smartfile");
exports.smartpath = require("smartpath");
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQ1AsQ0FBQyxDQURzQjtBQUNULGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDcEMsY0FBTSxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQyxNQUFNLENBQUM7QUFDckMsVUFBRSxHQUFHLE9BQU8sQ0FBQyx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QyxVQUFVLENBQUMsQ0FBQztBQUN6QixpQkFBUyxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQztBQUM5QixZQUFJLFdBQVcsTUFBTSxDQUFDLENBQUM7QUFDMUIsU0FBQyxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNqQixlQUFPLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBQzFCLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDakMsaUJBQVMsV0FBVyxXQUFXLENBQUMsQ0FBQyIsImZpbGUiOiJzbWFydHNzaC5wbHVnaW5zLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIlxuZXhwb3J0IGltcG9ydCBiZWF1dHlsb2cgPSByZXF1aXJlKFwiYmVhdXR5bG9nXCIpO1xuZXhwb3J0IGxldCBiYXNlNjQgPSByZXF1aXJlKFwianMtYmFzZTY0XCIpLkJhc2U2NDtcbmV4cG9ydCBsZXQgZnMgPSByZXF1aXJlKFwiZnMtZXh0cmFcIik7XG5leHBvcnQgbGV0IG1pbmltYXRjaCA9IHJlcXVpcmUoXCJtaW5pbWF0Y2hcIik7XG5leHBvcnQgaW1wb3J0IHBhdGggPSByZXF1aXJlKFwicGF0aFwiKTtcbmV4cG9ydCBsZXQgcSA9IHJlcXVpcmUoXCJxXCIpO1xuZXhwb3J0IGxldCBzaGVsbGpzID0gcmVxdWlyZShcInNoZWxsanNcIik7XG5leHBvcnQgaW1wb3J0IHNtYXJ0ZmlsZSA9IHJlcXVpcmUoXCJzbWFydGZpbGVcIik7XG5leHBvcnQgaW1wb3J0IHNtYXJ0cGF0aCA9IHJlcXVpcmUoXCJzbWFydHBhdGhcIik7Il19

View File

@ -1,3 +1,4 @@
{
"mode":"default"
"mode":"default",
"coverageTreshold":50
}

View File

@ -1,6 +1,6 @@
{
"name": "smartssh",
"version": "1.0.7",
"version": "1.1.5",
"description": "setups SSH quickly and in a painless manner",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
@ -27,7 +27,9 @@
"fs-extra": "^0.30.0",
"js-base64": "^2.1.9",
"minimatch": "^3.0.2",
"smartfile": "^4.0.4",
"q": "^1.4.1",
"shelljs": "^0.7.0",
"smartfile": "^4.0.5",
"smartpath": "^3.2.2",
"typings-global": "^1.0.3",
"typings-test": "^1.0.1"

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,7 @@
import "typings-test"
import "should";
import smartssh = require("../dist/index");
import path = require("path");
describe("smartssh",function(){
let testSshInstance:smartssh.SshInstance;
let testSshKey:smartssh.SshKey;
@ -17,18 +18,23 @@ describe("smartssh",function(){
testSshKey.type.should.equal("duplex");
});
it(".publicKey should be public key",function(){
testSshKey.publicKey.should.equal("someExamplePublicKey");
testSshKey.pubKey.should.equal("someExamplePublicKey");
});
it(".privateKey should be private key",function(){
testSshKey.privateKey.should.equal("someExamplePrivateKey");
testSshKey.privKey.should.equal("someExamplePrivateKey");
});
it(".publicKeyBase64 should be public key base 64 encoded",function(){
testSshKey.publicKeyBase64;
})
testSshKey.pubKeyBase64;
});
it(".store() should store the file to disk",function(){
testSshKey.store(path.join(process.cwd(),"test/temp"));
});
});
describe(".SshInstance",function(){
it("'new' keyword should create a new SshInstance object from class",function(){
testSshInstance = new smartssh.SshInstance();
testSshInstance = new smartssh.SshInstance({
sshDirPath: path.join(process.cwd(),"test/temp/")
});
testSshInstance.should.be.instanceof(smartssh.SshInstance);
});
it(".addKey() should accept a new SshKey object",function(){
@ -56,11 +62,14 @@ describe("smartssh",function(){
sshKeyArray[2].host.should.equal("github.com");
});
it(".getKey() should get a specific key selected by host",function(){
testSshInstance.getKey("github.com").publicKey.should.equal("someGitHubPublicKey");
testSshInstance.getKey("github.com").pubKey.should.equal("someGitHubPublicKey");
})
it(".removeKey() should remove a key",function(){
testSshInstance.removeKey(testSshInstance.getKey("bitbucket.org"));
testSshInstance.sshKeys[1].host.should.equal("github.com");
});
it("it should store to disk",function(){
testSshInstance.writeToDisk();
})
});
})

View File

@ -1,8 +1,53 @@
import "typings-global";
import * as plugins from "./smartssh.plugins";
import * as helpers from "./smartssh.classes.helpers";
import {SshKey} from "./smartssh.classes.sshkey"
export class SshConfig {
constructor(){
sshKeyArray:SshKey[];
constructor(sshKeyArrayArg:SshKey[]){
this.sshKeyArray = sshKeyArrayArg;
}
}
/**
* stores a config file
*/
store(dirPathArg:string){
let done = plugins.q.defer();
let configArray:configObject[] = [];
let configString;
for(let key in this.sshKeyArray){
let 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
});
}
let configFile:string = "";
for(let key in configArray){
configFile = configFile + configArray[key].configString + "\n";
};
plugins.smartfile.memory.toFsSync(configFile,plugins.path.join(dirPathArg,"config"));
return done.promise;
}
read(dirPathArg){
let done = plugins.q.defer();
let configArray:configObject[];
return done.promise;
}
};
export interface configObject {
configString:string;
authorized:boolean;
sshKey:SshKey;
};

View File

@ -5,24 +5,31 @@ import {SshInstance} from "./smartssh.classes.sshinstance";
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; // the path of the ssh directory
sshInstance:SshInstance;
constructor(sshInstanceArg:SshInstance,sshDirPathArg?:string){
let sshDirPath:string;
private _path:string; // the path of the ssh directory
private _sshKeyArray:SshKey[];
private _sshConfig:SshConfig;
constructor(sshKeyArray:SshKey[],sshConfig:SshConfig,sshDirPathArg?:string){
this._sshKeyArray = sshKeyArray;
this._sshConfig = sshConfig;
if(sshDirPathArg){
sshDirPath = sshDirPathArg;
this._path = sshDirPathArg;
} else {
sshDirPath = plugins.smartpath.get.home();
}
this.path = sshDirPath;
this._path = plugins.path.join(plugins.smartpath.get.home(),".ssh/");
};
}
writeToDir(){ // syncs sshInstance to directory
this._sshKeyArray.forEach((sshKeyArg) => {
sshKeyArg.store(this._path);
});
this._sshConfig.store(this._path);
};
readFromDir(){ // syncs sshInstance from directory
}
updateDirPath(dirPathArg:string){
this._path = dirPathArg;
};
getKeys(){
return helpers.sshKeyArrayFromDir(this.path);
return helpers.sshKeyArrayFromDir(this._path);
}
}

View File

@ -7,29 +7,30 @@ import {SshConfig} from "./smartssh.classes.sshconfig";
import {SshKey} from "./smartssh.classes.sshkey";
export class SshInstance {
private _sshKeyArray:SshKey[]; //holds all ssh keys
private _sshConfig:SshConfig; // sshConfig (e.g. represents ~/.ssh/config)
sshDir:SshDir; // points to sshDir class instance.
protected sshKeyArray:SshKey[]; //holds all ssh keys
private _sshDir:SshDir; // points to sshDir class instance.
private _sshSync:boolean; // if set to true, the ssh dir will be kept in sync automatically
constructor(optionsArg:{sshDirPath?:string,sshSync?:boolean}={}){
optionsArg ? void(0) : optionsArg = {};
this.sshKeyArray = [];
this._sshKeyArray = [];
this._sshConfig = new SshConfig(this._sshKeyArray);
this._sshDir = new SshDir(this._sshKeyArray,this._sshConfig,optionsArg.sshDirPath);
this._sshSync = optionsArg.sshSync;
this.sshDir = new SshDir(this,optionsArg.sshDirPath);
};
//altering methods
addKey(sshKeyArg:SshKey){
this._syncAuto("from");
this.sshKeyArray.push(sshKeyArg);
this._sshKeyArray.push(sshKeyArg);
this._syncAuto("to");
};
removeKey(sshKeyArg:SshKey){
this._syncAuto("from");
let filteredArray = this.sshKeyArray.filter((sshKeyArg2:SshKey) => {
let filteredArray = this._sshKeyArray.filter((sshKeyArg2:SshKey) => {
return (sshKeyArg != sshKeyArg2);
});
this.sshKeyArray = filteredArray;
this._sshKeyArray = filteredArray;
this._syncAuto("to");
};
replaceKey(sshKeyOldArg:SshKey,sshKeyNewArg:SshKey){
@ -42,7 +43,7 @@ export class SshInstance {
//
getKey(hostArg:string):SshKey{
this._syncAuto("from");
let filteredArray = this.sshKeyArray.filter(function(keyArg){
let filteredArray = this._sshKeyArray.filter(function(keyArg){
return (keyArg.host == hostArg);
});
if(filteredArray.length > 0){
@ -53,7 +54,7 @@ export class SshInstance {
};
get sshKeys():SshKey[] {
this._syncAuto("from");
return this.sshKeyArray;
return this._sshKeyArray;
};
//FS methods
@ -72,6 +73,14 @@ export class SshInstance {
this._sync("from");
}
/* ===============================================================
========================= Private Methods ========================
================================================================*/
private _makeConfig (){
}
/**
* method to invoke SshInstance _sync automatically when sshSync is true
*/
@ -84,13 +93,11 @@ export class SshInstance {
*/
private _sync(directionArg:string){
if(directionArg == "from"){
this.sshDir.readFromDir(); // call sync method of sshDir class;
this._sshDir.readFromDir(); // call sync method of sshDir class;
} else if(directionArg == "to") {
this.sshDir.writeToDir();
this._sshDir.writeToDir();
} else {
throw new Error("directionArg not recognised. Must be 'to' or 'from'");
}
};
}

View File

@ -3,71 +3,94 @@ import * as plugins from "./smartssh.plugins";
import * as helpers from "./smartssh.classes.helpers";
export class SshKey {
private privKey:string;
private pubKey:string;
private hostVar:string;
constructor(optionsArg:{private?:string,public?:string,host?:string}={}){
this.privKey = optionsArg.private;
this.pubKey = optionsArg.public;
this.hostVar = optionsArg.host;
private _privKey:string;
private _pubKey:string;
private _hostVar:string;
private _authorized:boolean;
constructor(optionsArg:{private?:string,public?:string,host?:string,authorized?:boolean}={}){
this._privKey = optionsArg.private;
this._pubKey = optionsArg.public;
this._hostVar = optionsArg.host;
this._authorized = optionsArg.authorized;
};
// getters
// this.host
get host(){
return this.hostVar;
return this._hostVar;
};
get privateKey(){
return this.privKey;
set host(hostArg:string){
this._hostVar = hostArg;
};
get privateKeyBase64(){
return plugins.base64.encode(this.privKey);
// this.privKey
get privKey(){
return this._privKey;
};
set privKey(privateKeyArg:string){
this._privKey = privateKeyArg;
};
// this.privKeyBase64
get privKeyBase64(){
return plugins.base64.encode(this._privKey);
}
get publicKey(){
return this.pubKey;
set privKeyBase64(privateKeyArg:string) {
this._privKey = plugins.base64.decode(privateKeyArg);
}
get publicKeyBase64(){
return plugins.base64.encode(this.pubKey);
// this.pubKey
get pubKey(){
return this._pubKey;
}
set pubKey(publicKeyArg:string){
this._pubKey = publicKeyArg;
};
// this.pubKeyBase64
get pubKeyBase64(){
return plugins.base64.encode(this._pubKey);
}
set pubKeyBase64(publicKeyArg:string) {
this._pubKey = plugins.base64.decode(publicKeyArg);
}
get authorized(){
return this._authorized;
}
set authorized(authorizedArg:boolean){
this._authorized = authorizedArg;
}
get type(){
if(this.privKey && this.pubKey){
if(this._privKey && this._pubKey){
return "duplex";
} else if(this.privKey){
} else if(this._privKey){
return "private";
} else if(this.pubKey){
} else if(this._pubKey){
return "public";
}
};
// setters
set host(hostArg:string){
this.hostVar = hostArg;
};
set privateKey(privateKeyArg:string){
this.privKey = privateKeyArg;
};
set privateKeyBase64(privateKeyArg:string) {
this.privKey = plugins.base64.decode(privateKeyArg);
set type(someVlueArg:any){
console.log("the type of an SshKey connot be set. This value is autpcomputed.")
}
set publicKey(publicKeyArg:string){
this.pubKey = publicKeyArg;
};
set publicKeyBase64(publicKeyArg:string) {
this.pubKey = plugins.base64.decode(publicKeyArg);
// methods
read(filePathArg){
}
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.pub")); // call this function recursivly
store(dirPathArg:string){
plugins.fs.ensureDirSync(dirPathArg);
let fileNameBase = this.host;
if(this._privKey){
let filePath = plugins.path.join(dirPathArg,fileNameBase);
plugins.smartfile.memory.toFsSync(this._privKey,filePath);
plugins.shelljs.chmod(600,filePath);
};
if (this._pubKey){
let filePath = plugins.path.join(dirPathArg,fileNameBase + ".pub");
plugins.smartfile.memory.toFsSync(this._pubKey,filePath);
plugins.shelljs.chmod(600,filePath);
}
}
}
}
let testKey = new SshKey();

View File

@ -4,5 +4,7 @@ export let base64 = require("js-base64").Base64;
export let fs = require("fs-extra");
export let minimatch = require("minimatch");
export import path = require("path");
export let q = require("q");
export let shelljs = require("shelljs");
export import smartfile = require("smartfile");
export import smartpath = require("smartpath");

View File

@ -1,8 +0,0 @@
{
"version": false,
"dependencies": {},
"ambientDependencies": {
"colors": "registry:dt/colors#0.6.0-1+20160317120654",
"node": "registry:dt/node#4.0.0+20160423143914"
}
}