Skip to content

Commit

Permalink
feat: [DEV-2619] Create workspace with frontend and backend packages (#…
Browse files Browse the repository at this point in the history
…212)

* feat: Add issuer apis

* feat: Add jsonld support

* docs: Update Readme

* build: Update did-provider-cheqd

* feat: Add controller db

* feat: Add authentication

* feat: Update swagger && refactor

* build: Update Dockerfile

* feat: Remove jsonLD

* feat: Minor updates

* feat: Create migrations in db

* build: Fix migration creation

* build: Add ca cert env

* fix: Update operation

* fix: Search operation in db

* feat: Update swagger

* feat: Update api paths

* feat: Minor fixes

* feat: Use monorepo structure

* feat: Add guard middleware

* feat: Update transition backend to ESM

* fix: Dockerfile permissions

* feat: Add frontend package [DEV-2620] (#211)

* chore(release): 1.5.1 [skip ci]

## [1.5.1](1.5.0...1.5.1) (2023-03-17)

* ci: Update CI and cache cleanup (#194)

* ci: Update CI and cache cleanup

* Update release.yml

* Update build.yml

* Update cleanup-cache.yml

* Update build.yml

* Bump package

* chore: Update package lock

* chore(release): 2.0.0-develop.3 [skip ci]

## [2.0.0-develop.3](2.0.0-develop.2...2.0.0-develop.3) (2023-04-03)

* chore(deps-dev): Bump semantic-release from 19.0.5 to 21.0.1 (#193)

Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 19.0.5 to 21.0.1.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](semantic-release/semantic-release@v19.0.5...v21.0.1)

---
updated-dependencies:
- dependency-name: semantic-release
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ankur Banerjee <ankurdotb@users.noreply.github.com>

* chore(deps-dev): Bump eslint-config-prettier from 8.5.0 to 8.8.0 (#191)

* chore(deps-dev): Bump eslint-config-prettier from 8.5.0 to 8.8.0

Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 8.5.0 to 8.8.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](prettier/eslint-config-prettier@v8.5.0...v8.8.0)

---
updated-dependencies:
- dependency-name: eslint-config-prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump package

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ankur Banerjee <ankurdotb@users.noreply.github.com>

* chore(deps-dev): Bump prettier from 2.8.1 to 2.8.7 (#190)

* chore(deps-dev): Bump prettier from 2.8.1 to 2.8.7

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.1 to 2.8.7.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](prettier/prettier@2.8.1...2.8.7)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* bump

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ankur Banerjee <ankurdotb@users.noreply.github.com>

* chore(deps): Bump webpack from 5.75.0 to 5.77.0 (#195)

* chore(deps): Bump webpack from 5.75.0 to 5.77.0

Bumps [webpack](https://github.com/webpack/webpack) from 5.75.0 to 5.77.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.75.0...v5.77.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update package.json

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ankur Banerjee <ankurdotb@users.noreply.github.com>

* Temporarily add logto auth

* Add frontend package

* Simplify the frontend to just showing the token

* feat: Update refactor frontend

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: DaevMithran <61043607+DaevMithran@users.noreply.github.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: Ankur Banerjee <ankurdotb@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: DaevMithran <daevmithran1999@gmail.com>

* fix: package-lock.json

* feat: [DEV-2621] Add API guarding (#218)

* chore(release): 1.5.1 [skip ci]

## [1.5.1](1.5.0...1.5.1) (2023-03-17)

* ci: Update CI and cache cleanup (#194)

* ci: Update CI and cache cleanup

* Update release.yml

* Update build.yml

* Update cleanup-cache.yml

* Update build.yml

* Bump package

* chore: Update package lock

* chore(release): 2.0.0-develop.3 [skip ci]

## [2.0.0-develop.3](2.0.0-develop.2...2.0.0-develop.3) (2023-04-03)

* chore(deps-dev): Bump semantic-release from 19.0.5 to 21.0.1 (#193)

Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 19.0.5 to 21.0.1.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](semantic-release/semantic-release@v19.0.5...v21.0.1)

---
updated-dependencies:
- dependency-name: semantic-release
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ankur Banerjee <ankurdotb@users.noreply.github.com>

* chore(deps-dev): Bump eslint-config-prettier from 8.5.0 to 8.8.0 (#191)

* chore(deps-dev): Bump eslint-config-prettier from 8.5.0 to 8.8.0

Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 8.5.0 to 8.8.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](prettier/eslint-config-prettier@v8.5.0...v8.8.0)

---
updated-dependencies:
- dependency-name: eslint-config-prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump package

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ankur Banerjee <ankurdotb@users.noreply.github.com>

* chore(deps-dev): Bump prettier from 2.8.1 to 2.8.7 (#190)

* chore(deps-dev): Bump prettier from 2.8.1 to 2.8.7

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.1 to 2.8.7.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](prettier/prettier@2.8.1...2.8.7)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* bump

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ankur Banerjee <ankurdotb@users.noreply.github.com>

* chore(deps): Bump webpack from 5.75.0 to 5.77.0 (#195)

* chore(deps): Bump webpack from 5.75.0 to 5.77.0

Bumps [webpack](https://github.com/webpack/webpack) from 5.75.0 to 5.77.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.75.0...v5.77.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update package.json

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ankur Banerjee <ankurdotb@users.noreply.github.com>

* Temporarily add logto auth

* Add frontend package

* Simplify the frontend to just showing the token

* Add API guarding middleware

* Remove unused code

* Move to generateHTML for swagger

* fix: git guardian warning

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: DaevMithran <61043607+DaevMithran@users.noreply.github.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: Ankur Banerjee <ankurdotb@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: DaevMithran <daevmithran1999@gmail.com>

* fix: Minor merge issues

* feat: Update frontend package.json

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: DaevMithran <daevmithran1999@gmail.com>
Co-authored-by: DaevMithran <61043607+DaevMithran@users.noreply.github.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: Ankur Banerjee <ankurdotb@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
6 people committed May 23, 2023
1 parent 1725ad0 commit 08e6a45
Show file tree
Hide file tree
Showing 113 changed files with 42,084 additions and 23,436 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
Expand Down
69 changes: 35 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
### STAGE 1: Build credential-service app ###
###############################################################

FROM node:18-alpine AS builder
FROM node:18-alpine AS runner

# Set working directory & bash defaults
WORKDIR /home/node/app
Expand All @@ -16,53 +16,54 @@ RUN npm ci
# Build the app
RUN npm run build

###############################################################
### STAGE 2: Build Miniflare runner ###
###############################################################

FROM node:18-alpine AS runner

# Set working directory & bash defaults
WORKDIR /home/node/app

# Copy built application
COPY --from=builder /home/node/app/dist .

# Build-time arguments
# Build-time arguments backend
ARG NODE_ENV=production
ARG NPM_CONFIG_LOGLEVEL=warn
ARG PORT=8787
ARG ISSUER_ID
ARG ISSUER_ID_PUBLIC_KEY_HEX
ARG ISSUER_ID_PRIVATE_KEY_HEX
ARG COSMOS_PAYER_MNEMONIC
ARG NETWORK_RPC_URL
ARG ISSUER_SECRET_KEY
ARG ISSUER_DATABASE_URL
ARG ISSUER_DATABASE_CERT
ARG MAINNET_RPC_URL
ARG TESTNET_RPC_URL
ARG RESOLVER_URL
ARG ALLOWED_ORIGINS

# Build-time arguments frontend
ARG PUBLIC_LOGTO_RESOURCE_API_URL
ARG PUBLIC_LOGTO_ENDPOINT
ARG PUBLIC_LOGTO_APP_ID
ARG LOGTO_MANAGEMENT_APP_ID
ARG LOGTO_MANAGEMENT_APP_SECRET
ARG LOGTO_RESOURCE_URL

# Run-time environment variables
# Run-time environment variables: backend
ENV NODE_ENV ${NODE_ENV}
ENV NPM_CONFIG_LOGLEVEL ${NPM_CONFIG_LOGLEVEL}
ENV PORT ${PORT}
ENV ISSUER_ID ISSUER_ID ${ISSUER_ID}
ENV ISSUER_ID_PUBLIC_KEY_HEX ${ISSUER_ID_PUBLIC_KEY_HEX}
ENV ISSUER_ID_PRIVATE_KEY_HEX ${ISSUER_ID_PRIVATE_KEY_HEX}
ENV COSMOS_PAYER_MNEMONIC ${COSMOS_PAYER_MNEMONIC}
ENV NETWORK_RPC_URL ${NETWORK_RPC_URL}
ENV ISSUER_SECRET_KEY ${ISSUER_SECRET_KEY}
ENV ISSUER_DATABASE_URL ${ISSUER_DATABASE_URL}
ENV ISSUER_DATABASE_CERT ${ISSUER_DATABASE_CERT}
ENV MAINNET_RPC_URL ${MAINNET_RPC_URL}
ENV TESTNET_RPC_URL ${TESTNET_RPC_URL}
ENV RESOLVER_URL ${RESOLVER_URL}
ENV ALLOWED_ORIGINS ${ALLOWED_ORIGINS}

# Run-time environment variables: frontend
ENV PUBLIC_LOGTO_RESOURCE_API_URL ${PUBLIC_LOGTO_RESOURCE_API_URL}
ENV PUBLIC_LOGTO_ENDPOINT ${PUBLIC_LOGTO_ENDPOINT}
ENV PUBLIC_LOGTO_APP_ID ${PUBLIC_LOGTO_APP_ID}
ENV LOGTO_MANAGEMENT_APP_ID ${LOGTO_MANAGEMENT_APP_ID}
ENV LOGTO_MANAGEMENT_APP_SECRET ${LOGTO_MANAGEMENT_APP_SECRET}
ENV LOGTO_RESOURCE_URL ${LOGTO_RESOURCE_URL}

# We don't have the node_modules directory
# this image only has the output worker.js file.
# Install pre-requisites
RUN npm install swagger-ui-express@4.5.0 && \
chown -R node:node /home/node/app && \
apk update && \
apk add --no-cache bash ca-certificates
RUN chown -R node:node /home/node/app/packages

# Specify default port
EXPOSE ${PORT}

# Set user and shell
USER node
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
SHELL ["/bin/sh", "-euo", "pipefail", "-c"]

# Run the application
CMD [ "node", "index.js" ]
CMD npm run backend
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,26 @@ npm run build

The application expects the following environment variables to be defined for the app to function:

1. `ISSUER_ID_PRIVATE_KEY_HEX`: Hex-encoded private key to be used by the identity credential issuer
2. `ISSUER_ID_PUBLIC_KEY_HEX`: Hex-encoded public key to be used by the identity credential issuer
3. `ISSUER_ID`: Fully-qualified DID for the issuer, e.g., `did:cheqd:mainnet:zAXwwqZzhCZA1L77ZBa8fhVNjL9MQCHX`
4. `COSMOS_PAYER_MNEMONIC`: Mnemonic for the issuer's Cosmos account. This currently doesn't require any balances at the moment, but it required for the library to function.
5. `NETWORK_RPC_URL`: Optional RPC URL for a node on cheqd network, e.g., `rpc.cheqd.net`
1. `ISSUER_DATABASE_URL`: The postgres database url e.g. `postgres://<user>:<password>@<host>:<port>/<database>?<query>`
2. `ISSUER_SECRET_KEY`: A secret key for the veramo wallet
3. `PORT`: Port number for the credential service (optional)
4. `FEE_PAYER_MNENONIC_TESTNET`: Mnemonic for the issuer's Cosmos account to be used for testnet.
5. `FEE_PAYER_MNENONIC_MAINNET`: Mnemonic for the issuer's Cosmos account to be used for mainnet.
6. `MAINNET_RPC_URL`: Optional RPC URL for a node on cheqd mainnet, e.g., `https://rpc.cheqd.net`
7. `TESTNET_RPC_URL`: Optional RPC URL for a node on cheqd testnet, e.g., `https://rpc.cheqd.network`
8. `ISSUER_DATABASE_CERT`: Optional ca certificate parameter of the database

### Run

Run a postgres instance

```bash
docker pull postgres
docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
```

Construct the postgres url and configure the env variables mentioned above

Once configured, the app can be run using NPM:

```bash
Expand Down
1 change: 1 addition & 0 deletions identity.keys
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"pub_key_base_64":"kG6kwvS/ND5Z3+nPCqBLVkk2B6OaCgi1wvBnRuj5Ge0=","priv_key_base_64":"+jFUmqWc6ydI9j+PeEnBoQrp23+bcExAp170JiGIYMiQbqTC9L80Plnf6c8KoEtWSTYHo5oKCLXC8GdG6PkZ7Q=="}
14 changes: 14 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"packages": ["packages/*"],
"version": "2.0.0-develop.2",
"useWorkspaces": true,
"npmClient": "npm",
"command": {
"version": {
"allowBranch": "main"
},
"publish": {
"graphType": "all"
}
}
}
Loading

0 comments on commit 08e6a45

Please sign in to comment.