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
803172d1
Commit
803172d1
authored
4 years ago
by
matograine
Browse files
Options
Downloads
Patches
Plain Diff
[enh]
#301
: make `authfile` command display <pubkey:checksum> format
parent
d19bd261
No related branches found
No related tags found
2 merge requests
!146
Merge dev into master branch to complete v0.8.0 development cycle
,
!143
#301: Generalize pubkey checksum display and check
Checking pipeline status
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
silkaj/auth.py
+6
-2
6 additions, 2 deletions
silkaj/auth.py
with
6 additions
and
2 deletions
silkaj/auth.py
+
6
−
2
View file @
803172d1
...
@@ -23,9 +23,12 @@ from pathlib import Path
...
@@ -23,9 +23,12 @@ from pathlib import Path
from
duniterpy.key
import
SigningKey
from
duniterpy.key
import
SigningKey
from
duniterpy.key.scrypt_params
import
ScryptParams
from
duniterpy.key.scrypt_params
import
ScryptParams
# had to import display_pubkey_and_checksum from wot to avoid loop dependency.
from
silkaj.wot
import
display_pubkey_and_checksum
from
silkaj.tools
import
message_exit
from
silkaj.tools
import
message_exit
from
silkaj.constants
import
PUBKEY_PATTERN
from
silkaj.constants
import
PUBKEY_PATTERN
SEED_HEX_PATTERN
=
"
^[0-9a-fA-F]{64}$
"
SEED_HEX_PATTERN
=
"
^[0-9a-fA-F]{64}$
"
PUBSEC_PUBKEY_PATTERN
=
"
pub: ({0})
"
.
format
(
PUBKEY_PATTERN
)
PUBSEC_PUBKEY_PATTERN
=
"
pub: ({0})
"
.
format
(
PUBKEY_PATTERN
)
PUBSEC_SIGNKEY_PATTERN
=
"
sec: ([1-9A-HJ-NP-Za-km-z]{87,90})
"
PUBSEC_SIGNKEY_PATTERN
=
"
sec: ([1-9A-HJ-NP-Za-km-z]{87,90})
"
...
@@ -48,12 +51,13 @@ def auth_method(ctx):
...
@@ -48,12 +51,13 @@ def auth_method(ctx):
def
generate_auth_file
(
file
):
def
generate_auth_file
(
file
):
key
=
auth_method
()
key
=
auth_method
()
authfile
=
Path
(
file
)
authfile
=
Path
(
file
)
pubkey_cksum
=
display_pubkey_and_checksum
(
key
.
pubkey
)
if
authfile
.
is_file
():
if
authfile
.
is_file
():
confirm
(
confirm
(
"
Would you like to erase
"
"
Would you like to erase
"
+
file
+
file
+
"
by an authfile corresponding to following pubkey `
"
+
"
by an authfile corresponding to following pubkey `
"
+
key
.
pubkey
+
pubkey
_cksum
+
"
`?
"
,
+
"
`?
"
,
abort
=
True
,
abort
=
True
,
)
)
...
@@ -61,7 +65,7 @@ def generate_auth_file(file):
...
@@ -61,7 +65,7 @@ def generate_auth_file(file):
print
(
print
(
"
Authentication file
'
authfile
'
generated and stored in current
\
"
Authentication file
'
authfile
'
generated and stored in current
\
folder for following public key:
"
,
folder for following public key:
"
,
key
.
pubkey
,
pubkey
_cksum
,
)
)
...
...
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