@c4312/keyvault-loader
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

@c4312/keyvault-loader

Small utility library that:

  • Replaces all keyvault secret URIs in the object with their value loaded from keyvault
  • Can optionally cache secrets on disk. Very useful in a development environment, since otherwise loading secrets from keyvault can take several seconds.

Secrets cached on disk are appropriately permissioned and AES encrypted, but bear in mind these will have less security than a keyvault value stored only in memory.

Usage

import { AzureCliCredential } from '@azure/identity';
import { SecretClient } from '@azure/keyvault-secrets';
import resolveConfig from '@c4312/keyvault-loader';

const myConfig = { fooSecret: 'https://myvault.vault.azure.net/secrets/foo' };}
const resolved = await resolveConfig(myConfig, {
  client: keyvaultUrl => new SecretClient(keyvaultUrl, new AzureCliCredential()),
  cache: true
});

console.log(resolved); // { fooSecret: 'mySecretValue' }

Package Sidebar

Install

npm i @c4312/keyvault-loader

Weekly Downloads

1

Version

0.1.2

License

MIT

Unpacked Size

6.53 kB

Total Files

5

Last publish

Collaborators

  • connor.peet