update SshKey.store()
This commit is contained in:
parent
bf27aaf167
commit
6339a3ed9b
@ -73,15 +73,13 @@ export class SshKey {
|
|||||||
|
|
||||||
}
|
}
|
||||||
store(dirPathArg?:string){
|
store(dirPathArg?:string){
|
||||||
let filePathObj = plugins.path.parse(dirPathArg);
|
plugins.fs.ensureDirSync(dirPathArg);
|
||||||
if(filePathObj.ext = ".priv"){
|
let fileNameBase = this.host;
|
||||||
plugins.smartfile.memory.toFsSync(this._privKey,dirPathArg);
|
if(this._privKey){
|
||||||
} else if (filePathObj.ext = ".pub"){
|
plugins.smartfile.memory.toFsSync(this._privKey,plugins.path.join(dirPathArg,fileNameBase));
|
||||||
plugins.smartfile.memory.toFsSync(this._pubKey,dirPathArg);
|
};
|
||||||
} else { //we assume we are given a directory as filePathArg, so we store the whole key
|
if (this._pubKey){
|
||||||
plugins.fs.ensureDirSync(filePathObj.dir);
|
plugins.smartfile.memory.toFsSync(this._pubKey,plugins.path.join(dirPathArg,fileNameBase + ".pub"));
|
||||||
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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user