Lightly grease an 8-by-8-inch pan and line it with parchment paper, leaving a 1-inch overhang on the sides.
In a small bowl, stir together the cornstarch and water until there are no lumps. Set aside.
In a medium saucepan over medium-high heat, combine the coconut milk and sugar, and bring to a boil. Add the cornstarch-water mixture in a slow and steady stream, whisking constantly. After all of it has been added, reduce the heat to medium low and simmer, whisking constantly, until the mixture is thick and opaque, 12 to 15 minutes.
Pour the haupia into the prepared pan and transfer to the refrigerator to chill and set, about 2 hours.
Slice into 1½-inch squares, sprinkle with toasted coconut and flaky sea salt, and serve.