# greenlock-store-fs

> A file-based certificate store for greenlock that supports wildcards.

Latest version **3.2.2** (published 2019-11-02) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install greenlock-store-fs
pnpm add greenlock-store-fs
yarn add greenlock-store-fs
bun add greenlock-store-fs
```

## 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 | 3.2.2 |
| Published | 2019-11-02 |
| First published | 2019-04-08 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 29.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | AJ ONeal |
| Maintainers | coolaj86 |
| Keywords | greenlock, json, keypairs, certificates, store, database |

## Links

- npm: https://www.npmjs.com/package/greenlock-store-fs
- Repository: https://git.rootprojects.org/root/greenlock-store-fs.js
- npm.io page: https://npm.io/package/greenlock-store-fs

## Dependencies (2)

- [@root/mkdirp](https://npm.io/package/@root/mkdirp.md) ^1.0.0
- [safe-replace](https://npm.io/package/safe-replace.md) ^1.1.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 3.2.2 (latest) — 2019-11-02
- 3.2.0 (next) — 2019-10-28
- 3.0.2 — 2019-04-16
- 3.0.1 — 2019-04-16
- 3.0.0 — 2019-04-08

## README

# [greenlock-store-fs](https://git.rootprojects.org/root/greenlock-store-fs.js) | A [Root](https://rootprojects.org) project

A keypair and certificate storage strategy for Greenlock v2.7+ (and v3).
The (much simpler) successor to le-store-certbot.

Works with all ACME (Let's Encrypt) SSL certificate sytles:

-   [x] single domains
-   [x] multiple domains (SANs, AltNames)
-   [x] wildcards
-   [x] private / localhost domains

# Usage

**Global** config:

```js
greenlock.manager.defaults({
    store: {
        module: "greenlock-store-fs",
        basePath: "~/.config/greenlock"
    }
});
```

**Per-site** config:

```js
greenlock.add({
    subject: "example.com",
    altnames: ["example.com", "www.example.com"],
    store: {
        module: "greenlock-store-fs",
        basePath: "~/.config/greenlock"
    }
});
```

# File System

The default file system layout mirrors that of certbot (python Let's Encrypt implementation) and
the prior le-store-certbot in order to make transitioning effortless.

The default structure looks like this:

```txt
.config
└── greenlock
    ├── accounts
    │   └── acme-staging-v02.api.letsencrypt.org
    │       └── directory
    │           └── sites@example.com.json
    ├── staging
    │   └── (same as live)
    └── live
        ├── example.com
        │   ├── bundle.pem
        │   ├── cert.pem
        │   ├── chain.pem
        │   ├── fullchain.pem
        │   └── privkey.pem
        └── www.example.com
            ├── bundle.pem
            ├── cert.pem
            ├── chain.pem
            ├── fullchain.pem
            └── privkey.pem
```

# Internal Implementation Details

You **DO NOT NEED TO KNOW** these details.

They're provided for the sake of understanding what happens "under the hood"
to help you make better choices "in the seat".

# Parameters

| parameters        | example                                                  | notes            |
| ----------------- | -------------------------------------------------------- | ---------------- |
| `env`             | `staging` or `live`                                      | -                |
| `directoryUrl`    | `https://acme-staging-v02.api.letsencrypt.org/directory` | -                |
| `keypair`         | `{ privateKeyPem, privateKeyJwk }`                       |                  |
| `account`         | `{ id: "an-arbitrary-id" }`                              | account only     |
| `subscriberEmail` | `webhost@example.com`                                    | account only     |
| `certificate`     | `{ id: "an-arbitrary-id" }`                              | certificate only |
| `subject`         | `example.com`                                            | certificate only |
| `pems`            | `{ privkey, cert, chain, issuedAt, expiresAt }`          | certificate only |

### Account Keypair

```js
accounts.setKeypair = async function({
    env,
    basePath,
    directoryUrl,
    email,
    account
}) {
    var id = account.id || email;
    var serverDir = directoryUrl.replace("https://", "");
};
```

```js
accounts.checkKeypair = async function({
    env,
    basePath,
    directoryUrl,
    email,
    account
}) {
    var id = account.id || email;
    var serverDir = directoryUrl.replace("https://", "");

    return {
        privateKeyPem,
        privateKeyJwk
    };
};
```

### Certificate Keypair

```js
certificate.setKeypair = async function({
    env,
    basePath,
    directoryUrl,
    subject,
    certificate
}) {
    var id = account.id || email;
    env = env || directoryUrl.replace("https://", "");
};
```

```js
certificate.checkKeypair = async function({
    env,
    basePath,
    directoryUrl,
    subject,
    certificate
}) {
    var id = account.id || email;
    env = env || directoryUrl.replace("https://", "");

    return {
        privateKeyPem,
        privateKeyJwk
    };
};
```

### Certificate PEMs

```js
certificate.set = async function({
    env,
    basePath,
    directoryUrl,
    subject,
    certificate,
    pems
}) {
    var id = account.id || email;
    env = env || directoryUrl.replace("https://", "");
};
```

```js
certificate.check = async function({
    env,
    basePath,
    directoryUrl,
    subject,
    certificate
}) {
    var id = account.id || email;
    env = env || directoryUrl.replace("https://", "");

    return {
        privkey,
        cert,
        chain,
        issuedAt,
        expiresAt
    };
};
```

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