smartssh/README.md

37 lines
1.2 KiB
Markdown
Raw Permalink Normal View History

2016-04-25 03:06:39 +00:00
# smartssh
setups SSH quickly and in a painless manner
2016-04-25 03:24:10 +00:00
> Attention: This is still alpha, so some things won't work, not all things are inplemented.
2016-04-25 03:06:39 +00:00
2016-11-23 11:38:38 +00:00
2016-04-25 03:06:39 +00:00
## Usage
```javascript
var smartssh = require("smartssh");
2016-04-25 03:24:10 +00:00
var sshInstance = new smartssh.sshInstance({
2016-04-25 03:06:39 +00:00
sshDir: "/some/path/.ssh", // the standard ssh directory, optional, defaults to "~./.ssh"
sshSync: true // sync ssh this instance will represent the status of an ssh dir if set to true;
});
2016-04-25 03:24:10 +00:00
sshInstance.addKey(new smartssh.sshKey({
2016-04-25 03:06:39 +00:00
private: "somestring",
2016-04-25 03:24:10 +00:00
public: "somestring", // optional
2016-04-26 02:44:50 +00:00
host:"github.com",
2016-04-25 03:24:10 +00:00
encoding: "base64" // optional, defaults to "utf8", can be "utf8" or "base64", useful for reading ssh keys from environment variables
}));
2016-04-26 02:44:50 +00:00
sshInstance.removeKey(sshInstance.getKey("github.com")); // removes key for host "github.com" is present
2016-04-25 03:24:10 +00:00
sshInstance.createKey({
2016-04-26 02:44:50 +00:00
host:"gitlab.com" // returns new key in the form sshKey, read more about the sshKey class below
2016-04-25 03:24:10 +00:00
})
sshInstance.getKey({ // returns ssh key in the form sshKey, read more about the sshKey class below
2016-04-26 02:44:50 +00:00
host:"github.com"
2016-04-25 03:06:39 +00:00
});
2016-04-25 03:24:10 +00:00
sshInstance.getKeys() // returns array of all available getKeys. Each key is in form of class sshKey
2016-04-26 02:44:50 +00:00
```