Skip to content

A nest app to manage perishable access keys and enforce rate limiters

Notifications You must be signed in to change notification settings

mp051998/AccessKeyManagementService

Repository files navigation

Access Key Management Service

Description

This is a simple nest app to allow admins to generate custom access keys to users. This service acts as a middleware of sorts and enforces rate limiting on the access keys. The access keys are stored in a redis datastore and the rate limiting is enforced using custom logic in the access key service. This app works alongside an other app which requires access token management like the token service app.

Installation

$ npm install

Setup Redis

Follow the instructions here to install redis on your machine.

Setup Environment Variables

Create a .env file in the root of the project and add the following environment variables:

PORT=3000 # Port the app will run on

# NOTE: This must match the PUBSUB channel in the Web3TokenInformationService as well
REDIS_HOST=localhost # Redis host
REDIS_PORT=6379 # Redis port
REDIS_PUBSUB_CHANNEL=access-keys # Redis pubsub channel

# MongoDB related
MONGO_CONNECTION_STRING=mongodb://localhost:27017 # MongoDB connection string

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

API Collection (Thunder Client):

NOTE: This collection is for the local environment. The base URL is set to http://localhost:3000. Change the base URL to the deployed URL if you want to use it in a deployed environment. Can be found here

About

A nest app to manage perishable access keys and enforce rate limiters

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published