remove unused code
This commit is contained in:
parent
14b2c99ab3
commit
defbbf290f
3 changed files with 2 additions and 22 deletions
|
@ -10,8 +10,8 @@ from threading import Thread
|
|||
import time
|
||||
import select
|
||||
|
||||
from utils import valid, get_public_ipv6, get_local_ipv4, get_interface
|
||||
from settings import preferences, server, USER_ID, sk
|
||||
from utils import get_public_ipv6, get_local_ipv4, get_interface
|
||||
from settings import preferences, server, USER_ID
|
||||
import state
|
||||
import db
|
||||
import user.models
|
||||
|
|
|
@ -154,7 +154,6 @@ class Node(Thread):
|
|||
return None
|
||||
#logger.debug('url=%s', url)
|
||||
content = json.dumps([action, args]).encode()
|
||||
#sig = settings.sk.sign(content, encoding=ENCODING).decode()
|
||||
headers = {
|
||||
'User-Agent': settings.USER_AGENT,
|
||||
'X-Node-Protocol': settings.NODE_PROTOCOL,
|
||||
|
|
19
oml/utils.py
19
oml/utils.py
|
@ -118,25 +118,6 @@ def get_position_by_id(list, key):
|
|||
return i
|
||||
return -1
|
||||
|
||||
def valid(key, value, sig):
|
||||
'''
|
||||
validate that value was signed by key
|
||||
'''
|
||||
import ed25519
|
||||
if isinstance(sig, str):
|
||||
sig = sig.encode()
|
||||
if isinstance(value, str):
|
||||
value = value.encode()
|
||||
if isinstance(key, str):
|
||||
key = key.encode()
|
||||
vk = ed25519.VerifyingKey(key, encoding=ENCODING)
|
||||
try:
|
||||
vk.verify(sig, value, encoding=ENCODING)
|
||||
#except ed25519.BadSignatureError:
|
||||
except:
|
||||
return False
|
||||
return True
|
||||
|
||||
def get_user_id(private_key, cert_path):
|
||||
if os.path.exists(private_key):
|
||||
with open(private_key) as fd:
|
||||
|
|
Loading…
Reference in a new issue