The LocalBox store information about uploaded to the :doc:`remotebox` files, but doesn't store files. LocalBox may be reffered as RemoteBox cache. We use aiosqlite as database and three tables in it.
Note
DecryptedLocalBox
can be fully restored from DecryptedRemoteBox
.
LocalBox have 3 tables: BOX_DATA, FILES, FOLDERS.
BOX_DATA store information about Box, Session, etc.
LAST_FILE_ID | BOX_CHANNEL_ID | BOX_CR_TIME | BOX_SALT | MAINKEY | SESSION |
---|---|---|---|---|---|
BLOB | BLOB | BLOB | BLOB | BLOB|NULL | BLOB |
LAST_FILE_ID
— encrypted ID of last uploaded file;BOX_CHANNEL_ID
— encrypted RemoteBox ID;BOX_CR_TIME
— LocalBox creation time;BOX_SALT
— BoxSalt forMainKey
creation;MAINKEY
— encrypted byBaseKey
MainKey
. Used if RemoteBox was cloned;SESSION
— encoded & encrypted byBaseKey
Telethon'sStringSession
.
FILES store information about uploaded to the RemoteBox files.
ID {PRIMARY_KEY} | FOLDER_ID | COMMENT | DURATION | FILE_IV | FILE_KEY | FILE_NAME | FILE_SALT | PREVIEW | SIZE | UPLOAD_TIME | VERBYTE | FILE_PATH |
---|---|---|---|---|---|---|---|---|---|---|---|---|
INT | BLOB | BLOB | BLOB | BLOB | BLOB|NULL | BLOB | BLOB | BLOB | BLOB | BLOB | BLOB | BLOB |
Note
ID
is Telegram message ID. Must be unique.- You can read more about
FOLDER_ID
in :doc:`basis`. FILE_KEY
will notNULL
only when you import RemoteBoxFile from other'sRemoteBox
. In this case it's encrypted byMainKey
.
FOLDERS store information about every unique, case-sensitive foldername.
FOLDER | FOLDER_IV | FOLDER_ID |
---|---|---|
BLOB | BLOB | BLOB |
FOLDER
— encrypted byMainKey
&FOLDER_IV
foldername;FOLDER_IV
— AES CBC Initialization Vector forFOLDER
decryption;FOLDER_ID
— result oftools.make_folder_id
function. See :doc:`basis`.