import hmac
import hashlib


def sign_request(api_secret, verb, path, time, body = '') -> str:
    """Signs the request payload using the api key secret"""
    # This is basically boilerplate to interact with VALR's API

    payload = '{}{}{}{}'.format(time,verb.upper(),path,body)
    message = bytearray(payload, 'utf-8')
    signature = hmac.new(bytearray(api_secret, 'utf-8'), message, digestmod=hashlib.sha512).hexdigest()
    return signature