diff --git a/next.py b/next.py index d6ce19c..8e8a9f8 100644 --- a/next.py +++ b/next.py @@ -9,11 +9,15 @@ # TODO: inode_id -> actuall Inode lookup table # TODO: Add chareable folders: # TODO: No more 'tokens' -> write-key for address-gen and read-key for encryption -# TODO: Change iota receive adress to next adress (encrypted with read-key) +# TODO: Change iota receive address to last adress (encrypted using read-key + hashed) +# -> relation of different transactions as part of the file/dir-structore stays hidden; +# but someone with the read-key of a directory/file is able to traverse the associated blockchain one by one # TODO: Add share-functionality: # 1. publish read-key of the directory # 2. publish public adress of current milestone-block # Problem: No updateable milestone-index... -> Create share-genesis? +# Problem: When sharing a single file, updates are not received... -> new file-blobs reverence old one via rec-address +# TODO: ? Switch to salsa20 stream-cipher -> no padding required -> 2187 as blocksize instead of 2176 -> .5% more from iota import Iota, ProposedTransaction, Address, TryteString, Tag from iota.crypto.addresses import AddressGenerator @@ -27,11 +31,9 @@ import math from pprint import pprint import hashlib import sys -import random import time import msgpack -import copy import gzip import secrets @@ -50,7 +52,10 @@ except ImportError: else: faulthandler.enable() -CHUNKSIZE = 2187 +# For RAW: +#CHUNKSIZE = 2187 +# For AES: +CHUNKSIZE = 2176 SYNCWRITES = True def log(txt): @@ -257,6 +262,7 @@ class TangleBlob(): if bundles: sendEmOff(bundles, self.iotaApi) + class TangleFileTreeElement(TangleBlob): def __init__(self, name: str, lastMilestoneIndex: int, parent, iotaApi: Iota) -> None: if isinstance(parent, bytes): @@ -444,6 +450,8 @@ class TangleFile(): self.hash = hashlib.sha256(newData).digest() self.writeKey = hashlib.sha3_384(b'f' + self.parent.writeKey + self.hash).digest() self.readKey = hashlib.sha3_384(b'f' + self.parent.readKey + self.hash).digest() + # Maybe this way the gc will remove it quicker? + del self.blob self.blob = TangleBlob(self.writeKey, self.readKey, self.iotaApi) self.blob.append(newData) self.size = self.blob.getSize()