snipt/utils/templatetags/intercom.py

10 lines
249 B
Python
Raw Normal View History

2014-08-18 09:01:33 -07:00
from django import template
2014-10-20 08:50:04 -07:00
import hmac, hashlib, os
2014-08-18 09:01:33 -07:00
register = template.Library()
@register.filter
def intercom_sha_256(user_id):
2014-10-20 11:11:23 -07:00
return hmac.new(os.environ.get('INTERCOM_SECRET_KEY', ''), str(user_id), digestmod=hashlib.sha256).hexdigest()