(value: string)
| 9 | } |
| 10 | |
| 11 | function decrypt(value: string): string { |
| 12 | if (!value.startsWith('enc:')) { |
| 13 | throw new Error(`Cannot decrypt value that is not encrypted: ${value}`); |
| 14 | } |
| 15 | return value.slice(4); |
| 16 | } |
| 17 | |
| 18 | class EncryptedType extends Type<string, string> { |
| 19 | convertToDatabaseValue(value: string): string { |