diff --git a/ts/smartssh.classes.sshconfig.ts b/ts/smartssh.classes.sshconfig.ts index 8160bdb..c62e994 100644 --- a/ts/smartssh.classes.sshconfig.ts +++ b/ts/smartssh.classes.sshconfig.ts @@ -5,11 +5,34 @@ import {SshKey} from "./smartssh.classes.sshkey" export class SshConfig { sshKeyArray:SshKey[]; - + config:configObject[]; constructor(sshKeyArrayArg:SshKey[]){ this.sshKeyArray = sshKeyArrayArg; + this.config = []; } makeConfig(){ - + // clear old config in place + let configLength = this.config.length; + for(let i = 0; i < configLength; i++){ + this.config.pop(); + } + for(let key in this.sshKeyArray){ + let localSshKey = this.sshKeyArray[key]; + this.config.push({ + host: localSshKey.host, + authorized: localSshKey.authorized, + sshKey: localSshKey + }) + } } -} \ No newline at end of file + storeConfig(){ + + } +}; + +interface configObject { + host:string; + authorized:boolean; + sshKey:SshKey; +}; + diff --git a/ts/smartssh.classes.sshkey.ts b/ts/smartssh.classes.sshkey.ts index 7dce4bf..4d8f5cc 100644 --- a/ts/smartssh.classes.sshkey.ts +++ b/ts/smartssh.classes.sshkey.ts @@ -6,10 +6,12 @@ export class SshKey { private privKey:string; private pubKey:string; private hostVar:string; - constructor(optionsArg:{private?:string,public?:string,host?: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