Setup a DTLS proxy that invokes your server program to respond to requests should work. You don't need to put security and functionality in a single monolithic bundle.
As forThis is called the certificate partUnix philosophy - write multiple programs that works together instead of trying to solve everything at once.
I don't know about NodeRTC you've mentioned in the comment, you couldbut there's another archtypical program called "ssh" we use everyday. At its minimal, it's a program that establishes secure channels between client and server, the channels can carry anything from stdio, tty, x11, to just configureany data. (which by the way is much easier to setup than a preDTLS proxy if you may consider).
SSH saves its configs and keys in local files protected by permissions -shared key had it been encrypted, it can't automatically start itself and would require user to input passphrase.
Since this site is about cryptography, the software part of the question should be kept out or it will be off-topic.