Moved server side signing to its own file and refactored the request
validation.