Add QE setup tool support for BitTorrent downloads

Fixes #1871
This commit is contained in:
Joseph Schorr 2016-09-26 11:13:59 +02:00
parent 343d293001
commit 681f975df5
5 changed files with 84 additions and 2 deletions

View file

@ -21,7 +21,10 @@ def _load_private_key(private_key_file_path):
with open(private_key_file_path) as private_key_file:
return private_key_file.read()
def _torrent_jwt(info_dict):
def torrent_jwt(info_dict):
""" Returns an encoded JWT for the given information dictionary, signed by the local instance's
private key.
"""
token_data = {
'iss': instance_keys.service_name,
'aud': ANNOUNCE_URL,
@ -45,7 +48,7 @@ def make_torrent(name, webseed, length, piece_length, pieces):
}
return bencode.bencode({
'announce': ANNOUNCE_URL + "?jwt=" + _torrent_jwt(info_dict),
'announce': ANNOUNCE_URL + "?jwt=" + torrent_jwt(info_dict),
'url-list': webseed,
'encoding': 'UTF-8',
'created by': REGISTRY_TITLE,