dddp/accounts/ddp.py
def iter_auth_hashes(user, purpose, minutes_valid):
    """
    Generate auth tokens tied to user and specified purpose.

    The hash expires at midnight on the minute of now + minutes_valid, such
    that when minutes_valid=1 you get *at least* 1 minute to use the token.
    """
    now = timezone.now().replace(microsecond=0, second=0)
    for minute in range(minutes_valid + 1):
        yield hashlib.sha1(
            '%s:%s:%s:%s:%s' % (
                now - datetime.timedelta(minutes=minute),
                user.password,
                purpose,
                user.pk,
                settings.SECRET_KEY,
            ),
        ).hexdigest()
def iter_auth_hashes(user, purpose, minutes_valid):
    """
    Generate auth tokens tied to user and specified purpose.

    The hash expires at midnight on the minute of now + minutes_valid, such
    that when minutes_valid=1 you get *at least* 1 minute to use the token.
    """
    now = timezone.now().replace(microsecond=0, second=0)
    for minute in range(minutes_valid + 1):
        yield hashlib.sha1(
            '%s:%s:%s:%s:%s' % (
                now - datetime.timedelta(minutes=minute),
                user.password,
                purpose,
                user.pk,
                settings.SECRET_KEY,
            ),
        ).hexdigest()
Generate auth tokens tied to user and specified purpose.

    The hash expires at midnight on the minute of now + minutes_valid, such
    that when minutes_valid=1 you get *at least* 1 minute to use the token.