(iv: string, encryptedText: string)
| 28 | } |
| 29 | |
| 30 | export function decrypt(iv: string, encryptedText: string): string { |
| 31 | const encryptionKey = Buffer.from(env.SOURCEBOT_ENCRYPTION_KEY, 'ascii'); |
| 32 | |
| 33 | const ivBuffer = Buffer.from(iv, 'hex'); |
| 34 | const encryptedBuffer = Buffer.from(encryptedText, 'hex'); |
| 35 | |
| 36 | const decipher = crypto.createDecipheriv(algorithm, encryptionKey, ivBuffer); |
| 37 | |
| 38 | let decrypted = decipher.update(encryptedBuffer, undefined, 'utf8'); |
| 39 | decrypted += decipher.final('utf8'); |
| 40 | |
| 41 | return decrypted; |
| 42 | } |
| 43 | |
| 44 | |
| 45 | export function hashSecret(text: string): string { |
no outgoing calls
no test coverage detected