use base64 for the API passphrase and random address label

This commit is contained in:
Jonathan Warren 2013-03-19 16:17:54 -04:00
parent b8b9570356
commit 267896cbe1
2 changed files with 7 additions and 3 deletions

View File

@ -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)

View File

@ -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: