(encrypted: string)
| 28 | |
| 29 | /** |
| 30 | * Decrypts an encrypted promo code. |
| 31 | * Used at runtime to decrypt promo codes stored in source. |
| 32 | * |
| 33 | * @param encrypted - Encrypted string in format iv:authTag:encrypted |
| 34 | * @returns The original plaintext promo code |
| 35 | */ |
| 36 | export function decryptPromoCode(encrypted: string): string { |
| 37 | if ( |
| 38 | process.env.NODE_ENV === 'test' || |
| 39 | (!CREDIT_CATEGORIES_ENCRYPTION_KEY_V2 && !CREDIT_CATEGORIES_ENCRYPTION_KEY) |
no test coverage detected