def make_token(cls, ephemeral_token): """ Returns a token to be used x number of times to allow a user account to access certain resource. """ value = ephemeral_token.key if ephemeral_token.scope: value += ''.join(ephemeral_token.scope) return get_hmac(cls.KEY_SALT + ephemeral_token.salt, value)[::2]
def get_notebook_token(self): return get_hmac(settings.APP_LABELS_NOTEBOOK, self.project_uuid)