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 Dockerfiles/Dockerfile.oid4vc-issuance
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Stage 1: Build the application
FROM node:18-alpine as build
# Install OpenSSL
RUN apk add --no-cache openssl
RUN npm install -g pnpm
# Set the working directory
WORKDIR /app

# Copy package.json and package-lock.json
COPY package.json ./
#COPY package-lock.json ./

ENV PUPPETEER_SKIP_DOWNLOAD=true

# Install dependencies while ignoring scripts (including Puppeteer's installation)
RUN pnpm i --ignore-scripts

# Copy the rest of the application code
COPY . .
# RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate
RUN cd libs/prisma-service && npx prisma generate

# Build the issuance service
RUN pnpm run build issuance

# Stage 2: Create the final image
FROM node:18-alpine
# Install OpenSSL
RUN apk add --no-cache openssl
# RUN npm install -g pnpm
# Set the working directory
WORKDIR /app

# Copy the compiled code from the build stage
COPY --from=build /app/dist/apps/oid4vc-issuance/ ./dist/apps/oid4vc-issuance/

# Copy the libs folder from the build stage
COPY --from=build /app/libs/ ./libs/
#COPY --from=build /app/package.json ./
COPY --from=build /app/node_modules ./node_modules
# COPY --from=build /app/uploadedFiles ./uploadedFiles


# Set the command to run the microservice
CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && cd ../.. && node dist/apps/oid4vc-issuance/main.js"]
41 changes: 32 additions & 9 deletions apps/agent-service/src/agent-service.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,37 +324,60 @@ export class AgentServiceController {
return this.agentServiceService.getAgentDetails(payload.orgId);
}

@MessagePattern({ cmd: 'agent-create-oidc-issuer' })
@MessagePattern({ cmd: 'agent-create-oid4vc-issuer' })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async oidcIssuerCreate(payload: { issuerCreation; url: string; orgId: string }): Promise<any> {
return this.agentServiceService.oidcIssuerCreate(payload.issuerCreation, payload.url, payload.orgId);
}
@MessagePattern({ cmd: 'delete-oidc-issuer' })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async oidcDeleteIssuer(payload: { url: string; orgId: string }): Promise<any> {
@MessagePattern({ cmd: 'delete-oid4vc-issuer' })
async oidcDeleteIssuer(payload: { url: string; orgId: string }): Promise<object | string> {
return this.agentServiceService.deleteOidcIssuer(payload.url, payload.orgId);
}
@MessagePattern({ cmd: 'agent-create-oidc-template' })
@MessagePattern({ cmd: 'agent-create-oid4vc-template' })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async oidcIssuerTemplate(payload: { templatePayload; url: string; orgId: string }): Promise<any> {
return this.agentServiceService.oidcIssuerTemplate(payload.templatePayload, payload.url, payload.orgId);
}
//TODO: change message for oidc
@MessagePattern({ cmd: 'oidc-get-issuer-by-id' })
//TODO: change message for oid4vc
@MessagePattern({ cmd: 'oid4vc-get-issuer-by-id' })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async oidcGetIssuerById(payload: { url: string; orgId: string }): Promise<any> {
return this.agentServiceService.oidcGetIssuerById(payload.url, payload.orgId);
}

@MessagePattern({ cmd: 'oidc-get-issuers' })
@MessagePattern({ cmd: 'oid4vc-get-issuers-agent-service' })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async oidcGetIssuers(payload: { url: string; orgId: string }): Promise<any> {
return this.agentServiceService.oidcGetIssuers(payload.url, payload.orgId);
}

@MessagePattern({ cmd: 'agent-service-oidc-create-credential-offer' })
@MessagePattern({ cmd: 'agent-service-oid4vc-create-credential-offer' })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async oidcCreateCredentialOffer(payload: { credentialPayload; url: string; orgId: string }): Promise<any> {
return this.agentServiceService.oidcCreateCredentialOffer(payload.credentialPayload, payload.url, payload.orgId);
}

@MessagePattern({ cmd: 'agent-service-oid4vc-update-credential-offer' })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async oidcUpdateCredentialOffer(payload: { issuanceMetadata; url: string; orgId: string }): Promise<any> {
return this.agentServiceService.oidcUpdateCredentialOffer(payload.issuanceMetadata, payload.url, payload.orgId);
}

@MessagePattern({ cmd: 'agent-service-oid4vc-get-credential-offer-by-id' })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async oidcGetCredentialOfferById(payload: { url: string; orgId: string; offerId: string }): Promise<any> {
return this.agentServiceService.oidcGetCredentialOfferById(payload.url, payload.orgId);
}

@MessagePattern({ cmd: 'agent-service-oid4vc-get-all-credential-offers' })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async oidcGetAllCredentialOffers(payload: { url: string; orgId: string }): Promise<any> {
return this.agentServiceService.oidcGetAllCredentialOffers(payload.url, payload.orgId);
}

@MessagePattern({ cmd: 'agent-service-oid4vc-delete-credential-offer' })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async oidcDeleteCredentialOffer(payload: { url: string; orgId: string }): Promise<any> {
return this.agentServiceService.oidcDeleteCredentialOffer(payload.url, payload.orgId);
}
}
64 changes: 59 additions & 5 deletions apps/agent-service/src/agent-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1423,13 +1423,15 @@ export class AgentServiceService {
}
}

async deleteOidcIssuer(url: string, orgId: string): Promise<object> {
async deleteOidcIssuer(url: string, orgId: string): Promise<object | string> {
try {
const getApiKey = await this.getOrgAgentApiKey(orgId);
const data = await this.commonService
.httpDelete(url, { headers: { authorization: getApiKey } })
.then(async (response) => response);
return data;
const response = await this.commonService.httpDelete(url, {
headers: { authorization: getApiKey }
});
if (response?.status === 204) {
return 'Data deleted successfully';
}
} catch (error) {
this.logger.error(`Error in deleteOidcIssuer in agent service : ${JSON.stringify(error)}`);
throw error;
Expand Down Expand Up @@ -1475,6 +1477,58 @@ export class AgentServiceService {
}
}

async oidcUpdateCredentialOffer(issuanceMetadata, url: string, orgId: string): Promise<object> {
try {
const getApiKey = await this.getOrgAgentApiKey(orgId);
const data = await this.commonService
.httpPut(url, issuanceMetadata, { headers: { authorization: getApiKey } })
.then(async (response) => response);
return data;
} catch (error) {
this.logger.error(`Error in _oidcUpdateCredentialOffer in agent service : ${JSON.stringify(error)}`);
throw error;
}
}

async oidcGetCredentialOfferById(url: string, orgId: string): Promise<object> {
try {
const getApiKey = await this.getOrgAgentApiKey(orgId);
const data = await this.commonService
.httpGet(url, { headers: { authorization: getApiKey } })
.then(async (response) => response);
return data;
} catch (error) {
this.logger.error(`Error in _oidcGetCredentialOfferById in agent service : ${JSON.stringify(error)}`);
throw error;
}
}

async oidcGetAllCredentialOffers(url: string, orgId: string): Promise<object> {
try {
const getApiKey = await this.getOrgAgentApiKey(orgId);
const data = await this.commonService
.httpGet(url, { headers: { authorization: getApiKey } })
.then(async (response) => response);
return data;
} catch (error) {
this.logger.error(`Error in _oidcGetAllCredentialOffers in agent service : ${JSON.stringify(error)}`);
throw error;
}
}

async oidcDeleteCredentialOffer(url: string, orgId: string): Promise<object> {
try {
const getApiKey = await this.getOrgAgentApiKey(orgId);
const data = await this.commonService
.httpDelete(`${url}`, { headers: { authorization: getApiKey } })
.then(async (response) => response);
return data;
} catch (error) {
this.logger.error(`Error in _oidcDeleteCredentialOffer in agent service : ${JSON.stringify(error)}`);
throw error;
}
}

async oidcIssuerTemplate(templatePayload, url: string, orgId: string): Promise<object> {
try {
const getApiKey = await this.getOrgAgentApiKey(orgId);
Expand Down
4 changes: 3 additions & 1 deletion apps/api-gateway/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { ContextModule } from '@credebl/context/contextModule';
import { LoggerModule } from '@credebl/logger/logger.module';
import { GlobalConfigModule } from '@credebl/config/global-config.module';
import { ConfigModule as PlatformConfig } from '@credebl/config/config.module';
import { Oid4vcIssuanceModule } from './oid4vc-issuance/oid4vc-issuance.module';

@Module({
imports: [
Expand Down Expand Up @@ -64,7 +65,8 @@ import { ConfigModule as PlatformConfig } from '@credebl/config/config.module';
GlobalConfigModule,
CacheModule.register({ store: redisStore, host: process.env.REDIS_HOST, port: process.env.REDIS_PORT }),
GeoLocationModule,
CloudWalletModule
CloudWalletModule,
Oid4vcIssuanceModule
],
controllers: [AppController],
providers: [
Expand Down
Loading