UNPKG

acme-http-01-azure-key-vault-middleware

Version:

Use Let's Encrypt and other RFC 8555 providers natively and securely on Azure

26 lines (18 loc) 598 B
const fetchChallengeResponse = require('./fetchChallengeResponse'); module.exports = ({ azureCredential, azureKeyVaultName }) => { return async context => { let challengeResponse; try { challengeResponse = await fetchChallengeResponse({ azureCredential, azureKeyVaultName, token: context.bindingData.token }); } catch (err) { context.log(err.message); if (err instanceof TypeError) { context.res = { status: 400 }; return; } context.res = { status: 404 }; return; } context.res = { body: challengeResponse }; }; };