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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
294b822e
Commit
294b822e
authored
8 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Fix implicit revocation time
parent
2fb0ecb0
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sakia/core/registry/identity.py
+17
-0
17 additions, 0 deletions
src/sakia/core/registry/identity.py
src/sakia/gui/community_view.py
+3
-3
3 additions, 3 deletions
src/sakia/gui/community_view.py
with
20 additions
and
3 deletions
src/sakia/core/registry/identity.py
+
17
−
0
View file @
294b822e
...
@@ -465,6 +465,23 @@ class Identity(QObject):
...
@@ -465,6 +465,23 @@ class Identity(QObject):
certified_list
=
await
self
.
certified_by
(
identities_registry
,
community
)
certified_list
=
await
self
.
certified_by
(
identities_registry
,
community
)
return
await
self
.
_unique_valid
(
certified_list
,
community
)
return
await
self
.
_unique_valid
(
certified_list
,
community
)
async
def
identity_revocation_time
(
self
,
community
):
"""
Get the remaining time before identity implicit revocation
:param sakia.core.Community community: the community
:return: the remaining time
:rtype: int
"""
membership
=
await
self
.
membership
(
community
)
join_block
=
membership
[
'
blockNumber
'
]
block
=
await
community
.
get_block
(
join_block
)
join_date
=
block
[
'
medianTime
'
]
parameters
=
await
community
.
parameters
()
# revocation date is join_date + 1 sigvalidity (expiration date) + 2*sigvalidity
revocation_date
=
join_date
+
3
*
parameters
[
'
sigValidity
'
]
current_time
=
time
.
time
()
return
revocation_date
-
current_time
async
def
membership_expiration_time
(
self
,
community
):
async
def
membership_expiration_time
(
self
,
community
):
"""
"""
Get the remaining time before membership expiration
Get the remaining time before membership expiration
...
...
This diff is collapsed.
Click to expand it.
src/sakia/gui/community_view.py
+
3
−
3
View file @
294b822e
...
@@ -212,14 +212,14 @@ The publication of this document will remove your identity from the network.</p>
...
@@ -212,14 +212,14 @@ The publication of this document will remove your identity from the network.</p>
try
:
try
:
person
=
await
self
.
app
.
identities_registry
.
future_find
(
self
.
app
.
current_account
.
pubkey
,
self
.
community
)
person
=
await
self
.
app
.
identities_registry
.
future_find
(
self
.
app
.
current_account
.
pubkey
,
self
.
community
)
expiration_time
=
await
person
.
membership_expiration_time
(
self
.
community
)
expiration_time
=
await
person
.
membership_expiration_time
(
self
.
community
)
revokation_time
=
await
person
.
identity_revocation_time
(
self
.
community
)
parameters
=
await
self
.
community
.
parameters
()
parameters
=
await
self
.
community
.
parameters
()
sig_validity
=
parameters
[
'
sigValidity
'
]
sig_validity
=
parameters
[
'
sigValidity
'
]
warning_expiration_time
=
int
(
sig_validity
/
3
)
warning_expiration_time
=
int
(
sig_validity
/
3
)
will_expire_soon
=
(
expiration_time
<
warning_expiration_time
)
will_expire_soon
=
(
expiration_time
<
warning_expiration_time
)
revokation_deadline
=
expiration_time
+
2
*
sig_validity
revokation_soon
=
(
revokation_time
<
2
*
warning_expiration_time
)
revokation_soon
=
(
time
.
time
()
>
revokation_deadline
)
if
revokation_soon
:
if
revokation_soon
:
days
=
int
(
(
revokation_
deadline
-
time
.
time
())
/
3600
/
24
)
days
=
int
(
revokation_
time
/
3600
/
24
)
if
'
warning_revokation
'
not
in
self
.
status_info
:
if
'
warning_revokation
'
not
in
self
.
status_info
:
self
.
status_info
.
append
(
'
warning_revokation
'
)
self
.
status_info
.
append
(
'
warning_revokation
'
)
...
...
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
register
or
sign in
to comment