work on chat
This commit is contained in:
parent
d548723f90
commit
a375117dd8
5
docs/dev/specs/forward-secrecy.md
Normal file
5
docs/dev/specs/forward-secrecy.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Onionr Forward Secrecy Spec v0.0.0
|
||||||
|
|
||||||
|
# Introduction
|
||||||
|
|
||||||
|
Due to the natural trade-offs of implementing [forward secrecy](https://en.wikipedia.org/wiki/Forward_secrecy) in a distributed, decentralized system, Onionr has optional
|
@ -18,8 +18,10 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
'''
|
'''
|
||||||
import communicator, onionrblockapi
|
import communicator, onionrblockapi
|
||||||
|
import logger
|
||||||
from onionrutils import stringvalidators, bytesconverter
|
from onionrutils import stringvalidators, bytesconverter
|
||||||
from coredb import blockmetadb
|
from coredb import blockmetadb
|
||||||
|
from onionrservices import server_exists
|
||||||
def service_creator(daemon):
|
def service_creator(daemon):
|
||||||
assert isinstance(daemon, communicator.OnionrCommunicatorDaemon)
|
assert isinstance(daemon, communicator.OnionrCommunicatorDaemon)
|
||||||
|
|
||||||
@ -30,10 +32,13 @@ def service_creator(daemon):
|
|||||||
if not b in daemon.active_services:
|
if not b in daemon.active_services:
|
||||||
bl = onionrblockapi.Block(b, decrypt=True)
|
bl = onionrblockapi.Block(b, decrypt=True)
|
||||||
bs = bytesconverter.bytes_to_str(bl.bcontent) + '.onion'
|
bs = bytesconverter.bytes_to_str(bl.bcontent) + '.onion'
|
||||||
|
if server_exists(bl.signer):
|
||||||
|
continue
|
||||||
if stringvalidators.validate_pub_key(bl.signer) and stringvalidators.validate_transport(bs):
|
if stringvalidators.validate_pub_key(bl.signer) and stringvalidators.validate_transport(bs):
|
||||||
signer = bytesconverter.bytes_to_str(bl.signer)
|
signer = bytesconverter.bytes_to_str(bl.signer)
|
||||||
daemon.active_services.append(b)
|
daemon.active_services.append(b)
|
||||||
daemon.active_services.append(signer)
|
daemon.active_services.append(signer)
|
||||||
daemon.services.create_server(signer, bs, daemon)
|
if not daemon.services.create_server(signer, bs, daemon):
|
||||||
|
daemon.active_services.remove(b)
|
||||||
|
daemon.active_services.remove(signer)
|
||||||
daemon.decrementThreadCount('service_creator')
|
daemon.decrementThreadCount('service_creator')
|
||||||
|
@ -19,9 +19,10 @@
|
|||||||
'''
|
'''
|
||||||
import time
|
import time
|
||||||
import stem
|
import stem
|
||||||
from . import connectionserver, bootstrapservice
|
from . import connectionserver, bootstrapservice, serverexists
|
||||||
from onionrutils import stringvalidators, basicrequests
|
from onionrutils import stringvalidators, basicrequests
|
||||||
import config
|
import config
|
||||||
|
server_exists = serverexists.server_exists
|
||||||
class OnionrServices:
|
class OnionrServices:
|
||||||
'''
|
'''
|
||||||
Create a client or server for connecting to peer interfaces
|
Create a client or server for connecting to peer interfaces
|
||||||
@ -55,5 +56,10 @@ class OnionrServices:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def create_client(peer, comm_inst=None):
|
def create_client(peer, comm_inst=None):
|
||||||
# Create ephemeral onion service to bootstrap connection
|
# Create ephemeral onion service to bootstrap connection
|
||||||
|
if not comm_inst == None:
|
||||||
|
try:
|
||||||
|
return comm_inst.direct_connection_clients[peer]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
address = bootstrapservice.bootstrap_client_service(peer, comm_inst)
|
address = bootstrapservice.bootstrap_client_service(peer, comm_inst)
|
||||||
return address
|
return address
|
||||||
|
30
onionr/onionrservices/serverexists.py
Normal file
30
onionr/onionrservices/serverexists.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
'''
|
||||||
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
|
Function to check if an onion server is created for a peer or not
|
||||||
|
'''
|
||||||
|
'''
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
'''
|
||||||
|
import deadsimplekv
|
||||||
|
|
||||||
|
import filepaths
|
||||||
|
from onionrutils import bytesconverter
|
||||||
|
|
||||||
|
def server_exists(peer: str) -> bool:
|
||||||
|
'''checks if an onion server is created for a peer or not'''
|
||||||
|
peer = bytesconverter.bytes_to_str(peer)
|
||||||
|
kv = deadsimplekv.DeadSimpleKV(filepaths.cached_storage)
|
||||||
|
kv.refresh()
|
||||||
|
return not kv.get('dc-' + peer) is None
|
@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
Onionr - Private P2P Communication
|
||||||
|
|
||||||
|
Resize chat elements to help with responsiveness
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
let doResize = function(){
|
let doResize = function(){
|
||||||
let chatInput = document.getElementsByClassName('chatInput')[0]
|
let chatInput = document.getElementsByClassName('chatInput')[0]
|
||||||
chatInput.style.width = "50%";
|
chatInput.style.width = "50%";
|
||||||
|
Loading…
Reference in New Issue
Block a user