Skip to content
Open
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
21 changes: 17 additions & 4 deletions .env.demo
Original file line number Diff line number Diff line change
Expand Up @@ -109,24 +109,37 @@ DATABASE_URL="postgresql://postgres:postgres@your-ip:5432/credebl"
AWS_ACCESS_KEY=
AWS_SECRET_KEY=
AWS_REGION=
AWS_BUCKET=
FILE_SHARING_BUCKET=

# Used for Adding org-logo during org creation and update (Optional- Can be skipped if no image is added during org creation and updation)
# Provide aws bucket access credentails with write access to the bucket as logo upload is done using signed url which requires putObject permission.
AWS_PUBLIC_ACCESS_KEY=
AWS_PUBLIC_SECRET_KEY=
AWS_PUBLIC_REGION=
AWS_ORG_LOGO_BUCKET_NAME=
ORG_LOGO_BUCKET_NAME=

# Used for storing connection URL generated from Agent and creating shortened URL (As connecting to org requires Shortened url)
# Provide aws bucket access credentails with write access to the bucket as storing shortened url is done using putObject operation.
AWS_S3_STOREOBJECT_ACCESS_KEY=
AWS_S3_STOREOBJECT_SECRET_KEY=
AWS_S3_STOREOBJECT_REGION=
AWS_S3_STOREOBJECT_BUCKET=
STOREOBJECT_BUCKET=

# Provide bucket used for storing shortened url objects e.g. 'https://s3.region-code.amazonaws.com/bucket-name'
SHORTENED_URL_DOMAIN='https://s3.AWS_S3_STOREOBJECT_REGION.amazonaws.com/AWS_S3_STOREOBJECT_BUCKET'
SHORTENED_URL_DOMAIN='https://s3.AWS_S3_STOREOBJECT_REGION.amazonaws.com/STOREOBJECT_BUCKET'

# Storage type: 'aws' (default), 'rustfs' (S3-compatible), or 'local' (filesystem)
# When set to 'local', AWS/RustFS credentials are not required
FILE_STORAGE_TYPE=aws

RUSTFS_ENDPOINT=
RUSTFS_ACCESS_KEY_ID=
RUSTFS_SECRET_ACCESS_KEY=
RUSTFS_REGION=
# make sure to add the bucket names in the below variables if you are using local rustfs for file storage, as these buckets need to be created in rustfs and the same bucket names should be used in the code for storing and retrieving files.
# FILE_SHARING_BUCKET=
# ORG_LOGO_BUCKET_NAME=
# STOREOBJECT_BUCKET=

# Specify your domain/subdomain responsible for deeplinking with 'url' as a query param e.g. 'https://your-deeplink-domain?url='
DEEPLINK_DOMAIN='https://link.credebl.id?url='
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ sonar-project.properties
.scannerwork/*
coverage
libs/prisma-service/prisma/data/credebl-master-table/credebl-master-table.json
uploadedFiles/*
uploadedFles/exports
uploadedFles/import
uploadedFles/export
Expand Down
4 changes: 2 additions & 2 deletions apps/api-gateway/src/issuance/issuance.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ import {
IssueCredentialType,
UploadedFileDetails
} from './interfaces';
import { AwsService } from '@credebl/aws';
import { StorageService } from '@credebl/storage';
import { FileInterceptor } from '@nestjs/platform-express';
import { v4 as uuidv4 } from 'uuid';
import { RpcException } from '@nestjs/microservices';
Expand All @@ -90,7 +90,7 @@ import { IWebhookUrlInfo } from '@credebl/common/interfaces/webhook.interface';
export class IssuanceController {
constructor(
private readonly issueCredentialService: IssuanceService,
private readonly awsService: AwsService
private readonly awsService: StorageService
) {}
private readonly logger = new Logger('IssuanceController');

Expand Down
4 changes: 2 additions & 2 deletions apps/api-gateway/src/issuance/issuance.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IssuanceService } from './issuance.service';
import { CommonService } from '@credebl/common';
import { HttpModule } from '@nestjs/axios';
import { getNatsOptions } from '@credebl/common/nats.config';
import { AwsService } from '@credebl/aws';
import { StorageService } from '@credebl/storage';
import { CommonConstants } from '@credebl/common/common.constant';
import { NATSClient } from '@credebl/common/NATSClient';

Expand All @@ -25,6 +25,6 @@ import { NATSClient } from '@credebl/common/NATSClient';
])
],
controllers: [IssuanceController],
providers: [IssuanceService, CommonService, AwsService, NATSClient]
providers: [IssuanceService, CommonService, StorageService, NATSClient]
})
export class IssuanceModule {}
1 change: 1 addition & 0 deletions apps/api-gateway/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ async function bootstrap(): Promise<void> {
app.use(express.static('invoice-pdf'));
app.use(express.static('uploadedFiles/bulk-verification-templates'));
app.use(express.static('uploadedFiles/import'));
app.use('/uploadedFiles', express.static('uploadedFiles'));
Comment thread
sujitaw marked this conversation as resolved.
// Use custom updatable global pipes
const reflector = app.get(Reflector);
app.useGlobalPipes(new UpdatableValidationPipe(reflector, { whitelist: true, transform: true }));
Expand Down
4 changes: 2 additions & 2 deletions apps/api-gateway/src/organization/organization.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Module } from '@nestjs/common';
import { OrganizationController } from './organization.controller';
import { OrganizationService } from './organization.service';
import { getNatsOptions } from '@credebl/common/nats.config';
import { AwsService } from '@credebl/aws';
import { StorageService } from '@credebl/storage';
import { CommonConstants } from '@credebl/common/common.constant';
import { NATSClient } from '@credebl/common/NATSClient';
@Module({
Expand All @@ -28,6 +28,6 @@ import { NATSClient } from '@credebl/common/NATSClient';
])
],
controllers: [OrganizationController],
providers: [OrganizationService, CommonService, AwsService, NATSClient]
providers: [OrganizationService, CommonService, StorageService, NATSClient]
})
export class OrganizationModule {}
4 changes: 2 additions & 2 deletions apps/api-gateway/src/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { UpdatePlatformSettingsDto } from './dto/update-platform-settings.dto';
import { Roles } from '../authz/decorators/roles.decorator';
import { OrgRolesGuard } from '../authz/guards/org-roles.guard';
import { OrgRoles } from 'libs/org-roles/enums';
import { AwsService } from '@credebl/aws/aws.service';
import { StorageService } from '@credebl/storage';
import { PaginationDto } from '@credebl/common/dtos/pagination.dto';
import { UserAccessGuard } from '../authz/guards/user-access-guard';
import { TrimStringParamPipe } from '@credebl/common/cast.helper';
Expand All @@ -61,7 +61,7 @@ export class UserController {
constructor(
private readonly userService: UserService,
private readonly commonService: CommonService,
private readonly awsService: AwsService
private readonly awsService: StorageService
) {}

/**
Expand Down
4 changes: 2 additions & 2 deletions apps/api-gateway/src/user/user.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Module } from '@nestjs/common';
import { UserController } from './user.controller';
import { UserService } from './user.service';
import { getNatsOptions } from '@credebl/common/nats.config';
import { AwsService } from '@credebl/aws';
import { StorageService } from '@credebl/storage';
import { CommonConstants } from '@credebl/common/common.constant';
import { NATSClient } from '@credebl/common/NATSClient';

Expand All @@ -27,6 +27,6 @@ import { NATSClient } from '@credebl/common/NATSClient';
])
],
controllers: [UserController],
providers: [UserService, CommonService, AwsService, NATSClient]
providers: [UserService, CommonService, StorageService, NATSClient]
})
export class UserModule {}
4 changes: 2 additions & 2 deletions apps/api-gateway/src/webhook/webhook.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { WebhookService } from './webhook.service';
import { CommonService } from '@credebl/common';
import { HttpModule } from '@nestjs/axios';
import { getNatsOptions } from '@credebl/common/nats.config';
import { AwsService } from '@credebl/aws';
import { StorageService } from '@credebl/storage';
import { CommonConstants } from '@credebl/common/common.constant';
import { NATSClient } from '@credebl/common/NATSClient';

Expand All @@ -25,6 +25,6 @@ import { NATSClient } from '@credebl/common/NATSClient';
])
],
controllers: [WebhookController],
providers: [WebhookService, CommonService, AwsService, NATSClient]
providers: [WebhookService, CommonService, StorageService, NATSClient]
})
export class WebhookModule {}
4 changes: 2 additions & 2 deletions apps/api-gateway/src/x509/x509.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Module } from '@nestjs/common';
import { X509Controller } from './x509.controller';
import { X509Service } from './x509.service';
import { getNatsOptions } from '@credebl/common/nats.config';
import { AwsService } from '@credebl/aws';
import { StorageService } from '@credebl/storage';
import { CommonConstants } from '@credebl/common/common.constant';
import { NATSClient } from '@credebl/common/NATSClient';
@Module({
Expand All @@ -25,6 +25,6 @@ import { NATSClient } from '@credebl/common/NATSClient';
])
],
controllers: [X509Controller],
providers: [X509Service, AwsService, NATSClient]
providers: [X509Service, StorageService, NATSClient]
})
export class X509Module {}
4 changes: 2 additions & 2 deletions apps/issuance/src/issuance.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { EmailDto } from '@credebl/common/dtos/email.dto';
import { BullModule } from '@nestjs/bull';
import { CacheModule } from '@nestjs/cache-manager';
import { BulkIssuanceProcessor } from './issuance.processor';
import { AwsService } from '@credebl/aws';
import { StorageService } from '@credebl/storage';
import { UserActivityRepository } from 'libs/user-activity/repositories';
import { CommonConstants, MICRO_SERVICE_NAME } from '@credebl/common/common.constant';
import { LoggerModule } from '@credebl/logger/logger.module';
Expand Down Expand Up @@ -61,7 +61,7 @@ import { NATSClient } from '@credebl/common/NATSClient';
OutOfBandIssuance,
EmailDto,
BulkIssuanceProcessor,
AwsService,
StorageService,
NATSClient,
{
provide: MICRO_SERVICE_NAME,
Expand Down
5 changes: 2 additions & 3 deletions apps/issuance/src/issuance.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import { convertUrlToDeepLinkUrl, getAgentUrl, paginator } from '@credebl/common
import { InjectQueue } from '@nestjs/bull';
import { Queue } from 'bull';
import { FileUploadStatus, FileUploadType } from 'apps/api-gateway/src/enum';
import { AwsService } from '@credebl/aws';
import { StorageService } from '@credebl/storage';
import { io } from 'socket.io-client';
import { IIssuedCredentialSearchParams, IssueCredentialType } from 'apps/api-gateway/src/issuance/interfaces';
import {
Expand Down Expand Up @@ -107,7 +107,7 @@ export class IssuanceService {
@Inject(CACHE_MANAGER) private readonly cacheManager: Cache,
private readonly outOfBandIssuance: OutOfBandIssuance,
private readonly emailData: EmailDto,
private readonly awsService: AwsService,
private readonly awsService: StorageService,
@InjectQueue('bulk-issuance') private readonly bulkIssuanceQueue: Queue,
// TODO: Remove duplicate, unused variable
@Inject(CACHE_MANAGER) private readonly cacheService: Cache,
Expand Down Expand Up @@ -1290,7 +1290,6 @@ export class IssuanceService {
credentialPayload.credentialType = SchemaType.INDY;
credentialPayload.schemaName = credentialDetails.schemaName;
}

const getFileDetails = await this.awsService.getFile(importFileDetails.fileKey);
const csvData: string = getFileDetails.Body.toString();

Expand Down
4 changes: 2 additions & 2 deletions apps/organization/src/organization.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { getNatsOptions } from '@credebl/common/nats.config';
import { ClientRegistrationService } from '@credebl/client-registration';
import { KeycloakUrlService } from '@credebl/keycloak-url';

import { AwsService } from '@credebl/aws';
import { StorageService } from '@credebl/storage';
import { CommonConstants } from '@credebl/common/common.constant';
import { GlobalConfigModule } from '@credebl/config/global-config.module';
import { ConfigModule as PlatformConfig } from '@credebl/config/config.module';
Expand Down Expand Up @@ -61,7 +61,7 @@ import { NATSClient } from '@credebl/common/NATSClient';
UserActivityService,
ClientRegistrationService,
KeycloakUrlService,
AwsService,
StorageService,
NATSClient
],
exports: [OrganizationRepository]
Expand Down
6 changes: 3 additions & 3 deletions apps/organization/src/organization.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { UserActivityService } from '@credebl/user-activity';
import { ClientRegistrationService } from '@credebl/client-registration/client-registration.service';
import { map } from 'rxjs/operators';
import { Cache } from 'cache-manager';
import { AwsService } from '@credebl/aws';
import { StorageService } from '@credebl/storage';
import { CACHE_MANAGER } from '@nestjs/cache-manager';
import {
IOrgCredentials,
Expand Down Expand Up @@ -77,7 +77,7 @@ export class OrganizationService {
private readonly organizationRepository: OrganizationRepository,
private readonly orgRoleService: OrgRolesService,
private readonly userOrgRoleService: UserOrgRolesService,
private readonly awsService: AwsService,
private readonly awsService: StorageService,
private readonly userActivityService: UserActivityService,
private readonly logger: Logger,
// TODO: Remove duplicate, unused variable
Expand Down Expand Up @@ -498,7 +498,7 @@ export class OrganizationService {
imgData,
'png',
'orgLogo',
process.env.AWS_ORG_LOGO_BUCKET_NAME,
process.env.ORG_LOGO_BUCKET_NAME,
'base64',
'orgLogos'
);
Expand Down
10 changes: 5 additions & 5 deletions apps/user/src/fido/fido.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { UserOrgRolesRepository } from 'libs/user-org-roles/repositories';
import { UserOrgRolesService } from '@credebl/user-org-roles';
import { UserRepository } from '../../repositories/user.repository';
import { UserService } from '../user.service';
import { AwsService } from '@credebl/aws';
import { StorageService } from '@credebl/storage';
import { NATSClient } from '@credebl/common/NATSClient';

@Module({
Expand All @@ -35,10 +35,10 @@ import { NATSClient } from '@credebl/common/NATSClient';
]),
HttpModule,
CommonModule
],
],
controllers: [FidoController],
providers: [
AwsService,
StorageService,
UserService,
PrismaService,
FidoService,
Expand All @@ -56,6 +56,6 @@ import { NATSClient } from '@credebl/common/NATSClient';
UserActivityService,
UserActivityRepository,
NATSClient
]
]
})
export class FidoModule { }
export class FidoModule {}
4 changes: 2 additions & 2 deletions apps/user/src/user.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ClientsModule, Transport } from '@nestjs/microservices';
import { Logger, Module } from '@nestjs/common';
import { OrgRolesModule, OrgRolesService } from '@credebl/org-roles';

import { AwsService } from '@credebl/aws';
import { StorageService } from '@credebl/storage';
import { ClientRegistrationService } from '@credebl/client-registration';
import { CommonConstants } from '@credebl/common/common.constant';
import { CommonModule } from '@credebl/common';
Expand Down Expand Up @@ -46,7 +46,7 @@ import { getNatsOptions } from '@credebl/common/nats.config';
],
controllers: [UserController],
providers: [
AwsService,
StorageService,
UserService,
UserRepository,
PrismaService,
Expand Down
4 changes: 2 additions & 2 deletions apps/user/src/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import { v4 as uuidv4 } from 'uuid';
import { Invitation, ProviderType, SessionType, TokenType, UserRole } from '@credebl/enum/enum';
import validator from 'validator';
import { DISALLOWED_EMAIL_DOMAIN } from '@credebl/common/common.constant';
import { AwsService } from '@credebl/aws';
import { StorageService } from '@credebl/storage';
import { IUsersActivity } from 'libs/user-activity/interface';
import {
ISendVerificationEmail,
Expand Down Expand Up @@ -83,7 +83,7 @@ export class UserService {
private readonly userOrgRoleService: UserOrgRolesService,
private readonly userActivityService: UserActivityService,
private readonly userRepository: UserRepository,
private readonly awsService: AwsService,
private readonly awsService: StorageService,
private readonly userDevicesRepository: UserDevicesRepository,
private readonly logger: Logger,
@Inject('NATS_CLIENT') private readonly userServiceProxy: ClientProxy,
Expand Down
4 changes: 2 additions & 2 deletions apps/utility/src/utilities.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { PrismaService } from '@credebl/prisma-service';
import { UtilitiesController } from './utilities.controller';
import { UtilitiesService } from './utilities.service';
import { UtilitiesRepository } from './utilities.repository';
import { AwsService } from '@credebl/aws';
import { StorageService } from '@credebl/storage';
import { CommonConstants } from '@credebl/common/common.constant';
import { GlobalConfigModule } from '@credebl/config/global-config.module';
import { ConfigModule as PlatformConfig } from '@credebl/config/config.module';
Expand Down Expand Up @@ -35,6 +35,6 @@ import { ContextInterceptorModule } from '@credebl/context/contextInterceptorMod
CacheModule.register()
],
controllers: [UtilitiesController],
providers: [UtilitiesService, Logger, PrismaService, UtilitiesRepository, AwsService]
providers: [UtilitiesService, Logger, PrismaService, UtilitiesRepository, StorageService]
})
export class UtilitiesModule {}
8 changes: 6 additions & 2 deletions apps/utility/src/utilities.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable, NotFoundException } from '@nestjs/common';

import { AwsService } from '@credebl/aws';
import { StorageService } from '@credebl/storage';
import { BaseService } from 'libs/service/base.service';
import { EmailDto } from '@credebl/common/dtos/email.dto';
import { EmailService } from '@credebl/common/email.service';
Expand All @@ -17,7 +17,7 @@ export class UtilitiesService extends BaseService {

constructor(
private readonly utilitiesRepository: UtilitiesRepository,
private readonly awsService: AwsService,
private readonly awsService: StorageService,
private readonly emailService: EmailService
) {
super('UtilitiesService');
Expand Down Expand Up @@ -71,6 +71,10 @@ export class UtilitiesService extends BaseService {
uuid,
payload.storeObj
);
const storageType = process.env.FILE_STORAGE_TYPE || 'aws';
if ('local' === storageType || 'rustfs' === storageType) {
return uploadResult.Location;
}
const url: string = `${process.env.SHORTENED_URL_DOMAIN}/${uploadResult.Key}`;
return url;
} catch (error) {
Expand Down
8 changes: 0 additions & 8 deletions libs/aws/src/aws.module.ts

This file was deleted.

Loading