From 267896cbe132d3d33f18a8b702f50723259bd468 Mon Sep 17 00:00:00 2001 From: Jonathan Warren Date: Tue, 19 Mar 2013 16:17:54 -0400 Subject: [PATCH] use base64 for the API passphrase and random address label --- api client.py | 8 +++++--- bitmessagemain.py | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/api client.py b/api client.py index ab6b6b9a..633f2b8a 100644 --- a/api client.py +++ b/api client.py @@ -25,10 +25,12 @@ print 'Now that we have our address data in a nice Python data structure, let\'s print jsonAddresses['addresses'][0]['label'] print 'Uncomment this next line to create a new random address.' -#print api.createRandomAddress('new address label') +addressLabel = 'new address label'.encode('base64') +print api.createRandomAddress(addressLabel) -print 'Uncomment these next three lines to create new new deterministic addresses.' -#jsonDeterministicAddresses = api.createDeterministicAddresses('asdfasdfqwerasdf', 2, 2, 1, False) +print 'Uncomment these next four lines to create new deterministic addresses.' +#passphrase = 'asdfasdfqwer'.encode('base64') +#jsonDeterministicAddresses = api.createDeterministicAddresses(passphrase, 2, 2, 1, False) #print jsonDeterministicAddresses #print json.loads(jsonDeterministicAddresses) diff --git a/bitmessagemain.py b/bitmessagemain.py index b4e4a9ab..44dd57e1 100755 --- a/bitmessagemain.py +++ b/bitmessagemain.py @@ -3346,6 +3346,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): eighteenByteRipe = False elif len(params) == 2: label, eighteenByteRipe = params + label = label.decode('base64') apiAddressGeneratorReturnQueue.queue.clear() apiSignalQueue.put(('createRandomAddress',(label, eighteenByteRipe))) #params should be a twopul which equals (eighteenByteRipe, label) return apiAddressGeneratorReturnQueue.get() @@ -3374,6 +3375,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): passphrase, numberOfAddresses, addressVersionNumber, streamNumber, eighteenByteRipe = params if len(passphrase) == 0: return 'API Error 0001: the specified passphrase is blank.' + passphrase = passphrase.decode('base64') if addressVersionNumber == 0: #0 means "just use the proper addressVersionNumber" addressVersionNumber == 2 if addressVersionNumber != 2: