Created
          December 13, 2018 19:20 
        
      - 
      
- 
        Save craigderington/620b0fd0e97df7ebb19ad53ee62b1787 to your computer and use it in GitHub Desktop. 
    Signature Verification
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import hashlib | |
| import hmac | |
| def verify(api_key, token, timestamp, signature): | |
| hmac_digest = hmac.new(key=mailgun_api_key, | |
| msg='{}{}'.format(timestamp, token).encode('utf-8'), | |
| digestmod=hashlib.sha256).hexdigest() | |
| return hmac.compare_digest(signature, hmac_digest) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment