update tsconfig

This commit is contained in:
Philipp Kunz 2024-04-14 18:22:42 +02:00
parent f7661e3133
commit 7037cee3d8
4 changed files with 144 additions and 59 deletions

View File

@ -9,12 +9,22 @@
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartssh",
"description": "setups SSH quickly and in a painless manner",
"description": "A library for setting up SSH configuration quickly and painlessly.",
"npmPackagename": "@push.rocks/smartssh",
"license": "MIT"
"license": "MIT",
"keywords": [
"SSH",
"SSH configuration",
"SSH keys management",
"automation",
"development tools",
"node.js",
"security",
"server management"
]
}
},
"tsdocs": {
"tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
}
}

View File

@ -2,7 +2,7 @@
"name": "@push.rocks/smartssh",
"version": "2.0.2",
"private": false,
"description": "setups SSH quickly and in a painless manner",
"description": "A library for setting up SSH configuration quickly and painlessly.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
@ -18,8 +18,13 @@
},
"keywords": [
"SSH",
"ENV",
"base64"
"SSH configuration",
"SSH keys management",
"automation",
"development tools",
"node.js",
"security",
"server management"
],
"author": "Lossless GmbH",
"license": "MIT",
@ -62,4 +67,4 @@
"browserslist": [
"last 1 chrome versions"
]
}
}

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

173
readme.md
View File

@ -1,65 +1,134 @@
# @push.rocks/smartssh
setups SSH quickly and in a painless manner
setup SSH quickly and in a painless manner
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartssh)
* [gitlab.com (source)](https://gitlab.com/push.rocks/smartssh)
* [github.com (source mirror)](https://github.com/push.rocks/smartssh)
* [docs (typedoc)](https://push.rocks.gitlab.io/smartssh/)
## Install
## Status for master
To begin using `@push.rocks/smartssh` in your project, you'll need to install it via npm or yarn. You can do so by running one of the following commands:
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/smartssh/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/smartssh/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smartssh)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/smartssh)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@push.rocks/smartssh)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smartssh)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smartssh)](https://lossless.cloud)
```bash
npm install @push.rocks/smartssh --save
```
or
```bash
yarn add @push.rocks/smartssh
```
## Usage
```javascript
var smartssh = require('smartssh');
var sshInstance = new smartssh.sshInstance({
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;
`@push.rocks/smartssh` is a powerful package designed to simplify SSH configurations, key management, and interaction in a Typescript environment, using ESM syntax. This guide will cover how to utilize the primary functionalities provided by the package.
#### Setting Up an SSH Instance
An SSH instance represents your SSH configurations, including the keys and the SSH directory. Here's how to create an instance:
```typescript
import { SshInstance } from '@push.rocks/smartssh';
const mySshInstance = new SshInstance({
sshDirPath: '/path/to/.ssh', // Optional: specify SSH directory path
sshSync: true, // Optional: keep the instance in sync with the SSH directory automatically
});
sshInstance.addKey(
new smartssh.sshKey({
private: 'somestring',
public: 'somestring', // optional
host: 'github.com',
encoding: 'base64', // optional, defaults to "utf8", can be "utf8" or "base64", useful for reading ssh keys from environment variables
})
);
sshInstance.removeKey(sshInstance.getKey('github.com')); // removes key for host "github.com" is present
sshInstance.createKey({
host: 'gitlab.com', // returns new key in the form sshKey, read more about the sshKey class below
});
sshInstance.getKey({
// returns ssh key in the form sshKey, read more about the sshKey class below
host: 'github.com',
});
sshInstance.getKeys(); // returns array of all available getKeys. Each key is in form of class sshKey
```
## Contribution
#### Working with SSH Keys
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
SSH keys can be managed using the `SshKey` class. You can add, remove, or retrieve keys from your SSH instance.
For further information read the linked docs at the top of this readme.
```typescript
import { SshKey } from '@push.rocks/smartssh';
## Legal
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
// Creating a new SSH key
const mySshKey = new SshKey({
host: 'github.com', // Hostname
private: 'privateKeyString', // Private key string
public: 'publicKeyString', // Optional: public key string
authorized: false // Optional: Is this key authorized? Defaults to false
});
// Adding the SSH key to the instance
mySshInstance.addKey(mySshKey);
// Getting an SSH key by host
const githubKey = mySshInstance.getKey('github.com');
// Removing an SSH key by instance
mySshInstance.removeKey(githubKey);
```
#### Syncing Keys with the File System
`@push.rocks/smartssh` makes it easy to synchronize your SSH keys with the file system, keeping your actual SSH configuration and your program state in alignment.
```typescript
// To write the current state to the SSH directory
mySshInstance.writeToDisk();
// To read and synchronize the state from the SSH directory
mySshInstance.readFromDisk();
```
#### Advanced Key Management
- **Encoding and Decoding**: Keys can be encoded in `base64` for easier environment variable storage.
- **Key Type Detection**: The package can detect and handle private, public, or both keys present scenarios (`duplex`).
- **Custom SSH Directory**: Support for custom SSH directory locations.
- **Automatic Syncing**: Optionally keep the SSH instance automatically synced with the SSH directory on modifications.
### Comprehensive Example
Below is a comprehensive example demonstrating SSH instance creation, adding a new SSH key, and syncing with the filesystem.
```typescript
import { SshInstance, SshKey } from '@push.rocks/smartssh';
async function setupSsh() {
// Initialize the SSH instance
const sshInstance = new SshInstance({
sshDirPath: '/custom/path/to/.ssh',
sshSync: true,
});
// Create a new SSH key
const newSshKey = new SshKey({
host: 'my.custom.server.com',
private: 'myPrivateKeyInBase64',
public: 'myPublicKeyInBase64',
});
// Add the new key to the instance
sshInstance.addKey(newSshKey);
// Optionally, write to disk immediately
sshInstance.writeToDisk();
}
// Running the SSH setup
setupSsh().then(() => {
console.log('SSH setup complete.');
}).catch((error) => {
console.error('SSH setup failed:', error);
});
```
This guide should provide a robust start to managing SSH configurations using `@push.rocks/smartssh`. Whether for individual projects or shared across a team, this package offers a streamlined approach to handling SSH keys, config synchronization, and more, all within a TypeScript project.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.