def decrypt_filedata(data, keys):
    '''Decrypts a file from Send'''
    # The last 16 bytes / 128 bits of data is the GCM tag
    # https://www.w3.org/TR/WebCryptoAPI/#aes-gcm-operations :-
    # 7. Let ciphertext be equal to C | T, where '|' denotes concatenation.
    data.seek(-16, 2)
    tag = data.read()

    # now truncate the file to only contain encrypted data
    data.seek(-16, 2)
    data.truncate()
    data.seek(0)

    plain = tempfile.NamedTemporaryFile(mode='w+b', delete=False)

    pbar = progbar(fileSize(data))

    obj = Cryptodome.Cipher.AES.new(keys.encryptKey, Cryptodome.Cipher.AES.MODE_GCM, keys.encryptIV)
    prev_chunk = b''
    for chunk in iter(lambda: data.read(CHUNK_SIZE), b''):
        plain.write(obj.decrypt(prev_chunk))
        pbar.update(len(chunk))
        prev_chunk = chunk

    plain.write(obj.decrypt_and_verify(prev_chunk, tag))
    data.close()
    pbar.close()

    plain.seek(0)
    return plain
Decrypts a file from Send