Skip to content
Snippets Groups Projects
Commit 19542ef7 authored by inso's avatar inso
Browse files

Same parameters as ucoin-cli, but still cannot sign...

parent 75e7bbf3
No related branches found
No related tags found
No related merge requests found
...@@ -123,7 +123,10 @@ class API(object): ...@@ -123,7 +123,10 @@ class API(object):
Arguments: Arguments:
- `path`: the request path - `path`: the request path
""" """
if 'self_' in kwargs.keys():
kwargs['self'] = kwargs.pop('self_')
logging.debug("POST : {0}".format(kwargs))
response = requests.post(self.reverse_url(path), data=kwargs, headers=self.headers) response = requests.post(self.reverse_url(path), data=kwargs, headers=self.headers)
if response.status_code != 200: if response.status_code != 200:
......
...@@ -31,7 +31,7 @@ class Add(WOT): ...@@ -31,7 +31,7 @@ class Add(WOT):
def __post__(self, **kwargs): def __post__(self, **kwargs):
assert 'pubkey' in kwargs assert 'pubkey' in kwargs
assert 'self' in kwargs assert 'self_' in kwargs
assert 'other' in kwargs assert 'other' in kwargs
return self.requests_post('/add', **kwargs).json() return self.requests_post('/add', **kwargs).json()
......
...@@ -79,7 +79,7 @@ class Certification(Document): ...@@ -79,7 +79,7 @@ class Certification(Document):
def raw(self, selfcert): def raw(self, selfcert):
return """{0}META:TS:{1}-{2} return """{0}META:TS:{1}-{2}
""".format(selfcert.signed_raw(), self.blockhash, self.blocknumber) """.format(selfcert.signed_raw(), self.blocknumber, self.blockhash)
def signed_raw(self, selfcert): def signed_raw(self, selfcert):
raw = self.raw(selfcert) raw = self.raw(selfcert)
......
...@@ -117,7 +117,7 @@ class Account(object): ...@@ -117,7 +117,7 @@ class Account(object):
certification = Certification(PROTOCOL_VERSION, community.currency, certification = Certification(PROTOCOL_VERSION, community.currency,
self.pubkey, certified.pubkey, self.pubkey, certified.pubkey,
block.number, block_hash, None) block_hash, block.number, None)
selfcert = certified.selfcert(community) selfcert = certified.selfcert(community)
raw_cert = certification.raw(selfcert) raw_cert = certification.raw(selfcert)
...@@ -125,15 +125,17 @@ class Account(object): ...@@ -125,15 +125,17 @@ class Account(object):
key = SigningKey(self.salt, password) key = SigningKey(self.salt, password)
signing = base64.b64encode(key.signature(bytes(raw_cert, 'ascii'))) signing = base64.b64encode(key.signature(bytes(raw_cert, 'ascii')))
logging.debug("Signature : {0}".format(signing.decode("ascii"))) logging.debug("Raw certification {0}".format(raw_cert))
logging.debug("Signature of {0}".format(signing.decode("ascii")))
certification.signatures = [signing.decode("ascii")] certification.signatures = [signing.decode("ascii")]
signed_cert = certification.signed_raw(selfcert) signed_cert = certification.signed_raw(selfcert)
logging.debug("Certification : {0}".format(signed_cert)) logging.debug("Certification : {0}".format(signed_cert))
community.post(bma.wot.Add, {}, data = {'pubkey': certified.pubkey,
{'pubkey': certified.pubkey, 'self_': selfcert.signed_raw(),
'self': selfcert.signed_raw(), 'other': "{0}\n".format(certification.inline())}
'others': certification.inline() + "\n"}) logging.debug("Posted data : {0}".format(data))
community.post(bma.wot.Add, {}, data)
def sources(self, community): def sources(self, community):
sources = [] sources = []
......
...@@ -145,7 +145,6 @@ class Community(object): ...@@ -145,7 +145,6 @@ class Community(object):
e = next(e for e in peer.endpoints if type(e) is BMAEndpoint) e = next(e for e in peer.endpoints if type(e) is BMAEndpoint)
logging.debug("Trying to connect to : " + peer.pubkey) logging.debug("Trying to connect to : " + peer.pubkey)
req = request(e.conn_handler(), **req_args) req = request(e.conn_handler(), **req_args)
logging.debug("{0}".format(post_args))
req.post(**post_args) req.post(**post_args)
def jsonify_peers_list(self): def jsonify_peers_list(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment