Skip to content

Commit

Permalink
feat: Add API key endpoints [DEV-3793] (#510)
Browse files Browse the repository at this point in the history
* Add base endpoints for Stripe integration

* Add swagger docs and make it as separate swagger for admin and api

* - Add Stripe webhook handling
- Add subscription entity
- Add chekout API guarding

* Add auth routes to admin

* Lint and format

* swagger changes

* Get rid of /admin/checkout and move it to /admin/subscriptions

* Change endpoint in swagger

* Fix swagger generation and add API routes

* Fix swagger request body for subscription update

* Fix stripeSync function

* Get permissions from the M2M token

* Sync updated and  small clean-ups

* Clean-ups

* Add trial period days to subscription creation

* Get also trilaing subsriptions

* Get rd of Stripe naming

* Small cleeanups and refactoring

* Make swagger changes

* Add encryption/decryption to API key

* Change API logic a bit and introduce API key endpoints

* MAkes linter happy

* Merge remote-tracking branch 'origin/develop' into DEV-3793

* Get rid of apiKeyHash

* Lint

* Push swagger file

* Fix required field in swagger

* Fix swagger date-time

* Fix name field in APIKeyCreateRequestBody

* Get rid of env variables and make them constants

* Move to bcrypt and HMAC API key generating

* Add an ability to add several endpoints into CORS

* npm run format

* npm run build:swagger

* Update .prettierignore

* Rename API_SECRET_KEY_LENGTH to API_KEY_LENGTH

* Update text

* npm update

* Move to UTC time comparing

* npm run format

---------

Co-authored-by: Ankur Banerjee <[email protected]>
  • Loading branch information
Andrew Nikitin and ankurdotb authored Apr 17, 2024
1 parent d2076ff commit c237502
Show file tree
Hide file tree
Showing 27 changed files with 9,155 additions and 6,742 deletions.
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ yarn.lock
**/tsconfig.json

# Ignore generated files
src/static/swagger.json
src/static/swagger-api.json
src/static/swagger-admin.json
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ By default, `ENABLE_AUTHENTICATION` is set to off/`false`. To enable external Ve
2. `LOGTO_WEBHOOK_SECRET`: Webhook secret to authenticate incoming webhook requests from LogTo.
5. **Miscellaneous**
1. `COOKIE_SECRET`: Secret for cookie encryption.
2. `API_KEY_EXPIRATION` (optional): Expiration time for API keys in days. (Default 30 days)

#### Faucet settings

Expand Down
6 changes: 6 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ ARG LOGTO_WEBHOOK_SECRET
ARG ENABLE_DATADOG=false
ARG LOG_LEVEL=info

# API generation
ARG API_KEY_EXPIRATION=30

# Verida connector: build-time
ARG ENABLE_VERIDA_CONNECTOR=false
ARG POLYGON_RPC_URL=https://rpc.ankr.com/polygon_mumbai
Expand Down Expand Up @@ -118,6 +121,9 @@ ENV LOGTO_WEBHOOK_SECRET ${LOGTO_WEBHOOK_SECRET}
ENV ENABLE_DATADOG ${ENABLE_DATADOG}
ENV LOG_LEVEL ${LOG_LEVEL}

# API generatioin
ENV API_KEY_EXPIRATION ${API_KEY_EXPIRATION}

# Faucet setup
ENV ENABLE_ACCOUNT_TOPUP ${ENABLE_ACCOUNT_TOPUP}
ENV FAUCET_URI ${FAUCET_URI}
Expand Down
Loading

0 comments on commit c237502

Please sign in to comment.