Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
silkaj
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
silkaj
Merge requests
!91
Certification renewal
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Certification renewal
145_cert_renewal
into
dev
Overview
0
Commits
2
Pipelines
0
Changes
1
Merged
Moul
requested to merge
145_cert_renewal
into
dev
6 years ago
Overview
0
Commits
2
Pipelines
0
Changes
1
Expand
#145 (closed)
0
0
Merge request reports
Compare
dev
version 1
46b31183
6 years ago
dev (base)
and
latest version
latest version
bd28372e
2 commits,
6 years ago
version 1
46b31183
2 commits,
6 years ago
1 file
+
22
−
5
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
silkaj/cert.py
+
22
−
5
Options
import
urllib
from
time
import
time
from
tabulate
import
tabulate
from
silkaj.auth
import
auth_method
from
silkaj.crypto_tools
import
get_publickey_from_seed
,
sign_document_from_seed
from
silkaj.tools
import
message_exit
from
silkaj.network_tools
import
post_request
,
HeadBlock
from
silkaj.tools
import
convert_time
,
message_exit
from
silkaj.network_tools
import
get_request
,
post_request
,
HeadBlock
from
silkaj.blockchain_tools
import
BlockchainParams
from
silkaj.license
import
license_approval
from
silkaj.wot
import
is_member
,
get_uid_from_pubkey
,
get_informations_for_identity
@@ -28,9 +30,24 @@ def send_certification(cli_args):
if
issuer_pubkey
==
id_to_certify
[
"
pubkey
"
]:
message_exit
(
"
You can’t certify yourself!
"
)
for
certifier
in
main_id_to_certify
[
"
others
"
]:
if
certifier
[
"
pubkey
"
]
==
issuer_pubkey
:
message_exit
(
"
Identity already certified by
"
+
issuer_id
)
# Check if the certification can be renewed
req
=
get_request
(
"
wot/requirements/
"
+
id_to_certify
[
"
pubkey
"
])[
"
identities
"
][
0
]
for
cert
in
req
[
"
certifications
"
]:
if
cert
[
"
from
"
]
==
issuer_pubkey
:
params
=
BlockchainParams
().
params
# Change params["msWindow"] to params["sigReplay"] when deployed
# https://git.duniter.org/nodes/typescript/duniter/merge_requests/1270
# Ğ1: 0<–>2y - 2y + 2m
# ĞT: 0<–>6m - 6m + ¼m
renewable
=
cert
[
"
expiresIn
"
]
-
params
[
"
sigValidity
"
]
+
params
[
"
msWindow
"
]
if
renewable
>
0
:
renewable_date
=
convert_time
(
time
()
+
renewable
,
"
date
"
)
message_exit
(
"
Certification renewable the
"
+
renewable_date
)
# Check if the certification is already in the pending certifications
for
pending_cert
in
req
[
"
pendingCerts
"
]:
if
pending_cert
[
"
from
"
]
==
issuer_pubkey
:
message_exit
(
"
Certification is currently been processed
"
)
# Certification confirmation
if
not
certification_confirmation
(
Loading