Skip to content

Commit

Permalink
make kyc api key required
Browse files Browse the repository at this point in the history
  • Loading branch information
portuu3 committed Oct 4, 2024
1 parent 7bfbf7b commit 5b4d70a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/apps/reputation-oracle/server/ENV.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ HCAPTCHA_LABELING_URL="https://foundation-accounts.hmt.ai"
### The default language code for the hCaptcha labeler interface. Default: 'en'
HCAPTCHA_DEFAULT_LABELER_LANG="en"

### The API key for the KYC service, used for authentication with the KYC provider's API. KYC_API_KEY_DISABLED (a constant indicating that the API key is disabled) Default: 'kyc-disabled'
KYC_API_KEY="kyc-disabled"
### The API key for the KYC service, used for authentication with the KYC provider's API. KYC_API_KEY_DISABLED (a constant indicating that the API key is disabled) Required
KYC_API_KEY=

### The private key associated with the KYC API, used for secure server-to-server communication. Required
KYC_API_PRIVATE_KEY=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const envValidator = Joi.object({
PGP_PASSPHRASE: Joi.string().optional(),
PGP_ENCRYPT: Joi.string(),
// Kyc
KYC_API_KEY: Joi.string().required(),
KYC_API_KEY: Joi.string(),
KYC_API_PRIVATE_KEY: Joi.string().required(),
KYC_BASE_URL: Joi.string(),
});
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { KYC_API_KEY_DISABLED } from '../constants';

@Injectable()
export class KycConfigService {
constructor(private configService: ConfigService) {}

/**
* The API key for the KYC service, used for authentication with the KYC provider's API. KYC_API_KEY_DISABLED (a constant indicating that the API key is disabled)
* Default: 'kyc-disabled'
* Required
*/
get apiKey(): string {
return this.configService.get<string>('KYC_API_KEY', KYC_API_KEY_DISABLED);
return this.configService.getOrThrow<string>('KYC_API_KEY');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const JWT_PREFIX = 'bearer ';
export const SENDGRID_API_KEY_REGEX =
/^SG\.[A-Za-z0-9-_]{22}\.[A-Za-z0-9-_]{43}$/;
export const SENDGRID_API_KEY_DISABLED = 'sendgrid-disabled';
export const KYC_API_KEY_DISABLED = 'kyc-disabled';

export const SENDGRID_TEMPLATES = {
signup: 'd-ca99cc7410aa4e6dab3e6042d5ecb9a3',
Expand Down

0 comments on commit 5b4d70a

Please sign in to comment.