Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
703678a0
Commit
703678a0
authored
3 years ago
by
Éloïs
Browse files
Options
Downloads
Patches
Plain Diff
feat(key): gen-session-keys: print ss58 format
parent
66d12909
No related branches found
No related tags found
1 merge request
!28
Smiths sub-wot
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
node/src/cli/key.rs
+13
-4
13 additions, 4 deletions
node/src/cli/key.rs
with
13 additions
and
4 deletions
node/src/cli/key.rs
+
13
−
4
View file @
703678a0
...
...
@@ -19,7 +19,7 @@ use sc_cli::{
};
use
sc_keystore
::
LocalKeystore
;
use
sc_service
::
config
::{
BasePath
,
KeystoreConfig
};
use
sp_core
::
crypto
::{
KeyTypeId
,
SecretString
};
use
sp_core
::
crypto
::{
AccountId32
,
KeyTypeId
,
SecretString
};
use
sp_keystore
::{
SyncCryptoStore
,
SyncCryptoStorePtr
};
use
std
::
sync
::
Arc
;
use
structopt
::
StructOpt
;
...
...
@@ -80,7 +80,7 @@ impl GenSessionKeysCmd {
let
chain_spec
=
cli
.load_spec
(
&
chain_id
)
?
;
let
config_dir
=
base_path
.config_dir
(
chain_spec
.id
());
let
mut
public_keys
=
Vec
::
with_capacity
(
128
);
let
mut
public_keys
_bytes
=
Vec
::
with_capacity
(
128
);
for
(
key_type_id
,
crypto_scheme
)
in
KEY_TYPES
{
let
(
keystore
,
public
)
=
match
self
.keystore_params
.keystore_config
(
&
config_dir
)
?
{
(
_
,
KeystoreConfig
::
Path
{
path
,
password
})
=>
{
...
...
@@ -96,11 +96,20 @@ impl GenSessionKeysCmd {
SyncCryptoStore
::
insert_unknown
(
&*
keystore
,
key_type_id
,
&
suri
,
&
public
[
..
])
.map_err
(|
_
|
Error
::
KeyStoreOperation
)
?
;
public_keys
.extend_from_slice
(
&
public
[
..
]);
public_keys
_bytes
.extend_from_slice
(
&
public
[
..
]);
}
println!
(
"Session Keys: 0x{}"
,
hex
::
encode
(
public_keys
));
let
mut
buffer
=
[
0
;
32
];
buffer
.copy_from_slice
(
&
public_keys_bytes
[
..
32
]);
println!
(
"grandpa: {}"
,
AccountId32
::
new
(
buffer
));
buffer
.copy_from_slice
(
&
public_keys_bytes
[
32
..
64
]);
println!
(
"babe: {}"
,
AccountId32
::
new
(
buffer
));
buffer
.copy_from_slice
(
&
public_keys_bytes
[
64
..
96
]);
println!
(
"im_online: {}"
,
AccountId32
::
new
(
buffer
));
buffer
.copy_from_slice
(
&
public_keys_bytes
[
96
..
]);
println!
(
"authority_discovery: {}"
,
AccountId32
::
new
(
buffer
));
println!
(
"Session Keys: 0x{}"
,
hex
::
encode
(
public_keys_bytes
));
Ok
(())
}
}
...
...
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