renaming in comrad?

Comrad
quadrismegistus 4 years ago
parent 31536499ea
commit e56ef03e65

@ -1,6 +1,6 @@
ANTI-CAPITALIST SOFTWARE LICENSE (v 1.4) ANTI-CAPITALIST SOFTWARE LICENSE (v 1.4)
Copyright © 2020 Komrades Copyright © 2020 Comrads
This is anti-capitalist software, released for free use by individuals and organizations that do not operate by capitalist principles. This is anti-capitalist software, released for free use by individuals and organizations that do not operate by capitalist principles.

@ -1,6 +1,6 @@
# Komrade # Comrad
Komrade is a socialist network. It seizes the means of digital production. Comrad is a socialist network. It seizes the means of digital production.
## Why another social network? ## Why another social network?
@ -16,7 +16,7 @@ All of your data are strongly encrypted end-to-end: only you and those you write
### Untraceable ### Untraceable
All network traffic is routed through Tor, a "deep web" of computers so dense even the FBI can't follow you through it. Komrade's "Operator" or central server is accessible only from Tor. It's impossible to tell who is sending what to whom, or even who is using the app at all. All network traffic is routed through Tor, a "deep web" of computers so dense even the FBI can't follow you through it. Comrad's "Operator" or central server is accessible only from Tor. It's impossible to tell who is sending what to whom, or even who is using the app at all.
### Unmonetizable ### Unmonetizable
@ -28,7 +28,7 @@ Group accounts or 'collectives', like @portland or @socialists, grow as existing
### (Semi-)decentralized ### (Semi-)decentralized
Data is deleted as soon as possible from Komrade. Komrade's "Operator" simply sorts and holds the mail temporarily: as soon as users log in to download their mail, the messages are deleted from the server and network forever. Data is deleted as soon as possible from Comrad. Comrad's "Operator" simply sorts and holds the mail temporarily: as soon as users log in to download their mail, the messages are deleted from the server and network forever.
### Anti-profit ### Anti-profit
@ -67,19 +67,19 @@ We present a simplified set of social media features drawn from everything that'
## How is this different from ...? ## How is this different from ...?
See ["Comparison of alternative social networks" on the wiki](https://github.com/Komrade/Komrade/wiki/Comparison-of-alternative-social-networks) for an attempt at a systematic comparison. (And please help edit, if you can! The data there is a little incomplete and probably a little inaccurate.) But here are some imagined differences: See ["Comparison of alternative social networks" on the wiki](https://github.com/Comrad/Comrad/wiki/Comparison-of-alternative-social-networks) for an attempt at a systematic comparison. (And please help edit, if you can! The data there is a little incomplete and probably a little inaccurate.) But here are some imagined differences:
* **It's not (fully) decentralized.** Who's afraid of a little central planning? In contrast to [Secure Scuttlebutt](https://scuttlebutt.nz/) and [Cabal Chat](https://cabal.chat/), which are 100% decentralized, subsisting only through peer-to-peer connections, Komrade sticks with the old, client/server model. Why? * **It's not (fully) decentralized.** Who's afraid of a little central planning? In contrast to [Secure Scuttlebutt](https://scuttlebutt.nz/) and [Cabal Chat](https://cabal.chat/), which are 100% decentralized, subsisting only through peer-to-peer connections, Comrad sticks with the old, client/server model. Why?
* **It *is* anonymous.** Because P2P networks almost always expose your IP address: they privilege decentralization over anonymity -- and, potentially, safety. By contrast, lying hidden within the deep web of Tor, accessible only from this application and its built-in Tor client, Komrade will never reveal who is accessing it and its encrypted information. This is important for komrades organizing protests against the surveillance state, and to protect our social media traffic from being harvested and monetized by surveillance capitalism. * **It *is* anonymous.** Because P2P networks almost always expose your IP address: they privilege decentralization over anonymity -- and, potentially, safety. By contrast, lying hidden within the deep web of Tor, accessible only from this application and its built-in Tor client, Comrad will never reveal who is accessing it and its encrypted information. This is important for comrads organizing protests against the surveillance state, and to protect our social media traffic from being harvested and monetized by surveillance capitalism.
* **It's 100% end-to-end encrypted.** Unlike [Mastodon](https://joinmastodon.org/) or [Diaspora](https://diasporafoundation.org/), direct messages between users and within groups remain encrypted 1:1 end-to-end among users. Posts to the public are encrypted to @komrades, a special account which automatically re-encrypts its messages back to any key-registered requester of them. * **It's 100% end-to-end encrypted.** Unlike [Mastodon](https://joinmastodon.org/) or [Diaspora](https://diasporafoundation.org/), direct messages between users and within groups remain encrypted 1:1 end-to-end among users. Posts to the public are encrypted to @comrads, a special account which automatically re-encrypts its messages back to any key-registered requester of them.
* **It verifies identities.** Komrade's server, "The Operator", keeps a permanent record of one thing only: every komrade's name and public key, and requires that new komrades choose a unique name. Whenever you send or receive mail, the Operator will make sure that the name and public key on the letter matches what it has on file, verifying the identity of both parties. * **It verifies identities.** Comrad's server, "The Operator", keeps a permanent record of one thing only: every comrad's name and public key, and requires that new comrads choose a unique name. Whenever you send or receive mail, the Operator will make sure that the name and public key on the letter matches what it has on file, verifying the identity of both parties.
* **It's (semi-)ephemeral.** Data, like all natural things, should not last forever. Direct messages auto-delete from the server as soon as they are downloaded. Group messages are sent as direct messages through the "web of trust" of the group membership network. Posts to the world auto-delete in however many days you specify. By contrast, data on both [SSB](https://scuttlebutt.nz/) and [Matrix](https://matrix.org/) is undeletable. * **It's (semi-)ephemeral.** Data, like all natural things, should not last forever. Direct messages auto-delete from the server as soon as they are downloaded. Group messages are sent as direct messages through the "web of trust" of the group membership network. Posts to the world auto-delete in however many days you specify. By contrast, data on both [SSB](https://scuttlebutt.nz/) and [Matrix](https://matrix.org/) is undeletable.
* **It's easy to use.** No invitation or server is needed on startup, unlike [SSB](https://scuttlebutt.nz/), [Mastodon](https://joinmastodon.org/), [Diaspora](https://diasporafoundation.org/), or [Briar](https://briarproject.org/). It's basically a Twitter clone, but one where you can also post to a universal feed shared by the entire world (@komrades), so that you can make yourself known, participate in general discussions, find new contacts, and organize new groups. * **It's easy to use.** No invitation or server is needed on startup, unlike [SSB](https://scuttlebutt.nz/), [Mastodon](https://joinmastodon.org/), [Diaspora](https://diasporafoundation.org/), or [Briar](https://briarproject.org/). It's basically a Twitter clone, but one where you can also post to a universal feed shared by the entire world (@comrads), so that you can make yourself known, participate in general discussions, find new contacts, and organize new groups.
@ -90,30 +90,30 @@ See ["Comparison of alternative social networks" on the wiki](https://github.com
#### Registering and connecting through Tor #### Registering and connecting through Tor
<img src="komrade/app/assets/komrade-screen-preview-2020-09-27.gif" alt="GIF animation" height="600" /> <img src="comrad/app/assets/comrad-screen-preview-2020-09-27.gif" alt="GIF animation" height="600" />
#### Navigating posts #### Navigating posts
<img src="komrade/app/assets/komrade-screen-preview-2020-08-23.gif" alt="GIF animation" height="600" /> <img src="comrad/app/assets/comrad-screen-preview-2020-08-23.gif" alt="GIF animation" height="600" />
### Animations from terminal app ### Animations from terminal app
#### Connecting through Tor #### Connecting through Tor
<img src="komrade/app/assets/komrade-terminal-preview--2020-09-20--tor.gif" alt="GIF animation of Tor connection" /> <img src="comrad/app/assets/comrad-terminal-preview--2020-09-20--tor.gif" alt="GIF animation of Tor connection" />
#### "Meeting" (exchanging public keys) #### "Meeting" (exchanging public keys)
<img src="komrade/app/assets/komrade-terminal-preview--2020-09-16--meet.gif" alt="GIF animation of meeting process" /> <img src="comrad/app/assets/comrad-terminal-preview--2020-09-16--meet.gif" alt="GIF animation of meeting process" />
#### Messaging #### Messaging
<img src="komrade/app/assets/komrade-terminal-preview--2020-09-16--msg.gif" alt="GIF animation of messaging" /> <img src="comrad/app/assets/comrad-terminal-preview--2020-09-16--msg.gif" alt="GIF animation of messaging" />
### Posting ### Posting
<img src="komrade/app/assets/komrade-terminal-preview--2020-09-19--posting.gif" alt="GIF animation of posting" /> <img src="comrad/app/assets/comrad-terminal-preview--2020-09-19--posting.gif" alt="GIF animation of posting" />
## Usage ## Usage
@ -122,17 +122,17 @@ See ["Comparison of alternative social networks" on the wiki](https://github.com
#### ...on Mac OSX #### ...on Mac OSX
Download and run [this installer](https://github.com/Komrade/Komrade/raw/master/script/InstallKomrade.app.zip). Download and run [this installer](https://github.com/Comrad/Comrad/raw/master/script/InstallComrad.app.zip).
#### ...on Linux or Windows #### ...on Linux or Windows
Open a terminal in Linux, or a [Cygwin shell](https://cygwin.com/install.html) in Windows, and copy and paste the following line into it: Open a terminal in Linux, or a [Cygwin shell](https://cygwin.com/install.html) in Windows, and copy and paste the following line into it:
``` ```
bash <(curl -s https://komrade.app/run) bash <(curl -s https://comrad.app/run)
``` ```
[That](https://komrade.app/run)'s a shortcut to [this auto-installer script](https://github.com/Komrade/Komrade/blob/master/script/install). It installs Komrade in a virtual Python environment in the folder "komrade" in your home directory. [That](https://comrad.app/run)'s a shortcut to [this auto-installer script](https://github.com/Comrad/Comrad/blob/master/script/install). It installs Comrad in a virtual Python environment in the folder "comrad" in your home directory.
### Run ### Run
@ -140,7 +140,7 @@ bash <(curl -s https://komrade.app/run)
Install [as above](#on-mac-osx). Install [as above](#on-mac-osx).
Run "Komrade.app" in your Applications folder. Run "Comrad.app" in your Applications folder.
#### ...on Linux or Windows #### ...on Linux or Windows
@ -148,23 +148,23 @@ Run "Komrade.app" in your Applications folder.
Open a terminal in Linux, or a [Cygwin shell](https://cygwin.com/install.html) in Windows, and type: Open a terminal in Linux, or a [Cygwin shell](https://cygwin.com/install.html) in Windows, and type:
``` ```
komrade-app comrad-app
``` ```
If that doesn't work, try: If that doesn't work, try:
``` ```
~/komrade/code/bin/komrade-app ~/comrad/code/bin/comrad-app
``` ```
If that still doesn't work, try pasting the following lines: If that still doesn't work, try pasting the following lines:
``` ```
source ~/komrade/lib/miniconda3/etc/profile.d/conda.sh source ~/comrad/lib/miniconda3/etc/profile.d/conda.sh
export PATH="~/komrade/lib/miniconda3/bin:$PATH" export PATH="~/comrad/lib/miniconda3/bin:$PATH"
conda activate ~/komrade/code/venv conda activate ~/comrad/code/venv
python -m pip install -r ~/komrade/code/requirements.txt python -m pip install -r ~/comrad/code/requirements.txt
python ~/komrade/code/komrade/app/main.py python ~/comrad/code/comrad/app/main.py
``` ```
#### Running terminal client #### Running terminal client
@ -172,17 +172,17 @@ python ~/komrade/code/komrade/app/main.py
For the terminal client (which may be broken at the moment), run: For the terminal client (which may be broken at the moment), run:
``` ```
komrade-cli # or: ~/komrade/code/bin/komrade-cli comrad-cli # or: ~/comrad/code/bin/comrad-cli
``` ```
or, if necessary, paste the following lines: or, if necessary, paste the following lines:
``` ```
source ~/komrade/lib/miniconda3/etc/profile.d/conda.sh source ~/comrad/lib/miniconda3/etc/profile.d/conda.sh
export PATH="~/komrade/lib/miniconda3/bin:$PATH" export PATH="~/comrad/lib/miniconda3/bin:$PATH"
conda activate ~/komrade/code/venv conda activate ~/comrad/code/venv
python -m pip install -r ~/komrade/code/requirements.txt python -m pip install -r ~/comrad/code/requirements.txt
python ~/komrade/code/komrade/cli/cli.py python ~/comrad/code/comrad/cli/cli.py
``` ```
#### Running server (development only) #### Running server (development only)
@ -191,17 +191,17 @@ python ~/komrade/code/komrade/cli/cli.py
To run The Operator server (for development purposes only), run: To run The Operator server (for development purposes only), run:
``` ```
komrade-op # or: ~/komrade/code/bin/komrade-op comrad-op # or: ~/comrad/code/bin/comrad-op
``` ```
or, if necessary, paste the following lines: or, if necessary, paste the following lines:
``` ```
source ~/komrade/lib/miniconda3/etc/profile.d/conda.sh source ~/comrad/lib/miniconda3/etc/profile.d/conda.sh
export PATH="~/komrade/lib/miniconda3/bin:$PATH" export PATH="~/comrad/lib/miniconda3/bin:$PATH"
conda activate ~/komrade/code/venv conda activate ~/comrad/code/venv
python -m pip install -r ~/komrade/code/requirements.txt python -m pip install -r ~/comrad/code/requirements.txt
python ~/komrade/code/komrade/backend/switchboard.py python ~/comrad/code/comrad/backend/switchboard.py
``` ```
@ -211,17 +211,17 @@ python ~/komrade/code/komrade/backend/switchboard.py
#### Mobile/desktop #### Mobile/desktop
The mobile/desktop app is made with [KivyMD](https://github.com/kivymd/KivyMD), a variant of [Kivy](https://kivy.org/), a cross-platform app development framework in Python. Python is an easy and versatile progamming language to learn, which keeps the code accessible to as many people as possible. Code for the app is in [komrade/app](komrade/app). The mobile/desktop app is made with [KivyMD](https://github.com/kivymd/KivyMD), a variant of [Kivy](https://kivy.org/), a cross-platform app development framework in Python. Python is an easy and versatile progamming language to learn, which keeps the code accessible to as many people as possible. Code for the app is in [comrad/app](comrad/app).
#### Terminal app #### Terminal app
Vanilla Python. Code is in [komrade/cli](komrade/cli). Vanilla Python. Code is in [comrad/cli](comrad/cli).
### Backend ### Backend
#### API #### API
Plain old object-oriented code in Python. The root entity is a "Keymaker": anyone from @Telephone, to @Operator, to users, to groups, who has a public/private key pair. The database uses a simple file-based key-value store using the Redis protocol: [rlite](https://github.com/seppo0010/rlite), via its [rlite-py](https://github.com/seppo0010/rlite-py) Python bindings. All code for backend/API is in [komrade/backend](komrade/backend). Plain old object-oriented code in Python. The root entity is a "Keymaker": anyone from @Telephone, to @Operator, to users, to groups, who has a public/private key pair. The database uses a simple file-based key-value store using the Redis protocol: [rlite](https://github.com/seppo0010/rlite), via its [rlite-py](https://github.com/seppo0010/rlite-py) Python bindings. All code for backend/API is in [comrad/backend](comrad/backend).
#### Cryptography #### Cryptography
@ -229,9 +229,9 @@ We are using [Themis](https://github.com/cossacklabs/themis), a high-level cross
Crypto-related code is primarily in: Crypto-related code is primarily in:
* [komrade/backend/keymaker.py](komrade/backend/keymaker.py) * [comrad/backend/keymaker.py](comrad/backend/keymaker.py)
* [komrade/backend/komrades.py](komrade/backend/komrades.py) * [comrad/backend/comrads.py](comrad/backend/comrads.py)
* [komrade/backend/phonelines.py](komrade/backend/phonelines.py) * [comrad/backend/phonelines.py](comrad/backend/phonelines.py)

@ -1,6 +1,6 @@
path_conda="`realpath ~/komrade/lib/miniconda3`" path_conda="`realpath ~/comrad/lib/miniconda3`"
path_venv="`realpath ~/komrade/code/venv`" path_venv="`realpath ~/comrad/code/venv`"
path_repo="`realpath ~/komrade/code`" path_repo="`realpath ~/comrad/code`"
source $path_conda/etc/profile.d/conda.sh source $path_conda/etc/profile.d/conda.sh
export PATH="$path_conda/bin:$PATH" export PATH="$path_conda/bin:$PATH"

@ -14,8 +14,8 @@ if [ ! "$y_n" = "y" ]; then
else else
rm -r $path rm -r $path
#echo "Reregistering..." #echo "Reregistering..."
#komrade-cli /register #comrad-cli /register
cd $path_code cd $path_code
python -c "from komrade import *; create_phonelines()" python -c "from comrad import *; create_phonelines()"
komrade-update comrad-update
fi fi

@ -10,12 +10,12 @@ realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
} }
path_conda="`realpath ~/komrade/lib/miniconda3`" path_conda="`realpath ~/comrad/lib/miniconda3`"
path_venv="`realpath ~/komrade/code/venv`" path_venv="`realpath ~/comrad/code/venv`"
path_repo="`realpath ~/komrade/code`" path_repo="`realpath ~/comrad/code`"
source $path_conda/etc/profile.d/conda.sh source $path_conda/etc/profile.d/conda.sh
export PATH=\"$path_conda/bin:\$PATH\" export PATH=\"$path_conda/bin:\$PATH\"
conda activate $path_venv conda activate $path_venv
python -m pip install -r $path_repo/requirements.txt python -m pip install -r $path_repo/requirements.txt
python $path_repo/komrade/app/main.py python $path_repo/comrad/app/main.py

@ -7,12 +7,12 @@ realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
} }
path_conda="`realpath ~/komrade/lib/miniconda3`" path_conda="`realpath ~/comrad/lib/miniconda3`"
path_venv="`realpath ~/komrade/code/venv`" path_venv="`realpath ~/comrad/code/venv`"
path_repo="`realpath ~/komrade/code`" path_repo="`realpath ~/comrad/code`"
source $path_conda/etc/profile.d/conda.sh source $path_conda/etc/profile.d/conda.sh
export PATH="$path_conda/bin:$PATH" export PATH="$path_conda/bin:$PATH"
conda activate $path_venv conda activate $path_venv
python -m pip install -r $path_repo/requirements.txt python -m pip install -r $path_repo/requirements.txt
python $path_repo/komrade/cli/cli.py python $path_repo/comrad/cli/cli.py

@ -7,13 +7,13 @@ realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
} }
path_conda="`realpath ~/komrade/lib/miniconda3`" path_conda="`realpath ~/comrad/lib/miniconda3`"
path_venv="`realpath ~/komrade/code/venv`" path_venv="`realpath ~/comrad/code/venv`"
path_repo="`realpath ~/komrade/code`" path_repo="`realpath ~/comrad/code`"
source $path_conda/etc/profile.d/conda.sh source $path_conda/etc/profile.d/conda.sh
export PATH="$path_conda/bin:$PATH" export PATH="$path_conda/bin:$PATH"
conda activate $path_venv conda activate $path_venv
python -m pip install -r $path_repo/requirements.txt python -m pip install -r $path_repo/requirements.txt
python $path_repo/komrade/backend/switchboard.py python $path_repo/comrad/backend/switchboard.py

@ -13,5 +13,5 @@ if [ ! "$y_n" = "y" ]; then
else else
rm -r $path rm -r $path
#echo "Reregistering..." #echo "Reregistering..."
#komrade-cli /register #comrad-cli /register
fi fi

@ -5,6 +5,6 @@ path=`realpath "$SCRIPTPATH/.."`
cd $path cd $path
git pull git pull
git add . git add .
git commit -m 'komrade update!' git commit -m 'comrad update!'
git push git push
cd $wd cd $wd

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Before

Width:  |  Height:  |  Size: 286 KiB

After

Width:  |  Height:  |  Size: 286 KiB

Before

Width:  |  Height:  |  Size: 591 KiB

After

Width:  |  Height:  |  Size: 591 KiB

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 84 KiB

Before

Width:  |  Height:  |  Size: 159 KiB

After

Width:  |  Height:  |  Size: 159 KiB

Before

Width:  |  Height:  |  Size: 243 KiB

After

Width:  |  Height:  |  Size: 243 KiB

Before

Width:  |  Height:  |  Size: 333 KiB

After

Width:  |  Height:  |  Size: 333 KiB

Before

Width:  |  Height:  |  Size: 276 KiB

After

Width:  |  Height:  |  Size: 276 KiB

Before

Width:  |  Height:  |  Size: 276 KiB

After

Width:  |  Height:  |  Size: 276 KiB

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Before

Width:  |  Height:  |  Size: 568 KiB

After

Width:  |  Height:  |  Size: 568 KiB

Before

Width:  |  Height:  |  Size: 9.7 MiB

After

Width:  |  Height:  |  Size: 9.7 MiB

Before

Width:  |  Height:  |  Size: 9.7 MiB

After

Width:  |  Height:  |  Size: 9.7 MiB

Before

Width:  |  Height:  |  Size: 398 KiB

After

Width:  |  Height:  |  Size: 398 KiB

Before

Width:  |  Height:  |  Size: 384 KiB

After

Width:  |  Height:  |  Size: 384 KiB

Before

Width:  |  Height:  |  Size: 9.7 MiB

After

Width:  |  Height:  |  Size: 9.7 MiB

Before

Width:  |  Height:  |  Size: 9.7 MiB

After

Width:  |  Height:  |  Size: 9.7 MiB

Before

Width:  |  Height:  |  Size: 9.7 MiB

After

Width:  |  Height:  |  Size: 9.7 MiB

Before

Width:  |  Height:  |  Size: 491 KiB

After

Width:  |  Height:  |  Size: 491 KiB

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Before

Width:  |  Height:  |  Size: 7.1 MiB

After

Width:  |  Height:  |  Size: 7.1 MiB

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

Before

Width:  |  Height:  |  Size: 923 KiB

After

Width:  |  Height:  |  Size: 923 KiB

Before

Width:  |  Height:  |  Size: 491 KiB

After

Width:  |  Height:  |  Size: 491 KiB

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Before

Width:  |  Height:  |  Size: 224 KiB

After

Width:  |  Height:  |  Size: 224 KiB

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 151 KiB

Before

Width:  |  Height:  |  Size: 246 KiB

After

Width:  |  Height:  |  Size: 246 KiB

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Before

Width:  |  Height:  |  Size: 202 KiB

After

Width:  |  Height:  |  Size: 202 KiB

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

@ -3,7 +3,7 @@
#(needs to be external to allow tor routing) #(needs to be external to allow tor routing)
from config import * from config import *
import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..'))) import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..')))
from komrade import * from comrad import *
import logging import logging
logger=logging.getLogger(__name__) logger=logging.getLogger(__name__)
@ -60,6 +60,7 @@ sys.path.append("..") # Adds higher directory to python modules path.
from kivy.event import * from kivy.event import *
import threading,asyncio,sys import threading,asyncio,sys
from requests.exceptions import ReadTimeout
# raise Exception(str(Window.size)) # raise Exception(str(Window.size))
Window.size = WINDOW_SIZE Window.size = WINDOW_SIZE
@ -100,19 +101,19 @@ class MyLayout(MDBoxLayout):
def refresh(self,*x,**yy): def refresh(self,*x,**yy):
async def go(): async def go():
if not hasattr(self.app,'is_logged_in') or not self.app.is_logged_in or not hasattr(self.app,'komrade') or not self.app.komrade: if not hasattr(self.app,'is_logged_in') or not self.app.is_logged_in or not hasattr(self.app,'comrad') or not self.app.comrad:
self.change_screen('login') self.change_screen('login')
self.app.log('changing screen???') self.app.log('changing screen???')
return None return None
logger.info(f'REFRESH: {self.app.is_logged_in}, {self.app.komrade.name}') logger.info(f'REFRESH: {self.app.is_logged_in}, {self.app.comrad.name}')
self.app.log('<--',x,yy) self.app.log('<--',x,yy)
if not hasattr(self.app,'map') or not self.app.map: if not hasattr(self.app,'map') or not self.app.map:
from komrade.app.screens.map import MapWidget from comrad.app.screens.map import MapWidget
self.app.map=MapWidget() self.app.map=MapWidget()
self.app.map.open() self.app.map.open()
await self.app.komrade.get_updates() await self.app.comrad.get_updates()
self.app.map.dismiss() self.app.map.dismiss()
self.app.map=None self.app.map=None
asyncio.create_task(go()) asyncio.create_task(go())
@ -120,7 +121,7 @@ class MyLayout(MDBoxLayout):
from komrade.app.screens.dialog import MDDialog2 from comrad.app.screens.dialog import MDDialog2
@ -172,11 +173,11 @@ class TextInputPopupCard(MDDialog2):
return self.response return self.response
def __init__(self,msg,password=False,input_name='',komrade_name='',*x,**y): def __init__(self,msg,password=False,input_name='',comrad_name='',*x,**y):
self.ok_to_continue=False self.ok_to_continue=False
self.response=None self.response=None
title=msg title=msg
from komrade.app.screens.login.login import UsernameField,PasswordField,UsernameLayout,UsernameLabel from comrad.app.screens.login.login import UsernameField,PasswordField,UsernameLayout,UsernameLabel
self.layout=MDBoxLayout() self.layout=MDBoxLayout()
self.layout.orientation='vertical' self.layout.orientation='vertical'
@ -407,7 +408,7 @@ def route(uri):
# DEFAULT_SCREEN = route(DEFAULT_URI) # DEFAULT_SCREEN = route(DEFAULT_URI)
class MainApp(MDApp, Logger): class MainApp(MDApp, Logger):
title = 'Komrade' title = 'Comrad'
logged_in=False logged_in=False
login_expiry = 60 * 60 * 24 * 7 # once a week login_expiry = 60 * 60 * 24 * 7 # once a week
texture = ObjectProperty() texture = ObjectProperty()
@ -424,7 +425,7 @@ class MainApp(MDApp, Logger):
@property @property
def crypt(self): def crypt(self):
if not hasattr(self,'_crypt'): if not hasattr(self,'_crypt'):
from komrade.backend.crypt import Crypt from comrad.backend.crypt import Crypt
self._crypt = Crypt( self._crypt = Crypt(
fn=PATH_CRYPT_CA_DATA, fn=PATH_CRYPT_CA_DATA,
encrypt_values=False, encrypt_values=False,
@ -437,7 +438,7 @@ class MainApp(MDApp, Logger):
self.loop=asyncio.get_event_loop() self.loop=asyncio.get_event_loop()
# connect to API # connect to API
self.komrade=None self.comrad=None
self._name='' self._name=''
@ -471,13 +472,13 @@ class MainApp(MDApp, Logger):
ipinfo_access_token = '90df1baf7c373a' ipinfo_access_token = '90df1baf7c373a'
self.ipinfo_handler = ipinfo.getHandler(ipinfo_access_token) self.ipinfo_handler = ipinfo.getHandler(ipinfo_access_token)
from komrade.app.screens.map import MapWidget from comrad.app.screens.map import MapWidget
self.map = MapWidget() self.map = MapWidget()
return self.root return self.root
# def boot(self,username): # def boot(self,username):
# kommie = Komrade(username) # kommie = Comrad(username)
# if self.exists_locally_as_contact() # if self.exists_locally_as_contact()
@property @property
@ -490,21 +491,25 @@ class MainApp(MDApp, Logger):
async def callback_on_hop(self,rtr): async def callback_on_hop(self,rtr):
if not hasattr(self,'hops'): self.hops=[] if not hasattr(self,'hops'): self.hops=[]
if not hasattr(self,'map') or not self.map: if not hasattr(self,'map') or not self.map:
from komrade.app.screens.map import MapWidget from comrad.app.screens.map import MapWidget
self.map=MapWidget() self.map=MapWidget()
if not self.map.opened: if not self.map.opened:
self.map.open() self.map.open()
# self.map.draw() # self.map.draw()
deets = self.ipinfo_handler.getDetails(rtr.ip) try:
self.hops.append((rtr,deets)) deets = self.ipinfo_handler.getDetails(rtr.ip)
lat,long=tuple(float(_) for _ in deets.loc.split(',')) self.hops.append((rtr,deets))
flag=f'{deets.city}, {deets.country_name} ({rtr.nickname})' lat,long=tuple(float(_) for _ in deets.loc.split(','))
flag=f'{deets.city}, {deets.country_name} ({rtr.nickname})'
self.map.add_point(lat,long,flag)
self.map.draw() self.map.add_point(lat,long,flag)
# await asyncio.sleep(2) self.map.draw()
# logger.info('CALLBACK ON HOP: ' + flag) # await asyncio.sleep(2)
# logger.info('CALLBACK ON HOP: ' + flag)
except ReadTimeout as e:
self.log('!! read time out:',e)
return
def load_store(self): def load_store(self):
if not self.store.exists('user'): return if not self.store.exists('user'): return
@ -605,15 +610,15 @@ class MainApp(MDApp, Logger):
@property @property
def keys(self): def keys(self):
contacts_obj = self.komrade.contacts() contacts_obj = self.comrad.contacts()
contacts = [p.name for p in contacts_obj] contacts = [p.name for p in contacts_obj]
return contacts return contacts
async def get_post(self,post_id): async def get_post(self,post_id):
return self.komrade.read_post() return self.comrad.read_post()
def get_posts(self,uri=b'/inbox/world'): def get_posts(self,uri=b'/inbox/world'):
return self.komrade.posts() return self.comrad.posts()
async def get_channel_posts(self,channel,prefix='inbox'): async def get_channel_posts(self,channel,prefix='inbox'):
@ -630,7 +635,7 @@ class MainApp(MDApp, Logger):
return await self.get_channel_posts(channel=channel,prefix='outbox') return await self.get_channel_posts(channel=channel,prefix='outbox')
async def get_my_posts(self): async def get_my_posts(self):
return await self.komrade.posts() return await self.comrad.posts()
@ -663,17 +668,17 @@ class MainApp(MDApp, Logger):
self.dialog.open() self.dialog.open()
#stop #stop
async def get_input(self,msg,komrade_name='Telephone',get_pass=False,yesno=False,**y): async def get_input(self,msg,comrad_name='Telephone',get_pass=False,yesno=False,**y):
from komrade.app.screens.feed.feed import PostCardInputPopup from comrad.app.screens.feed.feed import PostCardInputPopup
if hasattr(self,'msg_dialog') and self.msg_dialog:# and hasattr(self.msg_dialog,'card') and self.msg_dialog.card: if hasattr(self,'msg_dialog') and self.msg_dialog:# and hasattr(self.msg_dialog,'card') and self.msg_dialog.card:
self.msg_dialog0=self.msg_dialog self.msg_dialog0=self.msg_dialog
self.msg_dialog0.dismiss() self.msg_dialog0.dismiss()
self.msg_dialog0=None self.msg_dialog0=None
if yesno: if yesno:
self.msg_dialog = BooleanInputPopupCard(msg,komrade_name=komrade_name,**y) self.msg_dialog = BooleanInputPopupCard(msg,comrad_name=comrad_name,**y)
else: else:
self.msg_dialog = TextInputPopupCard(msg,password=get_pass,komrade_name=komrade_name,**y) self.msg_dialog = TextInputPopupCard(msg,password=get_pass,comrad_name=comrad_name,**y)
response = await self.msg_dialog.open() response = await self.msg_dialog.open()
logger.info(f'get_input got user response {response}') logger.info(f'get_input got user response {response}')
@ -684,8 +689,8 @@ class MainApp(MDApp, Logger):
return response return response
async def ring_ring(self,*x,kommie=None,**y): async def ring_ring(self,*x,kommie=None,**y):
if not kommie: kommie=self.komrade if not kommie: kommie=self.comrad
from komrade.app.screens.map import MapWidget from comrad.app.screens.map import MapWidget
self.map=MapWidget() self.map=MapWidget()
self.map.open() self.map.open()
resp_msg_d = await kommie.ring_ring(*x,**y) resp_msg_d = await kommie.ring_ring(*x,**y)
@ -696,8 +701,8 @@ class MainApp(MDApp, Logger):
async def get_updates(self,*x,kommie=None,**y): async def get_updates(self,*x,kommie=None,**y):
if not kommie: kommie=self.komrade if not kommie: kommie=self.comrad
from komrade.app.screens.map import MapWidget from comrad.app.screens.map import MapWidget
self.map=MapWidget() self.map=MapWidget()
self.map.open() self.map.open()
await kommie.get_updates(*x,**y) await kommie.get_updates(*x,**y)
@ -707,8 +712,8 @@ class MainApp(MDApp, Logger):
async def stat(self,msg,komrade_name='Telephone',pause=False,get_pass=False,**y): async def stat(self,msg,comrad_name='Telephone',pause=False,get_pass=False,**y):
from komrade.app.screens.feed.feed import PostCard,PostCardPopup from comrad.app.screens.feed.feed import PostCard,PostCardPopup
if hasattr(self,'msg_dialog') and self.msg_dialog:# and hasattr(self.msg_dialog,'card') and self.msg_dialog.card: if hasattr(self,'msg_dialog') and self.msg_dialog:# and hasattr(self.msg_dialog,'card') and self.msg_dialog.card:
self.msg_dialog0=self.msg_dialog self.msg_dialog0=self.msg_dialog
self.msg_dialog0.dismiss() self.msg_dialog0.dismiss()
@ -720,7 +725,7 @@ class MainApp(MDApp, Logger):
# self.msg_dialog.ids.msg_label.text=msg # self.msg_dialog.ids.msg_label.text=msg
self.msg_dialog.card = postcard = PostCardPopup({ self.msg_dialog.card = postcard = PostCardPopup({
'author':komrade_name, 'author':comrad_name,
'author_prefix':'@', 'author_prefix':'@',
'to_name':'me', 'to_name':'me',
'content':msg, 'content':msg,

@ -5,7 +5,7 @@ from kivymd.uix.label import MDLabel
from kivy.app import App from kivy.app import App
import asyncio import asyncio
from kivymd.uix.dialog import MDDialog from kivymd.uix.dialog import MDDialog
from komrade.app.screens.dialog import MDDialog2 from comrad.app.screens.dialog import MDDialog2
### Layout ### Layout
@ -49,7 +49,7 @@ class BaseScreen(MDScreen):
class ProtectedScreen(BaseScreen): class ProtectedScreen(BaseScreen):
def on_pre_enter(self): def on_pre_enter(self):
super().on_pre_enter() super().on_pre_enter()
if not hasattr(self.app,'is_logged_in') or not self.app.is_logged_in or not hasattr(self.app,'komrade') or not self.app.komrade: if not hasattr(self.app,'is_logged_in') or not self.app.is_logged_in or not hasattr(self.app,'comrad') or not self.app.comrad:
self.root.change_screen('login') self.root.change_screen('login')
self.log('changing screen???') self.log('changing screen???')
return None return None

@ -1,5 +1,5 @@
import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..'))) import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..')))
from komrade import * from comrad import *
from kivymd.uix.label import MDLabel from kivymd.uix.label import MDLabel
@ -284,7 +284,7 @@ class FeedScreen(ProtectedScreen):
if self.app.map: if self.app.map:
self.app.map.dismiss() self.app.map.dismiss()
self.root.remove_widget(self.app.map) self.root.remove_widget(self.app.map)
if not hasattr(self,'get_posts'): self.get_posts=self.app.komrade.posts if not hasattr(self,'get_posts'): self.get_posts=self.app.comrad.posts
for post in self.posts: for post in self.posts:
self.ids.post_carousel.remove_widget(post) self.ids.post_carousel.remove_widget(post)

@ -44,7 +44,7 @@
# md_bg_color:1,1,0,1 # md_bg_color:1,1,0,1
<WelcomeLabel>: <WelcomeLabel>:
# text: 'Enter, Komrade' # text: 'Enter, Comrad'
halign: 'center' halign: 'center'
size_hint_x: 1 size_hint_x: 1
theme_text_color: 'Custom' theme_text_color: 'Custom'

@ -1,5 +1,5 @@
import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..'))) import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..')))
from komrade import * from comrad import *
from screens.base import * from screens.base import *
from kivymd.uix.boxlayout import * from kivymd.uix.boxlayout import *
from kivymd.uix.textfield import * from kivymd.uix.textfield import *
@ -69,7 +69,7 @@ class LoginScreen(BaseScreen):
self.layout_username = UsernameLayout() self.layout_username = UsernameLayout()
self.label_username = UsernameLabel(text="Komrade @") self.label_username = UsernameLabel(text="Comrad @")
self.username_field = UsernameField() self.username_field = UsernameField()
self.username_field.line_color_focus=rgb(*COLOR_TEXT) self.username_field.line_color_focus=rgb(*COLOR_TEXT)
@ -163,7 +163,7 @@ class LoginScreen(BaseScreen):
return self.password_field.text if not passphrase else passphrase return self.password_field.text if not passphrase else passphrase
async def boot(self,un,pw=None): async def boot(self,un,pw=None):
# await self.stat('hello',img_src='/home/ryan/komrade/data/contacts/marxxx.png',komrade_name='Keymaker') # await self.stat('hello',img_src='/home/ryan/comrad/data/contacts/marxxx.png',comrad_name='Keymaker')
# await self.app.get_input('hello?',get_pass=True,title='gimme your passwrdd') # await self.app.get_input('hello?',get_pass=True,title='gimme your passwrdd')
# await self.app.get_input('hello?',get_pass=False,title='gimme your fav color bitch') # await self.app.get_input('hello?',get_pass=False,title='gimme your fav color bitch')
@ -191,10 +191,10 @@ class LoginScreen(BaseScreen):
# return # return
name=un name=un
from komrade.backend import Komrade from comrad.backend import Comrad
kommie = Komrade(un) kommie = Comrad(un)
self.log('KOMMIE!?!?',kommie) self.log('KOMMIE!?!?',kommie)
self.log('wtf',PATH_CRYPT_CA_KEYS) self.log('wtf',PATH_CRYPT_CA_KEYS)
@ -208,10 +208,10 @@ class LoginScreen(BaseScreen):
# self.login_status.text='You should be able to log into this account.' # self.login_status.text='You should be able to log into this account.'
if kommie.privkey: if kommie.privkey:
logger.info(f'passkey login succeeded') logger.info(f'passkey login succeeded')
self.login_status.text=f'Welcome back, Komrade @{un}' self.login_status.text=f'Welcome back, Comrad @{un}'
self.app.is_logged_in=True self.app.is_logged_in=True
self.app.username=kommie.name self.app.username=kommie.name
self.app.komrade=kommie self.app.comrad=kommie
self.root.change_screen('feed') self.root.change_screen('feed')
else: else:
logger.info(f'passkey login failed') logger.info(f'passkey login failed')
@ -221,12 +221,12 @@ class LoginScreen(BaseScreen):
# self.layout.add_widget(self.layout_password) # self.layout.add_widget(self.layout_password)
elif kommie.exists_locally_as_contact(): elif kommie.exists_locally_as_contact():
await self.app.stat('This is a contact of yours') await self.app.stat('This is a contact of yours')
self.login_status.text='Komrade exists as a contact of yours.' self.login_status.text='Comrad exists as a contact of yours.'
# self.app.change_screen('feed') # self.app.change_screen('feed')
self.app.change_screen('login') self.app.change_screen('login')
else: else:
# await self.app.stat('Account does not exist on hardware, maybe not on server. Try to register?') # await self.app.stat('Account does not exist on hardware, maybe not on server. Try to register?')
# self.login_status.text='Komrade not known on this device. Registering...' # self.login_status.text='Comrad not known on this device. Registering...'
### REGISTER ### REGISTER
self.remove_widget(self.layout) self.remove_widget(self.layout)
@ -236,7 +236,7 @@ class LoginScreen(BaseScreen):
self.login_status.text='Registered' self.login_status.text='Registered'
self.app.is_logged_in=True self.app.is_logged_in=True
self.app.username=kommie.name self.app.username=kommie.name
self.app.komrade=kommie self.app.comrad=kommie
self.remove_widget(self.layout) self.remove_widget(self.layout)
self.app.change_screen('feed') self.app.change_screen('feed')
else: else:
@ -247,10 +247,10 @@ class LoginScreen(BaseScreen):
async def register(self,name): async def register(self,name):
async def logfunc(*x,**y): async def logfunc(*x,**y):
if not 'komrade_name' in y: y['komrade_name']='Keymaker' if not 'comrad_name' in y: y['comrad_name']='Keymaker'
await self.app.stat(*x,**y) await self.app.stat(*x,**y)
kommie = Komrade(name) kommie = Comrad(name)
# already have it? # already have it?
if kommie.exists_locally_as_account(): if kommie.exists_locally_as_account():
@ -259,31 +259,31 @@ class LoginScreen(BaseScreen):
return {'success':False, 'status':'This is already a contact of yours'} return {'success':False, 'status':'This is already a contact of yours'}
# #
await logfunc(f'Hello, this is Komrade @{name}. I would like to join the socialist network.',pause=True,komrade_name=name) await logfunc(f'Hello, this is Comrad @{name}. I would like to join the socialist network.',pause=True,comrad_name=name)
await logfunc(f'Welcome, Komrade @{name}. To help us communicate safely, I have cut for you a matching pair of encryption keys.',pause=True,clear=True,komrade_name='Keymaker') await logfunc(f'Welcome, Comrad @{name}. To help us communicate safely, I have cut for you a matching pair of encryption keys.',pause=True,clear=True,comrad_name='Keymaker')
# ## 2) Make pub public/private keys # ## 2) Make pub public/private keys
from komrade.backend.keymaker import KomradeAsymmetricKey from comrad.backend.keymaker import ComradAsymmetricKey
from komrade.cli.artcode import ART_KEY_PAIR from comrad.cli.artcode import ART_KEY_PAIR
keypair = KomradeAsymmetricKey() keypair = ComradAsymmetricKey()
logger.info('cut keypair!') logger.info('cut keypair!')
pubkey,privkey = keypair.pubkey_obj,keypair.privkey_obj pubkey,privkey = keypair.pubkey_obj,keypair.privkey_obj
uri_id = pubkey.data_b64 uri_id = pubkey.data_b64
uri_s = pubkey.data_b64_s uri_s = pubkey.data_b64_s
fnfn = kommie.save_uri_as_qrcode(uri_id=uri_id,name=name) fnfn = kommie.save_uri_as_qrcode(uri_id=uri_id,name=name)
# await logfunc(f'Here. I have cut for you a private and public asymmetric key pair, using the iron-clad Elliptic curve algorithm:',komrade_name='Keymaker') # await logfunc(f'Here. I have cut for you a private and public asymmetric key pair, using the iron-clad Elliptic curve algorithm:',comrad_name='Keymaker')
await logfunc(f'The first is your "public key", which you can share with anyone. With it, someone can write you an encrypted message.',komrade_name='Keymaker') await logfunc(f'The first is your "public key", which you can share with anyone. With it, someone can write you an encrypted message.',comrad_name='Keymaker')
# delete qr! # delete qr!
os.remove(fnfn) os.remove(fnfn)
# await logfunc(f'(1) {pubkey} -- and -- (2) {privkey}',clear=True,pause=True,komrade_name='Keymaker') # await logfunc(f'(1) {pubkey} -- and -- (2) {privkey}',clear=True,pause=True,comrad_name='Keymaker')
# await logfunc(f'(1) You may store your public key both on your device hardware, as well as share it with anyone you wish: {pubkey.data_b64_s}') #\n\nIt will also be stored as a QR code on your device:\n{qr_str}',pause=True,clear=True) # await logfunc(f'(1) You may store your public key both on your device hardware, as well as share it with anyone you wish: {pubkey.data_b64_s}') #\n\nIt will also be stored as a QR code on your device:\n{qr_str}',pause=True,clear=True)
@ -292,7 +292,7 @@ class LoginScreen(BaseScreen):
kommie._keychain['pubkey']=pubkey kommie._keychain['pubkey']=pubkey
kommie._keychain['privkey']=privkey kommie._keychain['privkey']=privkey
from komrade.utils import dict_format from comrad.utils import dict_format
self.log('My keychain now looks like:' + dict_format(kommie.keychain())) self.log('My keychain now looks like:' + dict_format(kommie.keychain()))
# return # return
@ -313,22 +313,22 @@ class LoginScreen(BaseScreen):
passhash = hasher(passphrase) passhash = hasher(passphrase)
privkey_decr = KomradeSymmetricKeyWithPassphrase(passhash=passhash) privkey_decr = ComradSymmetricKeyWithPassphrase(passhash=passhash)
print() print()
# await logfunc(f'''We immediately whatever you typed through a 1-way hashing algorithm (SHA-256), scrambling it into (redacted):\n{make_key_discreet_str(passhash)}''',pause=True,clear=False) # await logfunc(f'''We immediately whatever you typed through a 1-way hashing algorithm (SHA-256), scrambling it into (redacted):\n{make_key_discreet_str(passhash)}''',pause=True,clear=False)
privkey_encr = privkey_decr.encrypt(privkey.data) privkey_encr = privkey_decr.encrypt(privkey.data)
privkey_encr_obj = KomradeEncryptedAsymmetricPrivateKey(privkey_encr) privkey_encr_obj = ComradEncryptedAsymmetricPrivateKey(privkey_encr)
kommie._keychain['privkey_encr']=privkey_encr_obj kommie._keychain['privkey_encr']=privkey_encr_obj
self.log('My keychain now looks like v2:',dict_format(kommie.keychain())) self.log('My keychain now looks like v2:',dict_format(kommie.keychain()))
# await logfunc(f'With this scrambled password we can encrypt your super-sensitive private key, from this:\n{privkey.discreet}to this:\n{privkey_encr_obj.discreet}',pause=True,clear=False) # await logfunc(f'With this scrambled password we can encrypt your super-sensitive private key, from this:\n{privkey.discreet}to this:\n{privkey_encr_obj.discreet}',pause=True,clear=False)
# ### PUBLIC KEY # ### PUBLIC KEY
await logfunc('You must now register your username and public key with Komrade @Operator on the remote server.',pause=False,clear=False) await logfunc('You must now register your username and public key with Comrad @Operator on the remote server.',pause=False,clear=False)
await logfunc('Connecting you to the @Operator...',komrade_name='Telephone') await logfunc('Connecting you to the @Operator...',comrad_name='Telephone')
## CALL OP WITH PUBKEY ## CALL OP WITH PUBKEY
# self.app.open_dialog('Calling @Operator...') # self.app.open_dialog('Calling @Operator...')
@ -346,10 +346,10 @@ class LoginScreen(BaseScreen):
# print() # print()
await logfunc(resp_msg_d.get('status'),komrade_name='Operator',pause=True) await logfunc(resp_msg_d.get('status'),comrad_name='Operator',pause=True)
if not resp_msg_d.get('success'): if not resp_msg_d.get('success'):
self.app.komrade=None self.app.comrad=None
self.app.is_logged_in=False self.app.is_logged_in=False
self.app.username='' self.app.username=''
@ -360,7 +360,7 @@ class LoginScreen(BaseScreen):
return return
# clear_screen() # clear_screen()
await logfunc('Great. Komrade @Operator now has your name and public key on file (and nothing else!).',pause=True,clear=True) await logfunc('Great. Comrad @Operator now has your name and public key on file (and nothing else!).',pause=True,clear=True)
@ -383,16 +383,16 @@ class LoginScreen(BaseScreen):
# store privkey pieces # store privkey pieces
kommie.crypt_keys.set(uri_id, privkey_encr_obj.data, prefix='/privkey_encr/') kommie.crypt_keys.set(uri_id, privkey_encr_obj.data, prefix='/privkey_encr/')
# just to show we used a passphrase --> # just to show we used a passphrase -->
kommie.crypt_keys.set(uri_id, KomradeSymmetricKeyWithPassphrase.__name__, prefix='/privkey_decr/') kommie.crypt_keys.set(uri_id, ComradSymmetricKeyWithPassphrase.__name__, prefix='/privkey_decr/')
# save qr too: # save qr too:
_fnfn=kommie.save_uri_as_qrcode(uri_id) _fnfn=kommie.save_uri_as_qrcode(uri_id)
# await logfunc(f'Saving public key, encrypted private key, and login secret to hardware-only database. Also saving public key as QR code to: {_fnfn}.',pause=True,clear=False,use_prefix=False) # await logfunc(f'Saving public key, encrypted private key, and login secret to hardware-only database. Also saving public key as QR code to: {_fnfn}.',pause=True,clear=False,use_prefix=False)
await logfunc(f'You can share it by pasting it to someone in a secure message:\n{uri_s}',komrade_name='Keymaker') await logfunc(f'You can share it by pasting it to someone in a secure message:\n{uri_s}',comrad_name='Keymaker')
await logfunc(f'You can also share it IRL, phone to phone, as a QR code. It is saved to {fnfn} and looks like this.',img_src=fnfn,komrade_name='Keymaker') await logfunc(f'You can also share it IRL, phone to phone, as a QR code. It is saved to {fnfn} and looks like this.',img_src=fnfn,comrad_name='Keymaker')
await logfunc(f"(2) Your PRIVATE encryption key, on the other hand, will be stored encrypted on your device hardware. Do not it this with anyone or across any network whatsoever.") await logfunc(f"(2) Your PRIVATE encryption key, on the other hand, will be stored encrypted on your device hardware. Do not it this with anyone or across any network whatsoever.")
@ -412,7 +412,7 @@ class LoginScreen(BaseScreen):
# await logfunc('Returning...') # await logfunc('Returning...')
from komrade.app.screens.map import MapWidget from comrad.app.screens.map import MapWidget
if self.app.map: if self.app.map:
self.app.map.dismiss() self.app.map.dismiss()
self.app.map=None self.app.map=None

@ -1,5 +1,5 @@
import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..','..'))) import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..','..')))
from komrade.app.screens.dialog import MDDialog2 from comrad.app.screens.dialog import MDDialog2
import cartopy import cartopy
import cartopy.crs as ccrs import cartopy.crs as ccrs
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
@ -8,8 +8,8 @@ from kivymd.uix.gridlayout import MDGridLayout
from kivymd.uix.button import MDFlatButton from kivymd.uix.button import MDFlatButton
from kivymd.uix.label import MDLabel from kivymd.uix.label import MDLabel
print('\n'.join(sys.path)) print('\n'.join(sys.path))
from komrade.constants import * from comrad.constants import *
# from komrade.app.main import rgb # from comrad.app.main import rgb
import io import io
from kivy.core.image import Image as CoreImage from kivy.core.image import Image as CoreImage
from kivy.uix.image import Image,AsyncImage from kivy.uix.image import Image,AsyncImage
@ -139,7 +139,7 @@ class MapWidget(MDDialog2):
# buf = io.BytesIO() # buf = io.BytesIO()
# plt.ion() # plt.ion()
from komrade.constants import PATH_MAPS from comrad.constants import PATH_MAPS
odir=PATH_MAPS odir=PATH_MAPS
if not os.path.exists(odir): os.makedirs(odir) if not os.path.exists(odir): os.makedirs(odir)
ofn=os.path.join(odir,f't_{len(self.points)}.png') ofn=os.path.join(odir,f't_{len(self.points)}.png')
@ -189,7 +189,7 @@ class MapWidget(MDDialog2):
# transform=self.projection # transform=self.projection
# ) # )
import random import random
from komrade.constants import ALL_COLORS from comrad.constants import ALL_COLORS
color = random.choice(ALL_COLORS) color = random.choice(ALL_COLORS)
self.points+=[(lat,long,desc)] self.points+=[(lat,long,desc)]
@ -206,6 +206,7 @@ class MapWidget(MDDialog2):
# line # line
if self.last_lat and self.last_long: if self.last_lat and self.last_long:
self.ax.lines = []
plt.plot( plt.plot(
[self.last_long, long], [self.last_long, long],
[self.last_lat, lat], [self.last_lat, lat],

@ -6,5 +6,5 @@ class MessagesScreen(FeedScreen):
def on_pre_enter(self): def on_pre_enter(self):
if not super().on_pre_enter(): return if not super().on_pre_enter(): return
self.get_posts = self.app.komrade.messages self.get_posts = self.app.comrad.messages

@ -1,6 +1,6 @@
from screens.base import ProtectedScreen from screens.base import ProtectedScreen
import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..'))) import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..')))
from komrade import * from comrad import *
class NotificationsScreen(ProtectedScreen): pass class NotificationsScreen(ProtectedScreen): pass

@ -1,5 +1,5 @@
import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..'))) import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..')))
from komrade import * from comrad import *
from screens.base import ProtectedScreen,BaseScreen from screens.base import ProtectedScreen,BaseScreen
@ -164,7 +164,7 @@ class PostScreen(ProtectedScreen):
# self.post_card.author_section_layout.add_widget(self.tmp_msg,1) # self.post_card.author_section_layout.add_widget(self.tmp_msg,1)
self.post_card.author_section_layout.add_widget(self.to_whom_btn,1) self.post_card.author_section_layout.add_widget(self.to_whom_btn,1)
from komrade.constants import WORLD_NAME from comrad.constants import WORLD_NAME
self.to_whom_btn.ids.txt_input.text = '@'+WORLD_NAME self.to_whom_btn.ids.txt_input.text = '@'+WORLD_NAME
#self.to_whom_btn.adaptive_height = True #self.to_whom_btn.adaptive_height = True
self.to_whom_btn.ids.txt_input.word_list = ['@'+k for k in self.app.keys if k != self.app.username] self.to_whom_btn.ids.txt_input.word_list = ['@'+k for k in self.app.keys if k != self.app.username]
@ -325,7 +325,7 @@ class PostScreen(ProtectedScreen):
file_ext = self.img_ext if hasattr(self,'img_ext') else None file_ext = self.img_ext if hasattr(self,'img_ext') else None
#await self.app.post(content=content, channel = channel, file_id=file_id, file_ext=file_ext) #await self.app.post(content=content, channel = channel, file_id=file_id, file_ext=file_ext)
# post? # post?
await self.app.komrade.post(content) await self.app.comrad.post_async(content)
import time import time
self.close_dialog() self.close_dialog()
if hasattr(self.app,'map') and self.app.map: if hasattr(self.app,'map') and self.app.map:

@ -1,5 +1,5 @@
import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..'))) import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..')))
from komrade import * from comrad import *
from screens.base import BaseScreen from screens.base import BaseScreen
from kivymd.uix.boxlayout import MDBoxLayout from kivymd.uix.boxlayout import MDBoxLayout
@ -243,7 +243,7 @@ class ProfileScreen(ProtectedScreen):
## author info ## author info
self.author_info_layout = AuthorInfoLayout() self.author_info_layout = AuthorInfoLayout()
#self.app.name_irl = 'Marx Zuckerberg' #self.app.name_irl = 'Marx Zuckerberg'
self.app.name_irl = 'Komrade @'+self.app.username self.app.name_irl = 'Comrad @'+self.app.username
if hasattr(self.app,'name_irl'): if hasattr(self.app,'name_irl'):
self.author_name_irl = AuthorName(text=self.app.name_irl) self.author_name_irl = AuthorName(text=self.app.name_irl)
@ -276,7 +276,7 @@ class ProfileScreen(ProtectedScreen):
## Followers ## Followers
self.follower_layout = FollowerLayout() self.follower_layout = FollowerLayout()
# self.author_followers = AuthorFollowers(label='13 followers',icon='account-arrow-left') # self.author_followers = AuthorFollowers(label='13 followers',icon='account-arrow-left')
self.author_following = AuthorFollowing(label='13 komrades',icon='account-multiple') self.author_following = AuthorFollowing(label='13 comrads',icon='account-multiple')
## add to layout ## add to layout

@ -13,7 +13,7 @@ def run_command():
p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
class Watcher: class Watcher:
DIRECTORY_TO_WATCH = '.' #os.path.join(os.path.expanduser('~'),"/github/Komrade/") DIRECTORY_TO_WATCH = '.' #os.path.join(os.path.expanduser('~'),"/github/Comrad/")
def __init__(self): def __init__(self):
self.observer = Observer() self.observer = Observer()

@ -15,7 +15,7 @@ from .callers import *
from .phonelines import * from .phonelines import *
from .messages import * from .messages import *
from .komrades import * from .comrads import *
## define default entities ## define default entities
OPERATOR = None OPERATOR = None

@ -1,10 +1,10 @@
import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..'))) import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..')))
from komrade import * from comrad import *
from komrade.backend import * from comrad.backend import *
from komrade.cli import * from comrad.cli import *
# from komrade.backend.the_telephone import * # from comrad.backend.the_telephone import *
# from komrade.backend.the_telephone import * # from comrad.backend.the_telephone import *
class Caller(Operator): class Caller(Operator):

@ -1,8 +1,8 @@
import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..'))) import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..')))
from komrade import * from comrad import *
from komrade.backend import * from comrad.backend import *
from komrade.backend.keymaker import * from comrad.backend.keymaker import *
from komrade.backend.messages import Message from comrad.backend.messages import Message
import logging,asyncio import logging,asyncio
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -12,10 +12,10 @@ logger = logging.getLogger(__name__)
class KomradeX(Caller): class ComradX(Caller):
def __init__(self, name=None, pubkey=None, callbacks={}, getpass_func=None): def __init__(self, name=None, pubkey=None, callbacks={}, getpass_func=None):
# logger.info('booting KomradeX with getpass_func:',getpass_func) # logger.info('booting ComradX with getpass_func:',getpass_func)
super().__init__(name=name, callbacks=callbacks, getpass_func=getpass_func) super().__init__(name=name, callbacks=callbacks, getpass_func=getpass_func)
self.log(f'Starting up with callbacks: {self._callbacks}') self.log(f'Starting up with callbacks: {self._callbacks}')
# self.boot(create=False) # self.boot(create=False)
@ -26,8 +26,8 @@ class KomradeX(Caller):
with open(PATH_SUPER_SECRET_OP_KEY,'rb') as f: with open(PATH_SUPER_SECRET_OP_KEY,'rb') as f:
#pass_encr=f.read() #pass_encr=f.read()
opk1,opk2,privkey_decr,privkey_encr = b64dec(f.read()).split(BSEP) opk1,opk2,privkey_decr,privkey_encr = b64dec(f.read()).split(BSEP)
privkey_decr_obj = KomradeSymmetricKeyWithoutPassphrase(privkey_decr) privkey_decr_obj = ComradSymmetricKeyWithoutPassphrase(privkey_decr)
privkey_encr_obj = KomradeEncryptedAsymmetricPrivateKey(privkey_encr) privkey_encr_obj = ComradEncryptedAsymmetricPrivateKey(privkey_encr)
self._keychain['privkey_decr']=privkey_decr_obj self._keychain['privkey_decr']=privkey_decr_obj
self._keychain['privkey_encr']=privkey_encr_obj self._keychain['privkey_encr']=privkey_encr_obj
@ -146,18 +146,18 @@ class KomradeX(Caller):
if SHOW_STATUS and show_intro: if SHOW_STATUS and show_intro:
self.name = name = self.cli.status_keymaker_part1(name) self.name = name = self.cli.status_keymaker_part1(name)
elif not name: elif not name:
self.name = name = input('\nHello, this is Komrade @') self.name = name = input('\nHello, this is Comrad @')
logfunc('I would like to sign up for the socialist network revolution.',flush=True,komrade_name=name,pause=True) logfunc('I would like to sign up for the socialist network revolution.',flush=True,comrad_name=name,pause=True)
# do_pause() # do_pause()
else: else:
logfunc(f'Hello, this is Komrade @{name}.\n\nI would like to sign up for the socialist network revolution.',pause=True,komrade_name=name) logfunc(f'Hello, this is Comrad @{name}.\n\nI would like to sign up for the socialist network revolution.',pause=True,comrad_name=name)
# do_pause() # do_pause()
# clear_screen() # clear_screen()
logfunc(f'Excellent. But to communicate with komrades securely, you must first cut your public & private encryption keys.',pause=True,clear=True) logfunc(f'Excellent. But to communicate with comrads securely, you must first cut your public & private encryption keys.',pause=True,clear=True)
# do_pause() # do_pause()
## 2) Make pub public/private keys ## 2) Make pub public/private keys
keypair = KomradeAsymmetricKey() keypair = ComradAsymmetricKey()
pubkey,privkey = keypair.pubkey_obj,keypair.privkey_obj pubkey,privkey = keypair.pubkey_obj,keypair.privkey_obj
logfunc(f'I have cut for you a private and public asymmetric key pair, using the iron-clad Elliptic curve algorithm:\n\n(1) {pubkey}\n\n(2) {privkey}{ART_KEY_PAIR}',clear=True,pause=True) logfunc(f'I have cut for you a private and public asymmetric key pair, using the iron-clad Elliptic curve algorithm:\n\n(1) {pubkey}\n\n(2) {privkey}{ART_KEY_PAIR}',clear=True,pause=True)
self._keychain['pubkey']=pubkey self._keychain['pubkey']=pubkey
@ -168,14 +168,14 @@ class KomradeX(Caller):
### PUBLIC KEY ### PUBLIC KEY
qr_str=self.qr_str(pubkey.data_b64) qr_str=self.qr_str(pubkey.data_b64)
logfunc(f'(1) You may store your public key both on your device hardware, as well as share it with anyone you wish:\n\n{pubkey.data_b64_s}\n\nIt will also be stored as a QR code on your device:\n{qr_str}',pause=True,clear=True) logfunc(f'(1) You may store your public key both on your device hardware, as well as share it with anyone you wish:\n\n{pubkey.data_b64_s}\n\nIt will also be stored as a QR code on your device:\n{qr_str}',pause=True,clear=True)
logfunc('You must also register your username and public key with Komrade @Operator on the remote server.\n\nShall Komrade @Telephone send them over?',pause=False,clear=False)#),dict_format(data,tab=2),pause=True) logfunc('You must also register your username and public key with Comrad @Operator on the remote server.\n\nShall Comrad @Telephone send them over?',pause=False,clear=False)#),dict_format(data,tab=2),pause=True)
ok_to_send = 'y' #input(f'\n@{name}: [Y/n] ') ok_to_send = 'y' #input(f'\n@{name}: [Y/n] ')
if ok_to_send.strip().lower()=='n': if ok_to_send.strip().lower()=='n':
logfunc('Cancelling registration.') logfunc('Cancelling registration.')
return return
else: else:
print() print()
logfunc('Connecting you to the @Operator...',komrade_name='Telephone') logfunc('Connecting you to the @Operator...',comrad_name='Telephone')
# print() # print()
# time.sleep(1) # time.sleep(1)
@ -189,7 +189,7 @@ class KomradeX(Caller):
)) ))
# print() # print()
clear_screen() clear_screen()
logfunc(resp_msg_d.get('status')+ART_OLDPHONE4,komrade_name='Operator',pause=True) logfunc(resp_msg_d.get('status')+ART_OLDPHONE4,comrad_name='Operator',pause=True)
print() print()
if not resp_msg_d.get('success'): if not resp_msg_d.get('success'):
@ -197,7 +197,7 @@ class KomradeX(Caller):
return return
# clear_screen() # clear_screen()
logfunc('Great. Komrade @Operator now has your name and public key on file (and nothing else!).',pause=True,clear=True) logfunc('Great. Comrad @Operator now has your name and public key on file (and nothing else!).',pause=True,clear=True)
logfunc(f"(2) Your PRIVATE key, on the other hand, must be stored only on your device hardware.",pause=True) logfunc(f"(2) Your PRIVATE key, on the other hand, must be stored only on your device hardware.",pause=True)
logfunc('''Your private key is so sensitive we'll even encrypt it before storing it.''',pause=True,use_prefix=False) logfunc('''Your private key is so sensitive we'll even encrypt it before storing it.''',pause=True,use_prefix=False)
@ -219,12 +219,12 @@ class KomradeX(Caller):
## 4) Get hashed password ## 4) Get hashed password
passhash = hasher(passphrase) passhash = hasher(passphrase)
privkey_decr = KomradeSymmetricKeyWithPassphrase(passhash=passhash) privkey_decr = ComradSymmetricKeyWithPassphrase(passhash=passhash)
print() print()
logfunc(f'''Let's immediately run whatever you typed through a 1-way hashing algorithm (SHA-256), inflating it to (redacted):\n\n{make_key_discreet_str(passhash)}''',pause=True,clear=False) logfunc(f'''Let's immediately run whatever you typed through a 1-way hashing algorithm (SHA-256), inflating it to (redacted):\n\n{make_key_discreet_str(passhash)}''',pause=True,clear=False)
privkey_encr = privkey_decr.encrypt(privkey.data) privkey_encr = privkey_decr.encrypt(privkey.data)
privkey_encr_obj = KomradeEncryptedAsymmetricPrivateKey(privkey_encr) privkey_encr_obj = ComradEncryptedAsymmetricPrivateKey(privkey_encr)
self._keychain['privkey_encr']=privkey_encr_obj self._keychain['privkey_encr']=privkey_encr_obj
self.log('My keychain now looks like v2:',dict_format(self.keychain())) self.log('My keychain now looks like v2:',dict_format(self.keychain()))
@ -262,7 +262,7 @@ class KomradeX(Caller):
# store privkey pieces # store privkey pieces
self.crypt_keys.set(uri_id, privkey_encr_obj.data, prefix='/privkey_encr/') self.crypt_keys.set(uri_id, privkey_encr_obj.data, prefix='/privkey_encr/')
# just to show we used a passphrase --> # just to show we used a passphrase -->
self.crypt_keys.set(uri_id, KomradeSymmetricKeyWithPassphrase.__name__, prefix='/privkey_decr/') self.crypt_keys.set(uri_id, ComradSymmetricKeyWithPassphrase.__name__, prefix='/privkey_decr/')
# save qr too: # save qr too:
@ -310,12 +310,12 @@ class KomradeX(Caller):
# check hardware # check hardware
if not 'pubkey' in keys or not self.pubkey: if not 'pubkey' in keys or not self.pubkey:
emsg='''Login impossible. I do not have this komrade's public key, much less private one.''' emsg='''Login impossible. I do not have this comrad's public key, much less private one.'''
# self.log() # self.log()
return {'success':False, 'status':emsg} return {'success':False, 'status':emsg}
if not 'privkey_encr' in keys: if not 'privkey_encr' in keys:
emsg='''Login impossible. I do not have this komrade's private key on this hardware.''' emsg='''Login impossible. I do not have this comrad's private key on this hardware.'''
self.log(emsg) self.log(emsg)
return {'success':False, 'status':emsg} return {'success':False, 'status':emsg}
@ -372,7 +372,7 @@ class KomradeX(Caller):
qr_names = sorted([ qr_names = sorted([
fn.split('.png')[0] for fn in os.listdir(PATH_QRCODES) fn.split('.png')[0] for fn in os.listdir(PATH_QRCODES)
]) ])
ppl = [Komrade(name) for name in qr_names] ppl = [Comrad(name) for name in qr_names]
ppl = [p for p in ppl if p.exists_locally_as_contact()] ppl = [p for p in ppl if p.exists_locally_as_contact()]
return ppl return ppl
@ -461,7 +461,7 @@ class KomradeX(Caller):
async def msg_async(self,someone,something): async def msg_async(self,someone,something):
# find or boot # find or boot
someone = Komrade(someone) someone = Comrad(someone)
self.log(f'found {someone}') self.log(f'found {someone}')
# can we? # can we?
@ -530,7 +530,7 @@ class KomradeX(Caller):
# self.log('something_b_signed_b64 =',something_b_signed_b64) # self.log('something_b_signed_b64 =',something_b_signed_b64)
# encrypt package to world (or op?) # encrypt package to world (or op?)
world=Komrade(WORLD_NAME) world=Comrad(WORLD_NAME)
something_b_signed_encr4world = SMessage( something_b_signed_encr4world = SMessage(
self.privkey.data, self.privkey.data,
world.pubkey.data world.pubkey.data
@ -550,7 +550,7 @@ class KomradeX(Caller):
# post_pkg_b_encr4world = SMessage( # post_pkg_b_encr4world = SMessage(
# self.privkey.data, # self.privkey.data,
# Komrade(WORLD_NAME).pubkey.data # Comrad(WORLD_NAME).pubkey.data
# ).wrap(post_pkg_b) # ).wrap(post_pkg_b)
# self.log(post_pkg_b_encr4world) # self.log(post_pkg_b_encr4world)
@ -593,7 +593,7 @@ class KomradeX(Caller):
self.crypt_data.set( self.crypt_data.set(
post_id, post_id,
post, post,
prefix=post_prefix, prefix=f'{post_prefix}{self.name}/',
override=True override=True
) )
@ -719,12 +719,12 @@ class KomradeX(Caller):
posts.append(post) posts.append(post)
return posts return posts
def read_post(self,post_id,post_encr=None): def read_post(self,post_id,post_encr=None,post_prefix='/post/'):
# get post # get post
if not post_encr: if not post_encr:
post_encr = self.crypt_data.get( post_encr = self.crypt_data.get(
post_id, post_id,
prefix='/post/' prefix=f'{post_prefix}{self.name}/',
) )
self.log('found encrypted post store:',post_encr) self.log('found encrypted post store:',post_encr)
@ -768,7 +768,7 @@ class KomradeX(Caller):
post_obj = Message( post_obj = Message(
{ {
'from':post_from_uri,'from_name':post_from_name, 'from':post_from_uri,'from_name':post_from_name,
'to':Komrade(WORLD_NAME).uri, 'to_name':WORLD_NAME, 'to':Comrad(WORLD_NAME).uri, 'to_name':WORLD_NAME,
'msg':post_data, 'msg':post_data,
'timestamp':post_timestamp 'timestamp':post_timestamp
} }
@ -826,12 +826,12 @@ class KomradeX(Caller):
self.log('read_db.values 2',read_db.values) self.log('read_db.values 2',read_db.values)
def read_msg(self,post_id=None,post_encr=None): def read_msg(self,post_id=None,post_encr=None,post_prefix='/post/'):
# get post # get post
if not post_encr: if not post_encr:
post_encr = self.crypt_data.get( post_encr = self.crypt_data.get(
post_id, post_id,
prefix='/post/' prefix=f'{post_prefix}{self.name}/',
) )
self.log('found encrypted post store:',post_encr) self.log('found encrypted post store:',post_encr)
@ -866,7 +866,7 @@ class KomradeX(Caller):
} }
else: else:
# print(msg_from_op) # print(msg_from_op)
raise KomradeException('Why am I getting this msg? '+str(msg_from_op)) raise ComradException('Why am I getting this msg? '+str(msg_from_op))
return return
# now try to decrypt? # now try to decrypt?
@ -951,32 +951,32 @@ def test_register():
import random import random
num = random.choice(list(range(0,1000))) num = random.choice(list(range(0,1000)))
botname=f'marx{str(num).zfill(3)}' botname=f'marx{str(num).zfill(3)}'
marxbot = Komrade(botname) marxbot = Comrad(botname)
# marxbot=Komrade() # marxbot=Comrad()
marxbot.register(passphrase='boo') marxbot.register(passphrase='boo')
def test_msg(): def test_msg():
b = Komrade('bez') b = Comrad('bez')
b.inbox() b.inbox()
# b.read_msg(b'YWY3NDUxZjNjYjdhNDFmNmIyNDI2NzU3YTI4ZTA0OWM=') # b.read_msg(b'YWY3NDUxZjNjYjdhNDFmNmIyNDI2NzU3YTI4ZTA0OWM=')
#b.login() #b.login()
#print(b.download_msgs()) #print(b.download_msgs())
# z = Komrade('zuckbot') # z = Comrad('zuckbot')
# b.msg(z,'you ssssssuck') # b.msg(z,'you ssssssuck')
def test_loading(): def test_loading():
z1 = Komrade('elon') z1 = Comrad('elon')
# z1.register() # z1.register()
print(z1.keychain()) print(z1.keychain())
# exit() # exit()
z2 = Komrade(b'VUVDMgAAAC08BCMVA+0dMJXc66/W7hty669+3/3S61Q1yjmgJW8I0k3lqfDi') z2 = Comrad(b'VUVDMgAAAC08BCMVA+0dMJXc66/W7hty669+3/3S61Q1yjmgJW8I0k3lqfDi')
print(z2) print(z2)
print(z2.keychain()) print(z2.keychain())
@ -989,9 +989,9 @@ def test_loading():
def test_sign(): def test_sign():
from pythemis import smessage from pythemis import smessage
b = Komrade('bez') b = Comrad('bez')
m = Komrade('marx') m = Comrad('marx')
z = Komrade('zuckbot') z = Comrad('zuckbot')
msg = b'this is cool. --bez' msg = b'this is cool. --bez'
@ -1003,7 +1003,7 @@ def test_sign():
print(verified_msg) print(verified_msg)
def test_send(): def test_send():
z = Komrade('zuckbot') z = Comrad('zuckbot')
if __name__=='__main__': if __name__=='__main__':
test_msg() test_msg()

@ -2,7 +2,7 @@
Storage for both keys and data Storage for both keys and data
""" """
import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..'))) import os,sys; sys.path.append(os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__),'..')),'..')))
from komrade import * from comrad import *
# from simplekv.fs import FilesystemStore # from simplekv.fs import FilesystemStore
# from simplekv.memory.redisstore import RedisStore # from simplekv.memory.redisstore import RedisStore
# import redis # import redis
@ -38,7 +38,7 @@ class Crypt(Logger):
if use_secret and path_secret: if use_secret and path_secret:
if not os.path.exists(path_secret): if not os.path.exists(path_secret):
self.secret = get_random_binary_id() self.secret = get_random_binary_id()
from komrade.backend.keymaker import make_key_discreet from comrad.backend.keymaker import make_key_discreet
self.log('shhh! creating secret:',make_key_discreet(self.secret)) self.log('shhh! creating secret:',make_key_discreet(self.secret))
with open(path_secret,'wb') as of: with open(path_secret,'wb') as of:
of.write(self.secret) of.write(self.secret)
@ -49,8 +49,8 @@ class Crypt(Logger):
self.secret = b'' self.secret = b''
self.encrypt_values = encrypt_values self.encrypt_values = encrypt_values
if self.secret and encrypt_values and (not encryptor_func or not decryptor_func): if self.secret and encrypt_values and (not encryptor_func or not decryptor_func):
from komrade.backend.keymaker import KomradeSymmetricKeyWithPassphrase from comrad.backend.keymaker import ComradSymmetricKeyWithPassphrase
self.key = KomradeSymmetricKeyWithPassphrase( self.key = ComradSymmetricKeyWithPassphrase(
passphrase=self.secret passphrase=self.secret
) )
encryptor_func = self.key.encrypt encryptor_func = self.key.encrypt
@ -82,10 +82,6 @@ class Crypt(Logger):
def package_key(self,k,prefix=''): def package_key(self,k,prefix=''):
if not k: return b'' if not k: return b''
# @DANGEROUS!?!!!!!
name=self.name if self.name else '?'
prefix=f'''{prefix}@{name}/'''
k_b = self.force_binary(k) k_b = self.force_binary(k)
k_b2 = self.force_binary(prefix) + k_b k_b2 = self.force_binary(prefix) + k_b
return k_b2 return k_b2

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save