# seal-tlscert

> Provides TLS key and certificate

Latest version **1.2.3** (published 2017-10-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install seal-tlscert
pnpm add seal-tlscert
yarn add seal-tlscert
bun add seal-tlscert
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.3 |
| Published | 2017-10-27 |
| First published | 2017-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+10 in 1 direct dependencies) |
| Install scripts | no |
| Author | SEAL Systems AG |
| Maintainers | michaelscherer-seal |

## Links

- npm: https://www.npmjs.com/package/seal-tlscert
- Repository: https://github.com/sealsystems/seal-tlscert
- Homepage: https://github.com/sealsystems/seal-tlscert#readme
- Issues: https://github.com/sealsystems/seal-tlscert/issues
- npm.io page: https://npm.io/package/seal-tlscert

## Dependencies (4)

- [lodash](https://npm.io/package/lodash.md) 4.17.4
- [nodeenv](https://npm.io/package/nodeenv.md) 0.3.0
- [seal-log](https://npm.io/package/seal-log.md) 1.2.0
- [processenv](https://npm.io/package/processenv.md) 0.1.1

## Recent versions

- 1.2.3 (latest) — 2017-10-27
- 1.2.1 — 2017-02-06

## README

# seal-tlscert

[![CircleCI](https://circleci.com/gh/sealsystems/seal-tlscert.svg?style=svg)](https://circleci.com/gh/sealsystems/seal-tlscert)
[![Appveyor](https://ci.appveyor.com/api/projects/status/dppvysvpsac398h0?svg=true)](https://ci.appveyor.com/project/Plossys/seal-tlscert)

seal-tlscert provides TLS key and certificate.

## Installation

```bash
$ npm install seal-tlscert
```

## Quick start

First you need to add a reference to seal-tlscert within your application.

```javascript
var tlscert = require('seal-tlscert');
```

To get the content of the certificate and private key from a specific directory, first you need to set the `TLS_DIR` environment variable:

```bash
$ export TLS_DIR=$(pwd)
```

Then, call the `get` function:

```javascript
var keystore = tlscert.get();

console.log(keystore);
// => {
//       key: '...',
//       cert: '...',
//       ca: '...'
//       isFallback: true/false
//    }
```

If you do not set the environment variable, a default key and a default certificate will be returned. In this case the property `isFallback` is set to `true`.

```javascript
if (keystore.isFallback) {
  console.log('This is the fallback key and certificate provided by the module.');
}
```

Please note that the files must be called `key.pem`, `cert.pem` and `ca.pem`, and that they have to be stored in PEM format. Having a `ca.pem` file is optional.

## Self-signed certificate

This module uses a self-signed certificate if no other is provided. This certificate is valid for 10 years (3650 days to be exact ;-)). To see the details of the certificate, call:

```
npm run show-cert
```

To create a new one (with a new expiration date), run:

```bash
npm run generate-cert
```

Do not forget to release a new version in order to publish the created certificate.

BTW: It should be no problem if a system contains multiple versions of the self-signed certificate as long as they are not expired.

## Running the build

To build this module use [roboter](https://www.npmjs.com/package/roboter).

```bash
$ bot
```

---
_Source: https://npm.io/package/seal-tlscert · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
