fastify-mtls
Advanced tools
Comparing version 1.0.0 to 1.0.1
23
index.js
const fp = require('fastify-plugin') | ||
const getCertificate = require('vault-pki-fetcher') | ||
async function fastifyMTLS (app, options, done) { | ||
app.addHook('onReady', async () => { | ||
const tls = await getCertificate(options) | ||
const { key, cert, ca } = tls | ||
app.decorate('mtls', { | ||
key, cert, ca | ||
}) | ||
app.server.setSecureContext({ | ||
key, | ||
cert, | ||
ca | ||
}) | ||
async function fastifyMTLS (app, options) { | ||
const tls = await getCertificate(options) | ||
const { key, cert, ca } = tls | ||
app.decorate('mtls', { | ||
key, cert, ca | ||
}) | ||
done() | ||
app.server.setSecureContext({ | ||
key, | ||
cert, | ||
ca | ||
}) | ||
} | ||
@@ -19,0 +16,0 @@ |
{ | ||
"name": "fastify-mtls", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Enables mTLS on a Fastify server", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
52938
384