Build a FieldCodec from an EncryptionConfig, validating the key and deriving the subkeys once.
If the key is not a 64-character hex string.
const codec = createFieldCodec({ key: process.env.FIELD_ENCRYPTION_KEY!, encryptedFields: [{ model: "User", fields: ["email"] }],}); Copy
const codec = createFieldCodec({ key: process.env.FIELD_ENCRYPTION_KEY!, encryptedFields: [{ model: "User", fields: ["email"] }],});
Build a FieldCodec from an EncryptionConfig, validating the key and deriving the subkeys once.