0.3.0 • Published 9 months ago

@rytass/secret-adapter-vault v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Rytass Utils - Secret Manager (Vault)

Featues

Auth

  • Vault Auth (userpass)
  • Vault Auth (token)

Engines

Getting Started

import { VaultSecret } from '@rytass/secret-adapter-vault';

const offlineManager = new VaultSecret('rytass/utils', {
  host: 'https://vault.server.com',
  auth: {
    account: 'account',
    password: 'complex_text',
  },
  onReady: () => {
    const dbHost = offlineManager.get<string>('DB_HOST');

    offlineManager.set<string>('NEW_KEY', 'BAR');

    const newKey = offlineManager.get<string>('NEW_KEY'); // BAR

    offlineManager.delete('NEW_KEY');

    offlineManager.sync().then(() => {
      // Synced local cache to server
    });

    // Force replace online data (ignore version check)
    offlineManager.sync(true);
  },
});

const onlineManager = new VaultSecret('rytass/utils', {
  host: 'https://vault.server.com',
  online: true,
  auth: {
    account: 'account',
    password: 'complex_text',
  },
});

const dbUser = await onlineManager.get<string>('DB_USER');

await onlineManager.set<number>('USAGE_COUNT', 6);

const usage = await onlineManager.get<number>('USAGE_COUNT');

await onlineManager.delete('USAGE_COUNT');
0.3.0

9 months ago

0.2.2

12 months ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago