Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This project is archived. Its data is
read-only
.
Show more breadcrumbs
clients
python
sakia
Commits
00bba5e6
Commit
00bba5e6
authored
Mar 17, 2016
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Fix publishing of certification and identity
parent
e2c42f1a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sakia/core/account.py
+13
-16
13 additions, 16 deletions
src/sakia/core/account.py
with
13 additions
and
16 deletions
src/sakia/core/account.py
+
13
−
16
View file @
00bba5e6
...
@@ -4,14 +4,15 @@ Created on 1 févr. 2014
...
@@ -4,14 +4,15 @@ Created on 1 févr. 2014
@author: inso
@author: inso
"""
"""
from
ucoinpy.documents
import
Membership
,
SelfCertification
,
Certification
,
Revokation
,
BlockUID
from
ucoinpy.documents
import
Membership
,
SelfCertification
,
Certification
,
Revokation
,
BlockUID
,
Block
from
ucoinpy.key
import
SigningKey
from
ucoinpy.key
import
SigningKey
from
ucoinpy.api
import
bma
from
ucoinpy.api.bma
import
PROTOCOL_VERSION
import
logging
import
logging
import
time
import
asyncio
import
asyncio
from
pkg_resources
import
parse_version
from
pkg_resources
import
parse_version
from
aiohttp.errors
import
ClientError
from
PyQt5.QtCore
import
QObject
,
pyqtSignal
from
PyQt5.QtCore
import
QObject
,
pyqtSignal
from
.
import
money
from
.
import
money
...
@@ -20,9 +21,6 @@ from .community import Community
...
@@ -20,9 +21,6 @@ from .community import Community
from
.registry
import
LocalState
from
.registry
import
LocalState
from
..tools.exceptions
import
ContactAlreadyExists
from
..tools.exceptions
import
ContactAlreadyExists
from
..
import
__version__
from
..
import
__version__
from
ucoinpy.api
import
bma
from
ucoinpy.api.bma
import
PROTOCOL_VERSION
from
aiohttp.errors
import
ClientError
class
Account
(
QObject
):
class
Account
(
QObject
):
...
@@ -429,19 +427,20 @@ class Account(QObject):
...
@@ -429,19 +427,20 @@ class Account(QObject):
:param str password: The account SigningKey password
:param str password: The account SigningKey password
:param community: The community target of the self certification
:param community: The community target of the self certification
"""
"""
block_data
=
await
community
.
bma_access
.
simple_request
(
bma
.
blockchain
.
Current
)
signed_raw
=
"
{0}{1}
\n
"
.
format
(
block_data
[
'
raw
'
],
block_data
[
'
signature
'
])
block_uid
=
Block
.
from_signed_raw
(
signed_raw
).
blockUID
selfcert
=
SelfCertification
(
PROTOCOL_VERSION
,
selfcert
=
SelfCertification
(
PROTOCOL_VERSION
,
community
.
currency
,
community
.
currency
,
self
.
pubkey
,
self
.
pubkey
,
int
(
time
.
time
()),
self
.
name
,
self
.
name
,
block_uid
,
None
)
None
)
key
=
SigningKey
(
self
.
salt
,
password
)
key
=
SigningKey
(
self
.
salt
,
password
)
selfcert
.
sign
([
key
])
selfcert
.
sign
([
key
])
logging
.
debug
(
"
Key publish : {0}
"
.
format
(
selfcert
.
signed_raw
()))
logging
.
debug
(
"
Key publish : {0}
"
.
format
(
selfcert
.
signed_raw
()))
responses
=
await
community
.
bma_access
.
broadcast
(
bma
.
wot
.
Add
,
{},
{
'
pubkey
'
:
self
.
pubkey
,
responses
=
await
community
.
bma_access
.
broadcast
(
bma
.
wot
.
Add
,
{},
{
'
identity
'
:
selfcert
.
signed_raw
()})
'
self_
'
:
selfcert
.
signed_raw
(),
'
other
'
:
{}})
result
=
(
False
,
""
)
result
=
(
False
,
""
)
for
r
in
responses
:
for
r
in
responses
:
if
r
.
status
==
200
:
if
r
.
status
==
200
:
...
@@ -463,7 +462,7 @@ class Account(QObject):
...
@@ -463,7 +462,7 @@ class Account(QObject):
"""
"""
logging
.
debug
(
"
Send membership
"
)
logging
.
debug
(
"
Send membership
"
)
blockUID
=
await
community
.
blockUID
()
blockUID
=
community
.
network
.
current_
blockUID
self_identity
=
await
self
.
_identities_registry
.
future_find
(
self
.
pubkey
,
community
)
self_identity
=
await
self
.
_identities_registry
.
future_find
(
self
.
pubkey
,
community
)
selfcert
=
await
self_identity
.
selfcert
(
community
)
selfcert
=
await
self_identity
.
selfcert
(
community
)
...
@@ -494,7 +493,7 @@ class Account(QObject):
...
@@ -494,7 +493,7 @@ class Account(QObject):
:param str pubkey: The certified identity pubkey
:param str pubkey: The certified identity pubkey
"""
"""
logging
.
debug
(
"
Certdata
"
)
logging
.
debug
(
"
Certdata
"
)
blockUID
=
await
community
.
blockUID
()
blockUID
=
community
.
network
.
current_
blockUID
identity
=
await
self
.
_identities_registry
.
future_find
(
pubkey
,
community
)
identity
=
await
self
.
_identities_registry
.
future_find
(
pubkey
,
community
)
selfcert
=
await
identity
.
selfcert
(
community
)
selfcert
=
await
identity
.
selfcert
(
community
)
if
selfcert
:
if
selfcert
:
...
@@ -506,11 +505,9 @@ class Account(QObject):
...
@@ -506,11 +505,9 @@ class Account(QObject):
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
))
data
=
{
'
pubkey
'
:
pubkey
,
data
=
{
'
cert
'
:
certification
.
signed_raw
(
selfcert
)}
'
self_
'
:
selfcert
.
signed_raw
(),
'
other
'
:
"
{0}
\n
"
.
format
(
certification
.
inline
())}
logging
.
debug
(
"
Posted data : {0}
"
.
format
(
data
))
logging
.
debug
(
"
Posted data : {0}
"
.
format
(
data
))
responses
=
await
community
.
bma_access
.
broadcast
(
bma
.
wot
.
Add
,
{},
data
)
responses
=
await
community
.
bma_access
.
broadcast
(
bma
.
wot
.
Certify
,
{},
data
)
result
=
(
False
,
""
)
result
=
(
False
,
""
)
for
r
in
responses
:
for
r
in
responses
:
if
r
.
status
==
200
:
if
r
.
status
==
200
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment