(email: string)
| 12 | ); |
| 13 | |
| 14 | export function encryptUserEmail(email: string) { |
| 15 | return _userEmailEncryptionKey().encrypt( |
| 16 | textToBytes( |
| 17 | (process.env.EMAIL_CASE_SENSITIVITY_EXCEPTIONS ?? '') |
| 18 | .split(';') |
| 19 | .includes(email) |
| 20 | |
| 21 | : email.toLowerCase(), |
| 22 | ), |
| 23 | { |
| 24 | padding: true, |
| 25 | associatedData: { context: 'UserEmail' }, |
| 26 | }, |
| 27 | ); |
| 28 | } |
| 29 | export function decryptUserEmail(encryptedEmail: Uint8Array) { |
| 30 | return bytesToText( |
| 31 | _userEmailEncryptionKey().decrypt(encryptedEmail, { |
no test coverage detected