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
Commits
d0d236df
Commit
d0d236df
authored
3 years ago
by
matograine
Browse files
Options
Downloads
Patches
Plain Diff
[mod]
#344
use pendulum in silkaj.cert
parent
1cc86af8
No related branches found
No related tags found
1 merge request
!177
#344: Fix import loop issue, Generalize pendulum usage
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
silkaj/cert.py
+9
-9
9 additions, 9 deletions
silkaj/cert.py
with
9 additions
and
9 deletions
silkaj/cert.py
+
9
−
9
View file @
d0d236df
...
...
@@ -17,7 +17,8 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
import
sys
import
click
from
time
import
time
from
pendulum
import
from_timestamp
,
now
from
tabulate
import
tabulate
from
duniterpy.api
import
bma
from
duniterpy.documents
import
BlockUID
,
block_uid
,
Identity
,
Certification
...
...
@@ -28,7 +29,7 @@ from silkaj.network_tools import ClientInstance
from
silkaj.blockchain_tools
import
BlockchainParams
,
HeadBlock
from
silkaj.license
import
license_approval
from
silkaj
import
wot
,
tui
from
silkaj.constants
import
SUCCESS_EXIT_STATUS
from
silkaj.constants
import
SUCCESS_EXIT_STATUS
,
DATE
,
ALL
from
silkaj.crypto_tools
import
is_pubkey_and_check
...
...
@@ -108,8 +109,8 @@ async def pre_checks(client, issuer_pubkey, pubkey_to_certify):
# ĞT: 0<–>4.8m - 4.8m + 12.5d
renewable
=
cert
[
"
expiresIn
"
]
-
params
[
"
sigValidity
"
]
+
params
[
"
sigReplay
"
]
if
renewable
>
0
:
renewable_date
=
tui
.
convert_time
(
time
()
+
renewable
,
"
date
"
)
message_exit
(
"
Certification renewable
the
"
+
renewable_date
)
renewable_date
=
now
().
add
(
seconds
=
renewable
).
format
(
DATE
)
message_exit
(
"
Certification renewable
from
"
+
renewable_date
)
# Check if the certification is already in the pending certifications
for
pending_cert
in
req
[
"
pendingCerts
"
]:
...
...
@@ -127,9 +128,8 @@ async def certification_confirmation(
idty_timestamp
=
idty_to_certify
[
"
meta
"
][
"
timestamp
"
]
block_uid_idty
=
block_uid
(
idty_timestamp
)
block
=
await
client
(
bma
.
blockchain
.
block
,
block_uid_idty
.
number
)
block_uid_date
=
(
"
: #
"
+
idty_timestamp
[:
15
]
+
"
…
"
+
tui
.
convert_time
(
block
[
"
time
"
],
"
all
"
)
)
timestamp_date
=
from_timestamp
(
block
[
"
time
"
],
tz
=
"
local
"
).
format
(
ALL
)
block_uid_date
=
f
"
: #
{
idty_timestamp
[
:
15
]
}
…
{
timestamp_date
}
"
cert
.
append
([
"
ID
"
,
issuer
[
"
uid
"
],
"
–>
"
,
idty_to_certify
[
"
uid
"
]
+
block_uid_date
])
cert
.
append
(
[
...
...
@@ -140,8 +140,8 @@ async def certification_confirmation(
]
)
params
=
await
BlockchainParams
().
params
cert_begins
=
tui
.
convert_time
(
time
(),
"
date
"
)
cert_ends
=
tui
.
convert_time
(
time
()
+
params
[
"
sigValidity
"
]
,
"
date
"
)
cert_begins
=
now
().
format
(
DATE
)
cert_ends
=
now
().
add
(
seconds
=
params
[
"
sigValidity
"
]
).
format
(
DATE
)
cert
.
append
([
"
Valid
"
,
cert_begins
,
"
—>
"
,
cert_ends
])
click
.
echo
(
tabulate
(
cert
,
tablefmt
=
"
fancy_grid
"
))
if
not
ctx
.
obj
[
"
DISPLAY_DOCUMENT
"
]:
...
...
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