1
0

x509 fixes and plugins

This commit is contained in:
Dmitry Sorokin
2017-02-05 13:38:44 +03:00
committed by ThomasV
parent 0693403358
commit 362ca96f38
18 changed files with 111 additions and 115 deletions

View File

@@ -26,7 +26,7 @@
import socket
import threading
import time
import xmlrpclib
from xmlrpc.client import ServerProxy
from PyQt4.QtGui import *
from PyQt4.QtCore import *
@@ -45,7 +45,7 @@ import traceback
PORT = 12344
HOST = 'cosigner.electrum.org'
server = xmlrpclib.ServerProxy('http://%s:%d'%(HOST,PORT), allow_none=True)
server = ServerProxy('http://%s:%d'%(HOST,PORT), allow_none=True)
class Listener(util.DaemonThread):

View File

@@ -23,8 +23,6 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from __future__ import absolute_import
import time
import threading
import base64
@@ -33,9 +31,9 @@ from functools import partial
import smtplib
import imaplib
import email
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email import Encoders
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email.encoders import encode_base64
from PyQt4.QtGui import *
from PyQt4.QtCore import *
@@ -49,7 +47,6 @@ from electrum_gui.qt.util import EnterButton, Buttons, CloseButton
from electrum_gui.qt.util import OkButton, WindowModalDialog
class Processor(threading.Thread):
polling_interval = 5*60
@@ -96,7 +93,7 @@ class Processor(threading.Thread):
msg['From'] = self.username
part = MIMEBase('application', "bitcoin-paymentrequest")
part.set_payload(payment_request)
Encoders.encode_base64(part)
encode_base64(part)
part.add_header('Content-Disposition', 'attachment; filename="payreq.btc"')
msg.attach(part)
s = smtplib.SMTP_SSL(self.imap_server, timeout=2)

View File

@@ -1 +1 @@
from plugin import HW_PluginBase
from .plugin import HW_PluginBase

View File

@@ -12,8 +12,6 @@ from electrum.plugins import BasePlugin, hook
from electrum.i18n import _
class LabelsPlugin(BasePlugin):
def __init__(self, parent, config, name):
@@ -83,7 +81,7 @@ class LabelsPlugin(BasePlugin):
bundle = {"labels": [],
"walletId": wallet_id,
"walletNonce": self.get_nonce(wallet)}
for key, value in wallet.labels.iteritems():
for key, value in wallet.labels.items():
try:
encoded_key = self.encode(wallet, key)
encoded_value = self.encode(wallet, value)
@@ -135,12 +133,12 @@ class LabelsPlugin(BasePlugin):
def start_wallet(self, wallet):
nonce = self.get_nonce(wallet)
self.print_error("wallet", wallet.basename(), "nonce is", nonce)
mpk = wallet.get_fingerprint()
mpk = wallet.get_fingerprint().encode('ascii')
if not mpk:
return
password = hashlib.sha1(mpk).digest().encode('hex')[:32]
password = hashlib.sha1(mpk).hexdigest()[:32].encode('ascii')
iv = hashlib.sha256(password).digest()[:16]
wallet_id = hashlib.sha256(mpk).digest().encode('hex')
wallet_id = hashlib.sha256(mpk).hexdigest()
self.wallets[wallet] = (password, iv, wallet_id)
# If there is an auth token we can try to actually start syncing
t = threading.Thread(target=self.pull_thread, args=(wallet, False))

View File

@@ -9,7 +9,7 @@ from electrum_gui.qt import EnterButton
from electrum_gui.qt.util import ThreadedButton, Buttons
from electrum_gui.qt.util import WindowModalDialog, OkButton
from labels import LabelsPlugin
from .labels import LabelsPlugin
class Plugin(LabelsPlugin):

View File

@@ -3,8 +3,8 @@ from electrum.plugins import BasePlugin, hook
from electrum.i18n import _
import random
class Plugin(BasePlugin):
class Plugin(BasePlugin):
vkb = None
vkb_index = 0
@@ -25,7 +25,7 @@ class Plugin(BasePlugin):
self.vkb_index += 1
def virtual_keyboard(self, i, pw):
i = i%3
i = i % 3
if i == 0:
chars = 'abcdefghijklmnopqrstuvwxyz '
elif i == 1:
@@ -35,9 +35,9 @@ class Plugin(BasePlugin):
n = len(chars)
s = []
for i in xrange(n):
for i in range(n):
while True:
k = random.randint(0,n-1)
k = random.randint(0, n - 1)
if k not in s:
s.append(k)
break
@@ -53,7 +53,7 @@ class Plugin(BasePlugin):
l_button.setFixedWidth(25)
l_button.setFixedHeight(25)
l_button.clicked.connect(add_target(chars[s[i]]))
grid.addWidget(l_button, i/6, i%6)
grid.addWidget(l_button, i // 6, i % 6)
vbox.addLayout(grid)