Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/continuous-delivery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Continous Delivery

on:
push:
tags:
- 'v*'

env:
REGISTRY: ghcr.io
SERVICE: credo-controller

jobs:
build-and-push:
name: Push Docker image to GitHub
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

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

- name: Extract Git Tag
id: get_tag
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push Docker Image ${{ env.SERVICE }}
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.SERVICE }}:${{ env.TAG }}
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.SERVICE }}:latest

48 changes: 2 additions & 46 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,48 +1,3 @@
# FROM ubuntu:20.04

# ENV DEBIAN_FRONTEND noninteractive

# RUN apt-get update -y && apt-get install -y \
# software-properties-common \
# apt-transport-https \
# curl \
# # Only needed to build indy-sdk
# build-essential

# RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -

# # yarn
# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
# echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list

# # install depdencies
# RUN apt-get update -y && apt-get install -y --allow-unauthenticated \
# nodejs

# # install depdencies
# RUN apt-get update -y && apt-get install -y --allow-unauthenticated \
# nodejs

# # Install yarn seperately due to `no-install-recommends` to skip nodejs install
# RUN apt-get install -y --no-install-recommends yarn

# RUN yarn global add patch-package
# # AFJ specifc setup
# WORKDIR /www

# COPY bin ./bin
# COPY package.json ./package.json
# COPY patches ./patches

# RUN yarn install --production

# COPY build ./build
# # COPY libindy_vdr.so /usr/lib/
# # COPY libindy_vdr.so /usr/local/lib/

# ENTRYPOINT [ "./bin/afj-rest.js", "start" ]


# Stage 1: Builder stage
FROM node:18.19.0 AS builder

Expand All @@ -55,6 +10,7 @@ COPY package.json yarn.lock ./
COPY . .

# Install dependencies
RUN rm -rf node_modules
RUN yarn install --frozen-lockfile

RUN yarn global add patch-package
Expand All @@ -75,4 +31,4 @@ COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/patches ./patches

# Set entry point
ENTRYPOINT ["node", "./bin/afj-rest.js", "start"]
ENTRYPOINT ["node", "./bin/afj-rest.js", "start"]
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"@tsoa/runtime": "^6.0.0",
"@types/node-fetch": "^2.6.4",
"@types/ref-struct-di": "^1.1.9",
"@types/uuid": "^8.3.3",
"@types/ws": "^8.5.4",
"axios": "^1.4.0",
"body-parser": "^1.20.0",
Expand All @@ -71,7 +72,9 @@
"tslog": "^3.3.3",
"tsoa": "^6.0.1",
"tsyringe": "^4.8.0",
"yargs": "^17.3.1"
"uuidv4": "^6.2.13",
"yargs": "^17.3.1",
"zlib": "^1.0.5"
},
"devDependencies": {
"@types/body-parser": "^1.19.2",
Expand All @@ -86,7 +89,6 @@
"@types/ref-struct-di": "^1.1.9",
"@types/supertest": "^2.0.12",
"@types/swagger-ui-express": "^4.1.3",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "^6.19.1",
"@typescript-eslint/parser": "^6.19.1",
"eslint": "^7.32.0",
Expand Down
11 changes: 10 additions & 1 deletion src/controllers/multi-tenancy/MultiTenancyController.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable prettier/prettier */
import type { RestAgentModules, RestMultiTenantAgentModules } from '../../cliAgent'
import type { Version } from '../examples'
import type { RecipientKeyOption, SchemaMetadata } from '../types'
Expand Down Expand Up @@ -49,7 +50,15 @@ import { QuestionAnswerRole, QuestionAnswerState } from '@credo-ts/question-answ
import axios from 'axios'
import * as fs from 'fs'

import { CredentialEnum, DidMethod, EndorserMode, Network, NetworkTypes, Role, SchemaError } from '../../enums/enum'
import {
CredentialEnum,
DidMethod,
EndorserMode,
Network,
NetworkTypes,
Role,
SchemaError,
} from '../../enums/enum'
import ErrorHandlingService from '../../errorHandlingService'
import { ENDORSER_DID_NOT_PRESENT } from '../../errorMessages'
import {
Expand Down
114 changes: 110 additions & 4 deletions src/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ const models: TsoaRoute.Models = {
"DidCreate": {
"dataType": "refObject",
"properties": {
"keyType": {"ref":"KeyType","required":true},
"keyType": {"ref":"KeyType"},
"seed": {"dataType":"string"},
"domain": {"dataType":"string"},
"method": {"dataType":"string","required":true},
Expand Down Expand Up @@ -585,6 +585,7 @@ const models: TsoaRoute.Models = {
"issuanceDate": {"dataType":"string","required":true},
"expirationDate": {"dataType":"string"},
"credentialSubject": {"ref":"SingleOrArray_JsonObject_","required":true},
"prettyVc": {"dataType":"any"},
},
"additionalProperties": {"dataType":"any"},
},
Expand Down Expand Up @@ -1128,6 +1129,31 @@ const models: TsoaRoute.Models = {
"additionalProperties": false,
},
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
"CredentialFormatDataMessagePayload__40_LegacyIndyCredentialFormat-or-JsonLdCredentialFormat-or-AnonCredsCredentialFormat_41_-Array.proposal_": {
"dataType": "refAlias",
"type": {"dataType":"nestedObjectLiteral","nestedProperties":{},"validators":{}},
},
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
"CredentialFormatDataMessagePayload__40_LegacyIndyCredentialFormat-or-JsonLdCredentialFormat-or-AnonCredsCredentialFormat_41_-Array.offer_": {
"dataType": "refAlias",
"type": {"dataType":"nestedObjectLiteral","nestedProperties":{},"validators":{}},
},
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
"CredentialFormatDataMessagePayload__40_LegacyIndyCredentialFormat-or-JsonLdCredentialFormat-or-AnonCredsCredentialFormat_41_-Array.request_": {
"dataType": "refAlias",
"type": {"dataType":"nestedObjectLiteral","nestedProperties":{},"validators":{}},
},
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
"CredentialFormatDataMessagePayload__40_LegacyIndyCredentialFormat-or-JsonLdCredentialFormat-or-AnonCredsCredentialFormat_41_-Array.credential_": {
"dataType": "refAlias",
"type": {"dataType":"nestedObjectLiteral","nestedProperties":{},"validators":{}},
},
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
"GetCredentialFormatDataReturn__40_LegacyIndyCredentialFormat-or-JsonLdCredentialFormat-or-AnonCredsCredentialFormat_41_-Array_": {
"dataType": "refAlias",
"type": {"dataType":"nestedObjectLiteral","nestedProperties":{"credential":{"ref":"CredentialFormatDataMessagePayload__40_LegacyIndyCredentialFormat-or-JsonLdCredentialFormat-or-AnonCredsCredentialFormat_41_-Array.credential_"},"request":{"ref":"CredentialFormatDataMessagePayload__40_LegacyIndyCredentialFormat-or-JsonLdCredentialFormat-or-AnonCredsCredentialFormat_41_-Array.request_"},"offerAttributes":{"dataType":"array","array":{"dataType":"refObject","ref":"CredentialPreviewAttributeOptions"}},"offer":{"ref":"CredentialFormatDataMessagePayload__40_LegacyIndyCredentialFormat-or-JsonLdCredentialFormat-or-AnonCredsCredentialFormat_41_-Array.offer_"},"proposal":{"ref":"CredentialFormatDataMessagePayload__40_LegacyIndyCredentialFormat-or-JsonLdCredentialFormat-or-AnonCredsCredentialFormat_41_-Array.proposal_"},"proposalAttributes":{"dataType":"array","array":{"dataType":"refObject","ref":"CredentialPreviewAttributeOptions"}}},"validators":{}},
},
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
"BasicMessageRecord": {
"dataType": "refAlias",
"type": {"ref":"Record_string.unknown_","validators":{}},
Expand All @@ -1149,11 +1175,18 @@ const templateService = new ExpressTemplateService(models, {"noImplicitAdditiona

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa




export function RegisterRoutes(app: Router) {

// ###########################################################################################################
// NOTE: If you do not see routes for all of your controllers in this file, then you might not have informed tsoa of where to look
// Please look into the "controllerPathGlobs" config option described in the readme: https://github.com/lukeautry/tsoa
// ###########################################################################################################



app.get('/proofs',
authenticateMiddleware([{"apiKey":[]}]),
...(fetchMiddlewares<RequestHandler>(ProofController)),
Expand Down Expand Up @@ -2468,7 +2501,7 @@ export function RegisterRoutes(app: Router) {
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.post('/multi-tenancy/polygon-wc3/schema/:tenantId',
app.post('/multi-tenancy/polygon-w3c/schema/:tenantId',
authenticateMiddleware([{"apiKey":[]}]),
...(fetchMiddlewares<RequestHandler>(MultiTenancyController)),
...(fetchMiddlewares<RequestHandler>(MultiTenancyController.prototype.createPolygonW3CSchema)),
Expand Down Expand Up @@ -2505,7 +2538,7 @@ export function RegisterRoutes(app: Router) {
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.get('/multi-tenancy/polygon-wc3/schema/:did/:schemaId/:tenantId',
app.get('/multi-tenancy/polygon-w3c/schema/:did/:schemaId/:tenantId',
authenticateMiddleware([{"apiKey":[]}]),
...(fetchMiddlewares<RequestHandler>(MultiTenancyController)),
...(fetchMiddlewares<RequestHandler>(MultiTenancyController.prototype.getPolygonW3CSchemaById)),
Expand Down Expand Up @@ -2878,6 +2911,43 @@ export function RegisterRoutes(app: Router) {
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.get('/multi-tenancy/credentials/form-data/:tenantId/:credentialRecordId',
authenticateMiddleware([{"apiKey":[]}]),
...(fetchMiddlewares<RequestHandler>(MultiTenancyController)),
...(fetchMiddlewares<RequestHandler>(MultiTenancyController.prototype.credentialFormData)),

async function MultiTenancyController_credentialFormData(request: ExRequest, response: ExResponse, next: any) {
const args: Record<string, TsoaRoute.ParameterSchema> = {
tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"},
credentialRecordId: {"in":"path","name":"credentialRecordId","required":true,"dataType":"string"},
};

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

let validatedArgs: any[] = [];
try {
validatedArgs = templateService.getValidatedArgs({ args, request, response });

const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer;

const controller: any = await container.get<MultiTenancyController>(MultiTenancyController);
if (typeof controller['setStatus'] === 'function') {
controller.setStatus(undefined);
}

await templateService.apiHandler({
methodName: 'credentialFormData',
controller,
response,
next,
validatedArgs,
successStatus: undefined,
});
} catch (err) {
return next(err);
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.get('/multi-tenancy/proofs/:tenantId',
authenticateMiddleware([{"apiKey":[]}]),
...(fetchMiddlewares<RequestHandler>(MultiTenancyController)),
Expand Down Expand Up @@ -4234,6 +4304,42 @@ export function RegisterRoutes(app: Router) {
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.get('/credentials/:credentialRecordId/form-data',
authenticateMiddleware([{"apiKey":[]}]),
...(fetchMiddlewares<RequestHandler>(CredentialController)),
...(fetchMiddlewares<RequestHandler>(CredentialController.prototype.credentialFormData)),

async function CredentialController_credentialFormData(request: ExRequest, response: ExResponse, next: any) {
const args: Record<string, TsoaRoute.ParameterSchema> = {
credentialRecordId: {"in":"path","name":"credentialRecordId","required":true,"dataType":"string"},
};

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

let validatedArgs: any[] = [];
try {
validatedArgs = templateService.getValidatedArgs({ args, request, response });

const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer;

const controller: any = await container.get<CredentialController>(CredentialController);
if (typeof controller['setStatus'] === 'function') {
controller.setStatus(undefined);
}

await templateService.apiHandler({
methodName: 'credentialFormData',
controller,
response,
next,
validatedArgs,
successStatus: undefined,
});
} catch (err) {
return next(err);
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.get('/connections',
authenticateMiddleware([{"apiKey":[]}]),
...(fetchMiddlewares<RequestHandler>(ConnectionController)),
Expand Down Expand Up @@ -4822,4 +4928,4 @@ export function RegisterRoutes(app: Router) {
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
}

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
Loading