# vault-pki-fetcher

> Issue TLS certificates from a Vault cluster

Latest version **0.2.0** (published 2023-05-08) · Apache 2.0 license · 0 weekly downloads

## Install

```sh
npm install vault-pki-fetcher
pnpm add vault-pki-fetcher
yarn add vault-pki-fetcher
bun add vault-pki-fetcher
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2023-05-08 |
| First published | 2023-05-05 |
| Weekly downloads | 0 |
| License | Apache 2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 18.7 KB |
| Known vulnerabilities | 0 (+16 in 1 direct dependencies) |
| Install scripts | no |
| Author | Leonardo Rossi |
| Maintainers | antoniosonis, mzugm, leorossi, marcopiraccini, ivan-tymoshenko, matteo.collina |

## Links

- npm: https://www.npmjs.com/package/vault-pki-fetcher
- npm.io page: https://npm.io/package/vault-pki-fetcher

## Dependencies (1)

- [undici](https://npm.io/package/undici.md) ^5.22.0

## Recent versions

- 0.2.0 (latest) — 2023-05-08
- 0.1.0 — 2023-05-05

## README

# vault-pki-fetcher
Issue TLS certificates from a Vault cluster. The return value can be set in a [`setSecureContext(...)`](https://nodejs.org/api/tls.html#serversetsecurecontextoptions) method call for a https server.

# Usage
For logging into Vault, you need a valid `roleId` and `secretId` with a policy able to read/write into your pki engine/role.

```javascript
const getCertificate = require('vault-pki-fetcher')

const options = {
  roleId: 'xxxx',
  secretId: 'yyyy',
  vaultAddress: 'https://localhost:8200',
  vaultNamespace: 'admin',
  commonName: 'example.com', // The common name the certificate will be valid for
  altNames: 'example2.com', // The Subject Alternative Names the certificate will be valid for
  ttl: '365d',
  CAName: 'your_ca', // the PKI engine name
  PKIRole: 'ca_role' // the PKI engine role name
}
const res = await getCertificate(options)
console.log(res)

/**
{
  key: '-----BEGIN RSA PRIVATE KEY-----\n' +
    ...
    '-----END RSA PRIVATE KEY-----',
  cert: '-----BEGIN CERTIFICATE-----\n' +
    ...
    '-----END CERTIFICATE-----',
  ca: [
    '-----BEGIN CERTIFICATE-----\n' +
      ...
    '-----END CERTIFICATE-----',
    '-----BEGIN CERTIFICATE-----\n' +
    ...
    '-----END CERTIFICATE-----'
  ]
}
*/ 
```

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