peek-a-vault

A small library to retreive secrets from different Key Vaults on App Services using MSI authentication.
It will provide a fallback to read secrets from environment variables when working on local.
Installation
npm install @guestlinelabs/peek-a-vault
Support
Only Node 8+.
Example
The library will return a function that you use to initialise the client, given a set of Key Vault namespaces.
import { createClient } from '@guestlinelabs/peek-a-vault';
const getSecret = createClient({
client: async () => keyVaultClient;
useCache: false,
useVault: Boolean(process.env.APPSETTING_WEBSITE_SITE_NAME),
urls: {
NS1: 'https://ns1.vault.azure.net',
NS2: 'https://ns1.vault.azure.net',
},
});
async function main() {
const storageClient = new StorageClient(
await getSecret('NS1', 'STORAGE_KEY')
);
const emailClient = new EmailClient(await getSecret('NS2', 'SENDGRID_KEY', false));
}