-
Notifications
You must be signed in to change notification settings - Fork 65
feat! : Added alternative object storage #1484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ API_GATEWAY_HOST='0.0.0.0' | |
API_GATEWAY_PORT=5000 | ||
API_GATEWAY_PROTOCOL_SECURE=http | ||
|
||
## | ||
## Platform Configurations | ||
PLATFORM_NAME= // Please specify your paltform name | ||
PLATFORM_LOGO= // Please specify your paltform logo url | ||
PUBLIC_PLATFORM_SUPPORT_EMAIL= // Please specify your support email | ||
|
@@ -25,34 +25,15 @@ PUBLIC_QA_API_URL= // Please specify your your QA environment api URL | |
PUBLIC_PRODUCTION_API_URL= // Please specify your PRODUCTION environment api URL | ||
PUBLIC_SANDBOX_API_URL= // Please specify your sandbox environment URL | ||
|
||
SHORTENED_URL_DOMAIN= // Please specify the domain for your bucket responsible for storing shortened url objects e.g. 'https://bucket-name.s3.ap-east-1.amazonaws.com' | ||
DEEPLINK_DOMAIN= // Please specify your doamin/subdomain responsible for deeplinking with 'url' as a query param e.g. 'https://your-deeplink-domain?url=' | ||
|
||
[email protected] // Please specify your agent host VM and IP address | ||
AWS_ACCOUNT_ID=xxxxx // Please provide your AWS account Id | ||
S3_BUCKET_ARN=arn:aws:s3:::xxxxx // Please provide your AWS bucket arn | ||
|
||
API_ENDPOINT=localhost:5000 #Use your local machine IP Address & PORT | ||
API_ENDPOINT_PORT=5000 | ||
|
||
SOCKET_HOST=http://localhost:5000 | ||
|
||
AWS_PUBLIC_ACCESS_KEY= // Please provide your aws bucket access key | ||
AWS_PUBLIC_SECRET_KEY= // Please provide your aws secret key | ||
AWS_PUBLIC_REGION= // Please provide your aws region | ||
AWS_PUBLIC_BUCKET_NAME= // Please provide your aws bucket name | ||
|
||
AWS_ORG_LOGO_BUCKET_NAME= // Please provide your aws org bucket name | ||
|
||
AWS_S3_STOREOBJECT_ACCESS_KEY= // Please provide your aws bucket access key | ||
AWS_S3_STOREOBJECT_SECRET_KEY= // Please provide your aws bucket secret key | ||
AWS_S3_STOREOBJECT_REGION= // Please provide your aws region | ||
AWS_S3_STOREOBJECT_BUCKET= // Please provide your aws bucket | ||
AWS_ACCESS_KEY= // Please provide your access key | ||
AWS_SECRET_KEY= // Please provide your secret key | ||
AWS_REGION= // Please provide your aws region | ||
AWS_BUCKET= // Please provide your aws bucket | ||
|
||
PLATFORM_ADMIN_EMAIL= // Please provide admin email Id | ||
|
||
NATS_HOST='0.0.0.0' | ||
|
@@ -206,4 +187,25 @@ AGENT_API_KEY='supersecret-that-too-16chars' | |
# VERIFIER_CLIENT_ALIAS=VERIFIER | ||
# VERIFIER_DOMAIN=https://VERIFIER-domain.com | ||
# VERIFIER_KEYCLOAK_MANAGEMENT_CLIENT_ID=encryptedKeyCloakClientId | ||
# VERIFIER_KEYCLOAK_MANAGEMENT_CLIENT_SECRET=encryptedKeyCloakClientSecret | ||
# VERIFIER_KEYCLOAK_MANAGEMENT_CLIENT_SECRET=encryptedKeyCloakClientSecret | ||
|
||
# FILE_STORAGE_PROVIDER can be 'aws' or 'minio' | ||
FILE_STORAGE_PROVIDER=minio | ||
|
||
# AWS Configurations | ||
AWS_ACCOUNT_ID=xxxxx // Please provide your AWS account Id | ||
S3_BUCKET_ARN=arn:aws:s3:::xxxxx // Please provide your AWS bucket arn | ||
AWS_ACCESS_KEY= // Please provide your access key | ||
AWS_SECRET_KEY= // Please provide your secret key | ||
AWS_REGION= // Please provide your aws region | ||
|
||
# MinIO Config : Use the same buckets as below three mentioned with AWS S3 config | ||
MINIO_ENDPOINT= // Please provide your minio endpoint | ||
MINIO_PORT= // Please provide your minio port | ||
MINIO_USE_SSL= // Please provide your minio ssl true/false | ||
MINIO_ACCESS_KEY= // Please provide your minio access key | ||
MINIO_SECRET_KEY= // Please provide your minio secret key | ||
|
||
STORE_OBJECT_BUCKET= // Please provide your aws bucket | ||
FILE_BUCKET= // Please provide your aws bucket for file sharing | ||
ORG_LOGO_BUCKET= // Please provide your aws bucket for org logo | ||
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -8,11 +8,11 @@ export class UserRoleGuard implements CanActivate { | |||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
const { user } = request; | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
if (!user?.userRole) { | ||||||||||||||||||||||||||||||||||
if (!user?.realm_access.roles) { | ||||||||||||||||||||||||||||||||||
throw new ForbiddenException('This role is not a holder.'); | ||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||
if (!user?.userRole.includes('holder')) { | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
if (!user?.realm_access.roles.includes('holder')) { | ||||||||||||||||||||||||||||||||||
throw new ForbiddenException('This role is not a holder.'); | ||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||
Comment on lines
+11
to
17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Incomplete optional chaining will throw TypeError. The optional chaining operator Apply this diff to add proper optional chaining: - if (!user?.realm_access.roles) {
- throw new ForbiddenException('This role is not a holder.');
+ if (!user?.realm_access?.roles) {
+ throw new ForbiddenException('User roles not found.');
}
- if (!user?.realm_access.roles.includes('holder')) {
+ if (!user.realm_access.roles.includes('holder')) {
throw new ForbiddenException('This role is not a holder.');
} Note: Line 15 no longer needs optional chaining after line 11's validation confirms the path exists. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -176,8 +176,9 @@ export class CloudWalletService { | |||||||||||||
|
||||||||||||||
const [baseWalletDetails, decryptedApiKey] = await this._commonCloudWalletInfo(userId); | ||||||||||||||
const { agentEndpoint } = baseWalletDetails; | ||||||||||||||
const threadParam = threadId ? `?threadId=${threadId}` : ''; | ||||||||||||||
const url = `${agentEndpoint}${CommonConstants.CLOUD_WALLET_GET_PROOF_REQUEST}/${threadParam}}`; | ||||||||||||||
const url = `${agentEndpoint}${CommonConstants.CLOUD_WALLET_GET_PROOF_REQUEST}/${ | ||||||||||||||
threadId ? `?threadId=${threadId}` : '' | ||||||||||||||
}`; | ||||||||||||||
Comment on lines
+179
to
+181
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix the URL construction to remove the trailing slash before the query parameter. The URL construction includes a hardcoded
Standard REST URL format should not have a trailing slash before query parameters: Apply this diff to fix the URL construction: - const url = `${agentEndpoint}${CommonConstants.CLOUD_WALLET_GET_PROOF_REQUEST}/${
- threadId ? `?threadId=${threadId}` : ''
- }`;
+ const url = `${agentEndpoint}${CommonConstants.CLOUD_WALLET_GET_PROOF_REQUEST}${
+ threadId ? `?threadId=${threadId}` : ''
+ }`; 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||
const getProofById = await this.commonService.httpGet(url, { headers: { authorization: decryptedApiKey } }); | ||||||||||||||
return getProofById; | ||||||||||||||
} catch (error) { | ||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 { | ||
|
@@ -89,7 +89,6 @@ import * as pLimit from 'p-limit'; | |
import { UserActivityRepository } from 'libs/user-activity/repositories'; | ||
import { validateW3CSchemaAttributes } from '../libs/helpers/attributes.validator'; | ||
import { ISchemaDetail } from '@credebl/common/interfaces/schema.interface'; | ||
import ContextStorageService, { ContextStorageServiceKey } from '@credebl/context/contextStorageService.interface'; | ||
import { NATSClient } from '@credebl/common/NATSClient'; | ||
import { extractAttributeNames, unflattenCsvRow } from '../libs/helpers/attributes.extractor'; | ||
import { redisStore } from 'cache-manager-ioredis-yet'; | ||
|
@@ -107,12 +106,10 @@ export class IssuanceService { | |
@Inject(CACHE_MANAGER) private readonly cacheManager: Cache, | ||
private readonly outOfBandIssuance: OutOfBandIssuance, | ||
private readonly emailData: EmailDto, | ||
private readonly awsService: AwsService, | ||
private readonly storageService: StorageService, | ||
@InjectQueue('bulk-issuance') private readonly bulkIssuanceQueue: Queue, | ||
// TODO: Remove duplicate, unused variable | ||
@Inject(CACHE_MANAGER) private readonly cacheService: Cache, | ||
@Inject(ContextStorageServiceKey) | ||
private readonly contextStorageService: ContextStorageService, | ||
private readonly natsClient: NATSClient | ||
) {} | ||
Comment on lines
+109
to
114
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Constructor injection still references removed provider
🤖 Prompt for AI Agents
|
||
|
||
|
@@ -1290,8 +1287,8 @@ export class IssuanceService { | |
credentialPayload.schemaName = credentialDetails.schemaName; | ||
} | ||
|
||
const getFileDetails = await this.awsService.getFile(importFileDetails.fileKey); | ||
const csvData: string = getFileDetails.Body.toString(); | ||
const getFileDetails = await this.storageService.getFile(importFileDetails.fileKey); | ||
const csvData: string = getFileDetails.toString(); | ||
|
||
Comment on lines
+1290
to
1292
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new storage service resolves files to 🤖 Prompt for AI Agents
|
||
const parsedData = paParse(csvData, { | ||
header: true, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address dotenv formatting issues.
The new storage provider configuration is functionally correct, but static analysis has identified multiple formatting issues that should be addressed:
FILE_STORAGE_PROVIDER="minio"
)AWS_ACCESS_KEY=
notAWS_ACCESS_KEY=
)Apply these formatting fixes:
📝 Committable suggestion
🧰 Tools
🪛 dotenv-linter (3.3.0)
[warning] 196-196: [ValueWithoutQuotes] This value needs to be surrounded in quotes
(ValueWithoutQuotes)
[warning] 197-197: [ValueWithoutQuotes] This value needs to be surrounded in quotes
(ValueWithoutQuotes)
[warning] 198-198: [SpaceCharacter] The line has spaces around equal sign
(SpaceCharacter)
[warning] 198-198: [UnorderedKey] The AWS_ACCESS_KEY key should go before the AWS_ACCOUNT_ID key
(UnorderedKey)
[warning] 198-198: [ValueWithoutQuotes] This value needs to be surrounded in quotes
(ValueWithoutQuotes)
[warning] 199-199: [SpaceCharacter] The line has spaces around equal sign
(SpaceCharacter)
[warning] 199-199: [UnorderedKey] The AWS_SECRET_KEY key should go before the S3_BUCKET_ARN key
(UnorderedKey)
[warning] 199-199: [ValueWithoutQuotes] This value needs to be surrounded in quotes
(ValueWithoutQuotes)
[warning] 200-200: [SpaceCharacter] The line has spaces around equal sign
(SpaceCharacter)
[warning] 200-200: [UnorderedKey] The AWS_REGION key should go before the AWS_SECRET_KEY key
(UnorderedKey)
[warning] 200-200: [ValueWithoutQuotes] This value needs to be surrounded in quotes
(ValueWithoutQuotes)
[warning] 203-203: [SpaceCharacter] The line has spaces around equal sign
(SpaceCharacter)
[warning] 203-203: [ValueWithoutQuotes] This value needs to be surrounded in quotes
(ValueWithoutQuotes)
[warning] 204-204: [SpaceCharacter] The line has spaces around equal sign
(SpaceCharacter)
[warning] 204-204: [ValueWithoutQuotes] This value needs to be surrounded in quotes
(ValueWithoutQuotes)
[warning] 205-205: [SpaceCharacter] The line has spaces around equal sign
(SpaceCharacter)
[warning] 205-205: [ValueWithoutQuotes] This value needs to be surrounded in quotes
(ValueWithoutQuotes)
[warning] 206-206: [SpaceCharacter] The line has spaces around equal sign
(SpaceCharacter)
[warning] 206-206: [UnorderedKey] The MINIO_ACCESS_KEY key should go before the MINIO_ENDPOINT key
(UnorderedKey)
[warning] 206-206: [ValueWithoutQuotes] This value needs to be surrounded in quotes
(ValueWithoutQuotes)
[warning] 207-207: [SpaceCharacter] The line has spaces around equal sign
(SpaceCharacter)
[warning] 207-207: [UnorderedKey] The MINIO_SECRET_KEY key should go before the MINIO_USE_SSL key
(UnorderedKey)
[warning] 207-207: [ValueWithoutQuotes] This value needs to be surrounded in quotes
(ValueWithoutQuotes)
[warning] 209-209: [SpaceCharacter] The line has spaces around equal sign
(SpaceCharacter)
[warning] 209-209: [ValueWithoutQuotes] This value needs to be surrounded in quotes
(ValueWithoutQuotes)
[warning] 210-210: [SpaceCharacter] The line has spaces around equal sign
(SpaceCharacter)
[warning] 210-210: [UnorderedKey] The FILE_BUCKET key should go before the STORE_OBJECT_BUCKET key
(UnorderedKey)
[warning] 210-210: [ValueWithoutQuotes] This value needs to be surrounded in quotes
(ValueWithoutQuotes)
[warning] 211-211: [EndingBlankLine] No blank line at the end of the file
(EndingBlankLine)
[warning] 211-211: [SpaceCharacter] The line has spaces around equal sign
(SpaceCharacter)
[warning] 211-211: [UnorderedKey] The ORG_LOGO_BUCKET key should go before the STORE_OBJECT_BUCKET key
(UnorderedKey)
[warning] 211-211: [ValueWithoutQuotes] This value needs to be surrounded in quotes
(ValueWithoutQuotes)
🤖 Prompt for AI Agents