> Thirdly, this all needs to be wrapped up in some sort of secure mechanism

Putting that first would have saved the bother of putting the second and third.