Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,10 +779,13 @@ def HandleGetDeterministicAddress(
return queues.apiAddressGeneratorReturnQueue.get()

@command('createChan')
def HandleCreateChan(self, passphrase):
def HandleCreateChan(self, passphrase, label=None):
"""
Creates a new chan. passphrase must be base64 encoded.
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")
Expand All @@ -791,8 +794,9 @@ def HandleCreateChan(self, passphrase):
# It would be nice to make the label the passphrase but it is
# possible that the passphrase contains non-utf-8 characters.
try:
passphrase.decode('utf-8')
label = str_chan + ' ' + passphrase
if label is None:
passphrase.decode('utf-8')
label = str_chan + ' ' + passphrase
except UnicodeDecodeError:
label = str_chan + ' ' + repr(passphrase)

Expand Down