mesand,
I would obviously have to have a user register the pi via their pi's IP address so only they can control that pi.
In general this will not work.
1) Often a users internet service provider will not give them a fixed IP address.
2) They may not get an IP address that is accessible publicly from the internet at all.
3) If the users Pi is accessing the net via a mobile connection, 3G/4G, then 1) and 2) are almost certainly true.
4) If the user has many Pi connected to the net through a router, as is typical, then the all have the same IP address as seen from the internet. The router does network address translation (NAT).
The solution is to have the Pi do the connecting, from their unknown place, to a know server on the web.
Currently I am building a system whereby the remote Pi connect to a cloud server, from Digital Ocean in this case, using the NATS messaging system
https://nats.io/. Adding NATS communication capability to your program is very easy, there are NATS clients in almost all common languages. NATS is fast and secure. A great advantages is that you can put up multiple NATS servers in a "cluster" for tolerance against one or more of then failing, your Pi will find a working one to talk to.
To distinguish users when the connect they would require unique NATS certificates for authentication.
For manual maintenance I am using the services of dataplicity.com.
https://www.balena.io/ is also a fine service.
At least if you have a play with those, you can do do so for free, you will see what the problems you have and how they solve then in different ways.
Memory in C++ is a leaky abstraction .