There are other projects which have already done this and open sourced their versions as well, so you can look at their security analysis and use their code for your own projects if you want.
That’s the beauty of open source. You don’t need to reinvent the wheel.