0.5.5 • Published 1 year ago

@vyro-x/node-secrets v0.5.5

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Node Secrets

Server-side secret management utils for Node.js

Usage

import { GraphQLClient } from 'graphql-request';
import { config } from './config';
import { getSecretFromArn } from './getSecretFromArn';

export const hasuraClient = new GraphQLClient(config.HASURA_ENDPOINT, {
  requestMiddleware: async (request) => {
    const adminSecret = await getSecretFromArn(config.HASURA_ADMIN_SECRET_ARN);

    return {
      ...request,
      headers: {
        ...request.headers,
        'x-hasura-admin-secret': adminSecret,
      },
    };
  },
});

How it works

  1. Secrets are loaded from AWS Secrets Manager at run time.
  2. The request value is cached for 10 minutes to optimise request speed and cost.
  3. Secrets are returned as string values.
  4. An error is thrown if the secret cannot be found.
0.5.5

1 year ago

0.5.4

1 year ago

0.5.3

1 year ago

0.5.2

2 years ago

0.5.1

2 years ago

0.5.0

2 years ago