Now the input data is checked for correctness, and not immediately sent to wireguard. This will help increase performance by reducing requests to wireguard. However, this is not a 100% guarantee of data correctness. The keys are only checked for length and that the key is in base64 format, however it is not checked that it is the correct wireguard format.
In addition, validation will help protect the code from possible command injection attacks.
Now the input data is checked for correctness, and not immediately sent to wireguard. This will help increase performance by reducing requests to wireguard. However, this is not a 100% guarantee of data correctness. The keys are only checked for length and that the key is in base64 format, however it is not checked that it is the correct wireguard format. In addition, validation will help protect the code from possible command injection attacks.