update structure

This commit is contained in:
2016-06-25 13:07:24 +02:00
parent 9bc3aea59c
commit bf27aaf167
3 changed files with 6 additions and 13 deletions

View File

@ -72,12 +72,12 @@ export class SshKey {
read(filePathArg){
}
store(filePathArg?:string){
let filePathObj = plugins.path.parse(filePathArg);
store(dirPathArg?:string){
let filePathObj = plugins.path.parse(dirPathArg);
if(filePathObj.ext = ".priv"){
plugins.smartfile.memory.toFsSync(this._privKey,filePathArg);
plugins.smartfile.memory.toFsSync(this._privKey,dirPathArg);
} else if (filePathObj.ext = ".pub"){
plugins.smartfile.memory.toFsSync(this._pubKey,filePathArg);
plugins.smartfile.memory.toFsSync(this._pubKey,dirPathArg);
} 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