Skip to content

Commit

Permalink
Merge branch 'keyshade-xyz:develop' into issue-176
Browse files Browse the repository at this point in the history
  • Loading branch information
kash2104 authored Nov 10, 2024
2 parents 98ca8e5 + 1793d92 commit f3b650a
Show file tree
Hide file tree
Showing 144 changed files with 3,634 additions and 348 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/validate-api-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,7 @@ jobs:
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
version: 'v0.1.15'
with:
flags: api-client
files: /coverage/packages/api-client/coverage-final.json
3 changes: 2 additions & 1 deletion .github/workflows/validate-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
version: 'v0.1.15'
with:
flags: api-e2e-tests
files: /coverage-e2e/api/coverage-final.json
files: /coverage/apps/api/coverage-final.json
68 changes: 68 additions & 0 deletions .github/workflows/validate-schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Validate Schema

on:
push:
branches:
- '!develop'
- '!main'
paths: ['packages/schema/**', '.github/workflows/validate-schema.yml']
pull_request:
paths: ['packages/schema/**', '.github/workflows/validate-schema.yml']

jobs:
validate:
runs-on: ubuntu-latest
name: Validate Schema

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.2.0
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install packages
run: |
pnpm i
- name: Lint
run: |
pnpm run lint:schema
- name: Build
run: |
pnpm run build:schema
- name: Test
run: |
pnpm run test:schema
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
version: 'v0.1.15'
with:
flags: schema
files: /coverage/packages/schema/coverage-final.json
36 changes: 36 additions & 0 deletions api-collection/Api Key Controller/Can access live updates.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
meta {
name: Can access live updates
type: http
seq: 5
}

get {
url: {{BASE_URL}}/api/api-key/access/live-updates
body: none
auth: apikey
}

auth:apikey {
key: x-keyshade-token
value: {{vault:API_KEY}}
placement: header
}

docs {
## Description

This endpoint is specific to the keyshade CLI. In order for `keyshade run` to be successful, it needs to check that the API key has access to the following authorities or not:

- `READ_WORKSPACE`

- `READ_PROJECT`

- `READ_ENVIRONMENT`

- `READ_SECRET`

- `READ_VARIABLE`


If this is satisfied, the client can proceed.
}
43 changes: 43 additions & 0 deletions api-collection/Api Key Controller/Create API key.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
meta {
name: Create API key
type: http
seq: 1
}

post {
url: {{BASE_URL}}/api/api-key
body: json
auth: bearer
}

auth:bearer {
token: {{JWT}}
}

body:json {
{
"name": "My key",
"authorities": [
"READ_API_KEY",
"READ_WORKSPACE",
"READ_PROJECT",
"READ_ENVIRONMENT",
"READ_VARIABLE",
"READ_SECRET"
]
}
}

docs {
## Description

Allows users to create an API key that allows them to access keyshade API using any REST client.

### Request Body

- `name`: The name of the API key

- `expiresAfter`: (Optional) The amount of time after which the API key will expire. Defaults to \`never\`. Accepts: `'24' | '168' | '720' | '8760'`. Durations are in hours.

- `authorities`: (Optional) An array of authorities that are allowed for this API key. Defaults to \`\[\]\`
}
25 changes: 25 additions & 0 deletions api-collection/Api Key Controller/Delete API key.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
meta {
name: Delete API key
type: http
seq: 6
}

delete {
url: {{BASE_URL}}/api/api-key/:api_key_slug
body: none
auth: bearer
}

params:path {
api_key_slug: my-key-zxvie
}

auth:bearer {
token: {{JWT}}
}

docs {
## Description

Deletes an API key
}
25 changes: 25 additions & 0 deletions api-collection/Api Key Controller/Get API key.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
meta {
name: Get API key
type: http
seq: 3
}

get {
url: {{BASE_URL}}/api/api-key/:api_key_slug
body: none
auth: bearer
}

params:path {
api_key_slug: my-key-zxvies
}

auth:bearer {
token: {{JWT}}
}

docs {
## Description

Fetch an API key by its slug.
}
21 changes: 21 additions & 0 deletions api-collection/Api Key Controller/Get API keys.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
meta {
name: Get API keys
type: http
seq: 4
}

get {
url: {{BASE_URL}}/api/api-key
body: none
auth: bearer
}

auth:bearer {
token: {{JWT}}
}

docs {
## Description

Fetches all the API keys
}
49 changes: 49 additions & 0 deletions api-collection/Api Key Controller/Update API key.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
meta {
name: Update API key
type: http
seq: 2
}

put {
url: {{BASE_URL}}/api/api-key/:api_key_slug
body: json
auth: bearer
}

params:path {
api_key_slug: my-key-2
}

auth:bearer {
token: {{JWT}}
}

body:json {
{
"authorities": [
"READ_API_KEY",
"READ_WORKSPACE",
"READ_PROJECT",
"READ_ENVIRONMENT",
"READ_VARIABLE",
"READ_SECRET",
"CREATE_WORKSPACE",
"UPDATE_WORKSPACE",
"DELETE_WORKSPACE",
"WORKSPACE_ADMIN"
]
}
}

docs {
## Description

Allows users to update an API key.

### Request Body

- `name`: (Optional) The name of the API key. Note that, changing the name would also change the slug of the api key.

- `expiresAfter`: (Optional) The amount of time after which the API key will expire. Defaults to \`never\`. Accepts: `'24' | '168' | '720' | '8760'`. Durations are in hours.
- `authorities`: (Optional) An array of authorities that are allowed for this API key. Defaults to \`\[\]\`
}
6 changes: 6 additions & 0 deletions api-collection/Api Key Controller/bruno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": "1",
"name": "Api Key Controller",
"type": "collection",
"ignore": ["node_modules", ".git"]
}
7 changes: 7 additions & 0 deletions api-collection/Api Key Controller/collection.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
meta {
name: Api Kei Controller
}

auth {
mode: none
}
15 changes: 15 additions & 0 deletions api-collection/Auth Controller/GitHub auth.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
meta {
name: GitHub auth
type: http
seq: 3
}

get {
url: {{BASE_URL}}/api/auth/github
body: none
auth: none
}

docs {
This endpoint validates Github OAuth. If the OAuth is valid, it returns a valid token along with the user details
}
15 changes: 15 additions & 0 deletions api-collection/Auth Controller/GitLab auth.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
meta {
name: GitLab auth
type: http
seq: 4
}

get {
url: {{BASE_URL}}/api/auth/gitlab
body: none
auth: none
}

docs {
This endpoint validates GitLab OAuth. If the OAuth is valid, it returns a valid token along with the user details
}
15 changes: 15 additions & 0 deletions api-collection/Auth Controller/Google auth.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
meta {
name: Google auth
type: http
seq: 5
}

get {
url: {{BASE_URL}}/api/auth/google
body: none
auth: none
}

docs {
This endpoint validates Google OAuth. If the OAuth is valid, it returns a valid token along with the user details
}
25 changes: 25 additions & 0 deletions api-collection/Auth Controller/Send OTP.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
meta {
name: Send OTP
type: http
seq: 1
}

post {
url: {{BASE_URL}}/api/auth/send-otp/:email
body: none
auth: none
}

params:query {
~:
}

params:path {
email: [email protected]
}

docs {
## Description

This endpoint sends OTPs to an email address. The OTP can then be used to generate valid tokens
}
Loading

0 comments on commit f3b650a

Please sign in to comment.