Add label argument to createChan API endpoint
This commit is contained in:
parent
e6ecaa5e7d
commit
398cebbab2
|
@ -779,10 +779,13 @@ class BMRPCDispatcher(object):
|
||||||
return queues.apiAddressGeneratorReturnQueue.get()
|
return queues.apiAddressGeneratorReturnQueue.get()
|
||||||
|
|
||||||
@command('createChan')
|
@command('createChan')
|
||||||
def HandleCreateChan(self, passphrase):
|
def HandleCreateChan(self, passphrase, label=None):
|
||||||
"""
|
"""
|
||||||
Creates a new chan. passphrase must be base64 encoded.
|
Creates a new chan. passphrase must be base64 encoded.
|
||||||
Returns the corresponding Bitmessage address.
|
Returns the corresponding Bitmessage address.
|
||||||
|
|
||||||
|
:param str passphrase: base64 encoded passphrase
|
||||||
|
:param str label: label to set for the chan
|
||||||
"""
|
"""
|
||||||
|
|
||||||
passphrase = self._decode(passphrase, "base64")
|
passphrase = self._decode(passphrase, "base64")
|
||||||
|
@ -791,6 +794,7 @@ class BMRPCDispatcher(object):
|
||||||
# It would be nice to make the label the passphrase but it is
|
# It would be nice to make the label the passphrase but it is
|
||||||
# possible that the passphrase contains non-utf-8 characters.
|
# possible that the passphrase contains non-utf-8 characters.
|
||||||
try:
|
try:
|
||||||
|
if label is None:
|
||||||
passphrase.decode('utf-8')
|
passphrase.decode('utf-8')
|
||||||
label = str_chan + ' ' + passphrase
|
label = str_chan + ' ' + passphrase
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
|
|
Reference in New Issue
Block a user