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:44:31 +00:00
|
|
|
## Availabililty
|
|
|
|
[![npm](https://push.rocks/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartssh)
|
|
|
|
[![git](https://push.rocks/assets/repo-button-git.svg)](https://gitlab.com/pushrocks/smartssh)
|
|
|
|
[![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartssh)
|
|
|
|
[![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartssh/)
|
|
|
|
|
|
|
|
## Status for master
|
|
|
|
[![build status](https://gitlab.com/pushrocks/smartssh/badges/master/build.svg)](https://gitlab.com/pushrocks/smartssh/commits/master)
|
|
|
|
[![coverage report](https://gitlab.com/pushrocks/smartssh/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartssh/commits/master)
|
|
|
|
[![npm downloads per month](https://img.shields.io/npm/dm/smartssh.svg)](https://www.npmjs.com/package/smartssh)
|
|
|
|
[![Dependency Status](https://david-dm.org/pushrocks/smartssh.svg)](https://david-dm.org/pushrocks/smartssh)
|
|
|
|
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartssh/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartssh/master/dependencies/npm)
|
|
|
|
[![bitHound Code](https://www.bithound.io/github/pushrocks/smartssh/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartssh)
|
|
|
|
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
|
|
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
|
|
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
|
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
|
|
|
```
|
2016-11-23 11:44:31 +00:00
|
|
|
|
|
|
|
[![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks)
|