Skip to content
Snippets Groups Projects
Commit a886aafe authored by zdravko iliev's avatar zdravko iliev
Browse files

init monorepo

parent 5e5aebc3
No related branches found
No related tags found
No related merge requests found
Showing
with 2168 additions and 1 deletion
node_modules
.git
.gitignore
*.md
dist
\ No newline at end of file
root = true
[*]
end_of_line = lf
insert_final_newline = true
[*.{js,json,yml}]
charset = utf-8
indent_style = space
indent_size = 2
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
# Swap the comments on the following lines if you don't wish to use zero-installs
# Documentation here: https://yarnpkg.com/features/zero-installs
# !.yarn/cache
.pnp.*
node_modules
.idea
**/*.env
# compiled output
node_modules/
apps/*/node_modules
/dist
/apps/**/dist/
# Logs
/logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
logs/log.json
# OS
.DS_Store
# Tests
/coverage
/.nyc_output
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
#Env files
**/*.env
!config/env/development.env
.idea
Initial commit
\ No newline at end of file
# ocm-engine version 1
#### Dependencies
Node 12
Python 2.5.0 >= <3.0.0
### Installation
yarn
Dockerfile
Jenkinsfile
coverage
docker-compose.yml
docs
node_modules
yarn-error.log
*.md
!README.md
.circle*
.codecov*
.coveralls*
.dockerignore
.drone*
.editorconfig
# .env
.git*
.huskyrc*
.lintstagedrc*
.npmignore
.prettierrc*
dist
\ No newline at end of file
PORT=3005
DATABASE_URL=postgresql://root:password@localhost:5432/postgres?schema=attestation
ECSURL=http://localhost:9200/
ACCEPT_MEMBERSHIP_CREDENTIALS_CONFIG = AUTO
NATS_URL=nats://localhost:4222
AGENT_URL=http://localhost:3010
TSA_URL=https://gaiax.vereign.com/tsa/policy/policy/example
USE_AUTH=false
OAUTH_CLIENT_ID=clientid
OAUTH_CLIENT_SECRET=clientsecret
OAUTH_TOKEN_URL=https://tokenurl
\ No newline at end of file
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'airbnb-base',
'airbnb-typescript/base'
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
"@typescript-eslint/ban-ts-comment": "off",
"prefer-spread": "off"
},
};
{
"singleQuote": true,
"trailingComma": "all"
}
\ No newline at end of file
# GDPR Compliance Document
The objective of this document is to detail, the data being stored and proccessed by the Organization Credential Manager's, Attestation Manger.
## What information is stored
### Source User Information
The Open Id connect claims that MAY contain all sorts of personal data (like email, name, age and others), are received from any external source.
### Technical User Information (Public)
- Schema information (public)
- Credential/credential definition ids and states
- DID of issuer
- DID of holder
- Created/updated dates
- Offered credential attributes and attachments
## How is the information stored
### Source User Information
Source User Information is encrypted using the Private Key of the Organizations SSI Agent and stored until the issuance of credential in Organization's SSI Agent's PostgreSQL database.
### Technical User Information (Public)
Technical User Information is encrypted using the Private Key of the Organizations SSI Agent and stored internally (on the agent) on PostgreSQL and externally/ metadata (shared between the OCM services) on PostgreSQL of Organization.
## Who can access the information
The Source User Information and Technical User Information both are accessible only by the Organization specific SSI agent's private key.
## How long will the information stay
### Source User Information
The Source User Information is wiped out once the credential is issued.
### Technical User Information (Public)
The Technical User Information is wiped out according to the retention periods (not defined yet).
This diff is collapsed.
# OCM Attestation Manager
## Description
<hr/>
The Attestation Manager is the microservice responsible for handling the features related to Issuance of Credentials. It handles REST endpoints for Schemas, Credential Definitions and Verifiable Credentials.
## Usage
<hr/>
### Swagger Documentation:
[Swagger/OpenAPI](swagger.json)
## Installation
<hr/>
### Pre-requisite
* yarn
* docker
* docker-compose
* PostgreSQL
### OCM Services Dependencies
* SSI Abstraction
* Connection Manager
## Running the app
**Each service in the Organizational Credential Manager can be run from the infrastructure repository with Docker.**
**The .env files are in the infrastructure repository under /env**
```bash
## production in:
./deployment/ci
## development in:
./deployment/dev
```
* (optional) Edit docker-compose.yml in "infrastructure" to use either **/ci/** or **/dev/** Dockerfiles.
* Run while in **"infrastructure"** project:
```bash
$ docker-compose up --build attestation-m
```
to run only Attestation Manager or
```bash
$ docker-compose up --build
```
to run all the services.
## Build
```
yarn build
```
## Run
```
yarn start
```
### Environment Variables Required
```
1. PORT
2. DATABASE_URL
3. ECSURL
4. NATS_URL
5. AGENT_URL
```
### Outgoing communication services
```
1. SSI Abstraction
```
### Incomming communication services
```
1. Principal Manager
```
### Features supported
```
1. Create Schema
2. Create Credential Definition
3. Offer Credentials
4. Propose Credentials
5. Accept Credential
```
## Test
<hr/>
```bash
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
```
## GDPR
<hr/>
[GDPR](GDPR.md)
## Dependencies
<hr/>
[Dependencies](package.json)
## License
<hr/>
[Apache 2.0 license](LICENSE)
const config = () => ({
PORT: Number(process.env.PORT),
nats: {
url: process.env.NATS_URL,
},
auth: {
useAuth: process.env.USE_AUTH || 'false',
clientId: process.env.OAUTH_CLIENT_ID,
clientSecret: process.env.OAUTH_CLIENT_SECRET,
tokenUrl: process.env.OAUTH_TOKEN_URL,
},
agent: {
AGENT_URL: process.env.AGENT_URL,
},
DATABASE: {
type: 'postgres',
port: 5432,
synchronize: false,
logging: false,
entities: [`${__dirname}/../**/**.model{.ts,.js}`],
},
ECSURL: process.env.ECSURL,
ACCEPT_MEMBERSHIP_CREDENTIALS_CONFIG: process.env.ACCEPT_MEMBERSHIP_CREDENTIALS_CONFIG,
TSA_URL: process.env.TSA_URL,
});
export default config;
import * as Joi from 'joi';
const validationSchema = Joi.object({
DATABASE_URL: Joi.string().required(),
AGENT_URL: Joi.string().required(),
NATS_URL: Joi.string().required(),
PORT: Joi.number().required(),
ACCEPT_MEMBERSHIP_CREDENTIALS_CONFIG: Joi.string().required(),
USE_AUTH: Joi.string(),
OAUTH_CLIENT_ID: Joi.string(),
OAUTH_CLIENT_SECRET: Joi.string(),
OAUTH_TOKEN_URL: Joi.string(),
});
export default validationSchema;
FROM node:20-alpine3.16 AS builder
WORKDIR /usr/src/app
RUN yarn global add @nestjs/cli
COPY package.json ./
COPY yarn.lock ./
# --prod works if @types/node is in deps (not devDeps)
RUN yarn --frozen-lockfile --prod
COPY . .
RUN yarn prisma:generate
RUN yarn build
FROM node:14-alpine3.15
ENV PATH /usr/src/app/node_modules/.bin:$PATH
WORKDIR /usr/src/app
COPY --from=builder /usr/src/app/dist ./dist
COPY --from=builder /usr/src/app/start.sh ./start.sh
COPY --from=builder /usr/src/app/node_modules ./node_modules
COPY --from=builder /usr/src/app/src/prisma prisma
EXPOSE 3005
RUN chmod +x ./start.sh
CMD ["./start.sh"]
FROM node:14-alpine3.15
WORKDIR /usr/src/app
ENV PATH /usr/src/app/node_modules/.bin:$PATH
COPY package.json ./
COPY yarn.lock ./
COPY . .
RUN yarn
RUN yarn prisma:generate
EXPOSE 3005
CMD ["yarn", "start:docker"]
{
"collection": "@nestjs/schematics",
"sourceRoot": "src"
}
{
"name": "attestation-manager",
"version": "0.0.1",
"description": "",
"author": "Shirdhar",
"private": true,
"license": "Apache-2.0",
"scripts": {
"clean": "rm -r dist",
"prebuild": "rimraf dist",
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"dbSchema": "npx prisma db push --schema=./src/prisma/schema.prisma",
"prisma:generate": "prisma generate --schema=./src/prisma/schema.prisma",
"prisma:migrate": "npx prisma migrate deploy --schema=./src/prisma/schema.prisma",
"prismaStudio": "npx prisma studio",
"start": "nest start",
"start:docker": "yarn prisma:generate && yarn dbSchema && yarn start",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@elastic/ecs-winston-format": "^1.3.1",
"@nestjs/axios": "0.0.5",
"@nestjs/common": "^8.0.0",
"@nestjs/config": "^1.1.6",
"@nestjs/core": "^8.0.0",
"@nestjs/mapped-types": "*",
"@nestjs/microservices": "^8.2.6",
"@nestjs/platform-express": "^8.0.0",
"@nestjs/swagger": "^5.2.0",
"@nestjs/terminus": "^8.0.4",
"@prisma/client": "^3.9.2",
"@types/express": "^4.17.13",
"@types/jest": "27.0.2",
"@types/jsonwebtoken": "^8.5.9",
"@types/node": "^16.0.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.13.2",
"express": "^4.17.3",
"husky": "^7.0.4",
"joi": "^17.6.0",
"jsonwebtoken": "^8.5.1",
"jwks-rsa": "^3.0.0",
"liquibase": "^4.4.0",
"moment": "^2.29.1",
"nats": "^2.6.0",
"pg": "^8.7.3",
"prisma": "^3.9.2",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0",
"swagger-ui-express": "^4.3.0",
"winston": "^3.6.0",
"winston-elasticsearch": "^0.16.1"
},
"devDependencies": {
"@nestjs/cli": "^8.0.0",
"@nestjs/schematics": "^8.0.0",
"@nestjs/testing": "^8.0.0",
"@types/supertest": "^2.0.11",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"dotenv-cli": "^4.1.1",
"eslint": "^8.0.1",
"eslint-config-airbnb-typescript": "^16.1.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.2.5",
"node-mocks-http": "^1.11.0",
"prettier": "^2.3.2",
"source-map-support": "^0.5.20",
"supertest": "^6.1.3",
"ts-jest": "^27.0.3",
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"tsconfig-paths": "^3.10.1",
"typescript": "^4.3.5"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"setupFiles": [
"<rootDir>/../setup.js"
],
"coveragePathIgnorePatterns": [
"<rootDir>/main",
"<rootDir>/client/",
"<rootDir>/common/"
],
"moduleNameMapper": {
"^@config/(.*)$": [
"<rootDir>/../config/$1"
],
"^@credentialDef/(.*)$": "<rootDir>/credentialDef/$1",
"^@issueCredential/(.*)$": "<rootDir>/issue-credential/$1",
"^@schemas/(.*)$": "<rootDir>/schemas/$1",
"^@userInfo/(.*)$": "<rootDir>/userInfo/$1",
"^@src/(.*)$": "<rootDir>/$1",
"^@DB/(.*)$": "<rootDir>/prisma/$1",
"^@common/(.*)$": "<rootDir>/common/$1",
"^@utils/(.*)$": "<rootDir>/utils/$1",
"^@health/(.*)$": "<rootDir>/health/$1"
},
"rootDir": "src",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
process.env.PORT=3005
process.env.NODE_ENV='development'
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment