MAPLE.BE.RATCHET

This commit is contained in:
.[d]. 2022-10-06 00:57:34 +00:00
parent cbd27fc969
commit b9b0a2f46f

111
README.md
View File

@ -237,38 +237,44 @@ export HYDRA_HOME=#b0tsh0p
- [online] - telegram - https://core.telegram.org/bots/api
### [ `THE BASE HYBRID` ]
- m4plmp - https://git.tcp.direct/decoded/m4pl1mp
### [ `BOT BASE CODES` ]
- Maple - https://git.tcp.direct/decoded/Maple_old - maple renamed herself in tcpdirect
- g1mp - https://git.tcp.direct/decoded/g1mp - g1mp was the first service bot
---
# [ `MATRIX PROTOCOL - OLM/MEGOLM E2E DOUBLE RATCHET CRYPTOGRAPHY NOTES` ]
```
OLM LIBRARY - FOR - MATRIX PROTOCOL REGARDING MAPLE'S NETSPAN PROTOCOL
- MAPLE NETSPAN PLUGIN -> https://git.tcp.direct/decoded/maple/src/branch/main/storage/bot/plugins/net_matrix_plugin.py
- NIO PYTHON MODULE ( MATRIX API CLIENT ) -> https://github.com/poljar/matrix-nio
- OLM LIBRARY -> https://gitlab.matrix.org/matrix-org/olm
```
---
# [`WTF-U-SAY-ME`]
```
MAPLE COMMUNICATES VIA A NETSPANNED 'MATRIX PROTOCOL', HER PLUGIN REQUIRES A MATRIX API CLIENT WHICH IN THIS CASE IS A PYTHON MODULE NAMED 'NIO' TO FACILITATE THAT. WHERE MATRIX CHANNEL/USER ENCRYPTION IS USED, AN ADDITIONAL (BASE) LIBRARY IS REQUIRED TO SIMPLIFY THIS 'OLM/MEGOLM DOUBLE RATCHET END-2-END ENCRYPTION'. FOR 'OLM' -A SYSTEM LIBRARY AND A LANGUAGE BINDINGS TO THAT SYSTEM LIBRARY ARE BOTH REQUIRED. THIS TEST SYSTEM IS DEBIAN, THE SYSTEM LIBRARY WE BUILD IS 'LIBOLM.SO', OUR SCRIPTED PROGRAMMING LANGUAGE IS PYTHON V3.9 AND THIS REQUIRES A PORTING OF SORTS OR COMPATIBILITY LAYER KNOWNS AS BINDINGS TO ACCESS THAT SYSTEM LIBRARY. POINT BEING- WITHOUT 'OLM' OUR SERVICE AI BOT MAPLE IS OTHERWISE BLIND AND CAN NOT SEE TO ACKNOWLEDGE 'ANY' OUTBOUND COMMUNICATION FROM 'ANY' POINTS OF ORIGIN WHERE USERS/CHANNELS HAVE THAT E2E ENCRYPTION ENABLED EVEN.```
---
MAPLE COMMUNICATES VIA A NETSPANNED 'MATRIX PROTOCOL', HER PLUGIN REQUIRES AN API CLIENT WHICH IS THE MODULE 'NIO' TO FACILITATE THAT. WHERE ENCRYPTION IS USED, AN ADDITIONAL (BASE) LIBRARY IS NEEDED TO SIMPLIFY THIS DOUBLE RATCHET END-2-END ENCRYPTION CALLED 'OLM' - A SYSTEM LIBRARY AND A LANGUAGE LIBRARY ARE REQUIRED.. IN THIS CASE THE SYSTEM IS DEBIAN WITH LIBOLM.SO, THE LANGUAGE IS PYTHON AND REQUIRES BINDINGS TO ACCESS THIS SYSTEM LIBRARY. - WITHOUT OLM MAPLE IS BLIND AND CAN NOT SEE TO ACKNOWLEDGE OUTBOUND COMMUNICATION FROM POINTS OF ORIGIN WHERE CHANNELS HAVE ENCRYPTION ENABLED. THAT MAY BE AN IDEAL USAGE UNTIL YOU REQUIRE IT AND NEED TO DEVELOP WITH IT.
### ***OLM LIBRARY BUILD NOTES*** (`TESTED ON DEBIAN`)
#OLM LIBRARY BUILD NOTES ( TESTED ON DEBIAN )
#prerequisite
# [`PREREQUISITE`]
- sudo apt install cmake
#objective
---
# [`OBJECTIVE`]
assuming you are using maple bot, we are going to skip over that bot's setup directly to where we are dropping in the 'olm' library for e2e functionality
#process
A - `get the maple bot src, enter it's root directory`
---
# [`PROCESS`]
### A - `get the maple bot src, enter it's root directory`
- git clone --recursive https://git.tcp.direct/decoded/maple.git && cd maple
B - `within that root directory get the 'olm' src, also enter it's root directory`
### B - `within that root directory get the 'olm' src, also enter it's root directory`
- git clone --recursive https://gitlab.matrix.org/matrix-org/olm.git && cd olm
C - `build 'olm' system library`
### C - `build 'olm' system library`
- cmake . -Bbuild && cmake --build build
```
dr1p in 🌐 SAISABER in olm on  master via △ v3.18.4 via 🌙 via 🐍 v3.9.2 via 🐦
cmake . -Bbuild && cmake --build build
-- The CXX compiler identification is GNU 10.2.1
@ -377,10 +383,10 @@ so [ 47%] Linking CXX executable test_ratchet
[ 98%] Building CXX object tests/CMakeFiles/test_pk.dir/test_pk.cpp.o
[100%] Linking CXX executable test_pk
[100%] Built target test_pk
D - `enter python root directory and build the 'olm' bindings for python to interact with the 'olm' system library
```
# D - `enter python root directory and build the 'olm' bindings for python to interact with the 'olm' system library`
- cd python && make
```
dr1p in 🌐 SAISABER in olm/python on  master via 🐍 v3.9.2
make
mkdir -p include/olm
@ -419,18 +425,17 @@ D - `enter python root directory and build the 'olm' bindings for python to inte
-Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/
python3.9 -c build/temp.linux-x86_64-3.9/_libolm.c -o build/temp.linux-x86_64-3.9/build/temp.linux-x86_64-3.9/_libolm.o -I../include
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -Wl,-z,relro -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-RNBry6/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.9/build/temp.linux-x86_64-3.9/_libolm.o -lolm -o build/lib.linux-x86_64-3.9/_libolm.abi3.so -L../build
# the 'olm' system library that was built is here - ~/maple/olm/build/libolm.so.3.2.12
```
### the 'olm' system library that was built is here - ~/maple/olm/build/libolm.so.3.2.12
```
dr1p in 🌐 SAISABER in maple on  main [?] via 🐍 v3.9.2
ls -al ~/maple/olm/build|grep libolm
lrwxrwxrwx 11 dr1p 5 Oct 18:01 libolm.so -> libolm.so.3
lrwxrwxrwx 16 dr1p 5 Oct 18:01 libolm.so.3 -> libolm.so.3.2.12
---> .rwxr-xr-x 206k dr1p 5 Oct 18:01 libolm.so.3.2.12
# the 'python' bindings are here - ~/maple/olm/python/build/lib.linux-x86_64-3.9 ( HOWEVER ) we will be installing this differently
```
### the 'python' bindings are here - ~/maple/olm/python/build/lib.linux-x86_64-3.9 ( HOWEVER ) we will be installing this differently
```
dr1p in 🌐 SAISABER in python/build/lib.linux-x86_64-3.9 on  master
fd
olm
@ -444,14 +449,17 @@ D - `enter python root directory and build the 'olm' bindings for python to inte
olm/sas.py
olm/session.py
olm/utility.py
E - enter maple's root directory and activate that virtual environment so when we install olm bindings they are in the right place and then enable this library in our nio client
1 - activate maple virtualenv
```
# E - `enter maple's root directory and activate that virtual environment so when we install olm bindings they are in the right place and then enable this library in our nio client`
- activate maple virtualenv
- cd ~/maple && source env/bin/activate
```
dr1p in 🌐 SAISABER in ~ via 🐍 v3.9.2
cd ~/maple && source env/bin/activate
2 - install our 'olm' bindings
```
### install our 'olm' bindings
- cd ~/maple/olm/python && pip install .
```
dr1p in 🌐 SAISABER in maple on  main [?] via 🐍 v3.9.2 (env)
cd ~/maple/olm/python && pip install .
Processing /home/dr1p/maple/olm/python
@ -468,8 +476,10 @@ E - enter maple's root directory and activate that virtual environment so when w
Successfully built python-olm
Installing collected packages: pycparser, cffi, python-olm
Successfully installed cffi-1.15.1 pycparser-2.21 python-olm-3.2.12
3 - activate 'olm' - really we are switch over from one 'nio' client to an entirely different 'nio' client but this one is based in this 'olm' library
```
# 3 - `activate 'olm' - really we are switch over from one 'nio' client to an entirely different 'nio' client but this one is based in this 'olm' library`
- pip install "matrix-nio[e2e]"
```
dr1p in 🌐 SAISABER in olm/python on  master via 🐍 v3.9.2 (env) took 5s
pip install "matrix-nio[e2e]"
Requirement already satisfied: matrix-nio[e2e] in /home/dr1p/maple/env/lib/python3.9/site-packages (0.20.0)
@ -516,8 +526,9 @@ E - enter maple's root directory and activate that virtual environment so when w
Successfully built atomicwrites peewee
Installing collected packages: peewee, atomicwrites
Successfully installed atomicwrites-1.4.1 peewee-3.15.3
F - how i knew this stuff actually worked is my lack of having placed the 'olm' system library in the right place when starting a maple instance
```
# F - `how i knew this stuff actually worked is my lack of having placed the 'olm' system library in the right place when starting a maple instance`
```
dr1p in 🌐 SAISABER in ~ via 🐍 v3.9.2 (env)
deactivate && cd ~/maple && bash maple
located jq
@ -546,9 +557,10 @@ F - how i knew this stuff actually worked is my lack of having placed the 'olm'
File "/home/dr1p/maple/env/lib/python3.9/site-packages/olm/utility.py", line 39, in <module>
from _libolm import ffi, lib # type: ignore
ImportError: libolm.so.3: cannot open shared object file: No such file or directory
G - copy 'olm' library to /usr/lib and create the symbolic links to it
```
# G - `copy 'olm' library to /usr/lib and create the symbolic links to it`
- sudo cp ~/maple/olm/build/libolm.so.3.2.12 /usr/lib
```
sudo ln -s /usr/lib/libolm.so.3.2.12 /usr/lib/libolm.so.3
sudo ln -s /usr/lib/libolm.so.3.2.12 /usr/lib/libolm.so
dr1p in 🌐 SAISABER in maple on  main [?] via 🐍 v3.9.2
@ -556,23 +568,26 @@ G - copy 'olm' library to /usr/lib and create the symbolic links to it
lrwxrwxrwx 25 root 5 Oct 19:14 /usr/lib/libolm.so -> /usr/lib/libolm.so.3.2.12
lrwxrwxrwx 25 root 5 Oct 19:14 /usr/lib/libolm.so.3 -> /usr/lib/libolm.so.3.2.12
.rwxr-xr-x 206k root 5 Oct 19:13 /usr/lib/libolm.so.3.2.12
```
H - test - start maple and see if the olm'd version of 'nio' crashes, it doesn't so we are done
dr1p in 🌐 SAISABER in maple on  main [?] via 🐍 v3.9.2
./maple
located jq
located nc
# H - `test - start maple and see if the olm'd version of 'nio' crashes, it doesn't so we are done`
```
dr1p in 🌐 SAISABER in maple on  main [?] via 🐍 v3.9.2
./maple
located jq
located nc
[ PREREQUISITES CHECK - PASSED ]
[ running hydra_dupe__services ]
[ hydra_dupe__services bot added to background as a job. pid: 12081 ]
dr1p in 🌐 SAISABER in maple on  main [?] via 🐍 v3.9.2
<<< system_status__info >>> [ main loop ] - startup
<<< ________botio_class >>> [ instantiated ]
################################################################### POSSIBLE FUTURE RELEVANCE
[ PREREQUISITES CHECK - PASSED ]
[ running hydra_dupe__services ]
[ hydra_dupe__services bot added to background as a job. pid: 12081 ]
dr1p in 🌐 SAISABER in maple on  main [?] via 🐍 v3.9.2
<<< system_status__info >>> [ main loop ] - startup
<<< ________botio_class >>> [ instantiated ]
...
```
# FUTURE RELEVANCE
```
python-olm
==========
@ -734,4 +749,4 @@ Pickling works the same way as for peer-to-peer Olm sessions.
[5]: https://git.matrix.org/git/olm/about/docs/megolm.rst
[6]: https://matrix.org/docs/guides/end-to-end-encryption-implementation-guide
[7]: https://poljar.github.io/python-olm/html/index.html
```