Gnome-disks, for example, doesn't require sudo permissions, but it still decodes the locked/unlocked status of LUKS devices.
GNOME Disks uses UDisks to get the information. There's nothing hacky about it, the CleartextDevice property will be always either / if the device is locked or a valid object path in form of /org/freedesktop/UDisks2/block_devices/dm_2d<num>, where dm_2d<num> translates to dm-<num>, the device mapper cleartext device name (- is encoded as _2d on DBus). If you don't want to parse udisksctl output, you can use busctl to get only the CleartextDevice property. It can also format the output in JSON for simpler parsing.
Locked LUKS device:
$ busctl get-property org.freedesktop.UDisks2 /org/freedesktop/UDisks2/block_devices/sda1 org.freedesktop.UDisks2.Encrypted CleartextDevice -j
{
"type" : "o",
"data" : "/"
}
Unlocked LUKS device:
$ busctl get-property org.freedesktop.UDisks2 /org/freedesktop/UDisks2/block_devices/nvme0n1p3 org.freedesktop.UDisks2.Encrypted CleartextDevice -j
{
"type" : "o",
"data" : "/org/freedesktop/UDisks2/block_devices/dm_2d0"
}
UDisks DBus API is guaranteed to be stable, the object path for the device will be always /org/freedesktop/UDisks2/block_devices/<name>.
But you can always simply check whether the LUKS device has a child. The cleartext device will always be a child of the LUKS device so you can check either from lsblk or from sysfs.
Locked LUKS device:
$ ls /sys/block/sda/sda1/holders/
Unlocked LUKS device:
$ ls /sys/block/nvme0n1/nvme0n1p3/holders
dm-0