Kagome
Polkadot Runtime Engine in C++17
|
#include <crypto_store_impl.hpp>
Public Member Functions | |
CryptoStoreImpl (std::shared_ptr< EcdsaSuite > ecdsa_suite, std::shared_ptr< Ed25519Suite > ed_suite, std::shared_ptr< Sr25519Suite > sr_suite, std::shared_ptr< Bip39Provider > bip39_provider, std::shared_ptr< KeyFileStorage > key_fs) | |
outcome::result< EcdsaKeypair > | generateEcdsaKeypair (KeyTypeId key_type, std::string_view mnemonic_phrase) override |
generates ecdsa keypair and stores it in memory More... | |
outcome::result< Ed25519Keypair > | generateEd25519Keypair (KeyTypeId key_type, std::string_view mnemonic_phrase) override |
generates Ed25519 keypair and stores it in memory More... | |
outcome::result< Sr25519Keypair > | generateSr25519Keypair (KeyTypeId key_type, std::string_view mnemonic_phrase) override |
generates SR25519 keypair and stores it in memory More... | |
outcome::result< EcdsaKeypair > | generateEcdsaKeypair (KeyTypeId key_type, const EcdsaSeed &seed) override |
generates ecdsa keypair and stores it in memory More... | |
outcome::result< Ed25519Keypair > | generateEd25519Keypair (KeyTypeId key_type, const Ed25519Seed &seed) override |
generates Ed25519 keypair and stores it in memory More... | |
outcome::result< Sr25519Keypair > | generateSr25519Keypair (KeyTypeId key_type, const Sr25519Seed &seed) override |
generates SR25519 keypair and stores it in memory More... | |
outcome::result< EcdsaKeypair > | generateEcdsaKeypairOnDisk (KeyTypeId key_type) override |
generates ecdsa keypair and stores it on disk More... | |
outcome::result< Ed25519Keypair > | generateEd25519KeypairOnDisk (KeyTypeId key_type) override |
generates Ed25519 keypair and stores it on disk More... | |
outcome::result< Sr25519Keypair > | generateSr25519KeypairOnDisk (KeyTypeId key_type) override |
generates SR25519 keypair and stores it on disk More... | |
outcome::result< EcdsaKeypair > | findEcdsaKeypair (KeyTypeId key_type, const EcdsaPublicKey &pk) const override |
searches for key pair More... | |
outcome::result< Ed25519Keypair > | findEd25519Keypair (KeyTypeId key_type, const Ed25519PublicKey &pk) const override |
searches for key pair More... | |
outcome::result< Sr25519Keypair > | findSr25519Keypair (KeyTypeId key_type, const Sr25519PublicKey &pk) const override |
searches for key pair More... | |
outcome::result< EcdsaKeys > | getEcdsaPublicKeys (KeyTypeId key_type) const override |
searches for ecdsa keys of specified type More... | |
outcome::result< Ed25519Keys > | getEd25519PublicKeys (KeyTypeId key_type) const override |
searches for Ed25519 keys of specified type More... | |
outcome::result< Sr25519Keys > | getSr25519PublicKeys (KeyTypeId key_type) const override |
searches for SR25519 keys of specified type More... | |
std::optional< libp2p::crypto::KeyPair > | getLibp2pKeypair () const override |
outcome::result< libp2p::crypto::KeyPair > | loadLibp2pKeypair (const Path &key_path) const override |
Public Member Functions inherited from kagome::crypto::CryptoStore | |
virtual | ~CryptoStore ()=default |
Private Member Functions | |
template<typename CryptoSuite > | |
outcome::result< std::vector< typename CryptoSuite::PublicKey > > | getPublicKeys (KeyTypeId key_type, const KeyCache< CryptoSuite > &cache, const CryptoSuite &suite) const |
template<typename CryptoSuite > | |
outcome::result< typename CryptoSuite::Keypair > | generateKeypair (std::string_view mnemonic_phrase, const CryptoSuite &suite) |
template<typename CryptoSuite > | |
outcome::result< typename CryptoSuite::Keypair > | generateKeypairOnDisk (KeyTypeId key_type, const std::shared_ptr< CryptoSuite > &suite, std::unordered_map< KeyTypeId, KeyCache< CryptoSuite >> &caches) |
template<typename Suite > | |
KeyCache< Suite > & | getCache (std::shared_ptr< Suite > suite, std::unordered_map< KeyTypeId, KeyCache< Suite >> &caches, KeyTypeId type) const |
Private Attributes | |
std::unordered_map< KeyTypeId, KeyCache< EcdsaSuite > > | ecdsa_caches_ |
std::unordered_map< KeyTypeId, KeyCache< Ed25519Suite > > | ed_caches_ |
std::unordered_map< KeyTypeId, KeyCache< Sr25519Suite > > | sr_caches_ |
std::shared_ptr< KeyFileStorage > | file_storage_ |
std::shared_ptr< EcdsaSuite > | ecdsa_suite_ |
std::shared_ptr< Ed25519Suite > | ed_suite_ |
std::shared_ptr< Sr25519Suite > | sr_suite_ |
std::shared_ptr< Bip39Provider > | bip39_provider_ |
log::Logger | logger_ |
Additional Inherited Members | |
Public Types inherited from kagome::crypto::CryptoStore | |
using | Path = boost::filesystem::path |
using | EcdsaKeys = std::vector< EcdsaPublicKey > |
using | Ed25519Keys = std::vector< Ed25519PublicKey > |
using | Sr25519Keys = std::vector< Sr25519PublicKey > |
using | EcdsaKeypairs = std::vector< EcdsaKeypair > |
using | Ed25519Keypairs = std::vector< Ed25519Keypair > |
using | Sr25519Keypairs = std::vector< Sr25519Keypair > |
TODO(Harrm) Add policies to emit a warning when found a keypair with incompatible type and algorithm (e. g. ed25519 BABE keypair, whereas BABE has to be sr25519 only) or when trying to generate more keypair than there should be (e. g. more than one libp2p keypair is a suspicious behaviour)
Definition at line 44 of file crypto_store_impl.hpp.
kagome::crypto::CryptoStoreImpl::CryptoStoreImpl | ( | std::shared_ptr< EcdsaSuite > | ecdsa_suite, |
std::shared_ptr< Ed25519Suite > | ed_suite, | ||
std::shared_ptr< Sr25519Suite > | sr_suite, | ||
std::shared_ptr< Bip39Provider > | bip39_provider, | ||
std::shared_ptr< KeyFileStorage > | key_fs | ||
) |
Definition at line 39 of file crypto_store_impl.cpp.
|
overridevirtual |
searches for key pair
key_type | key category |
pk | public key to look for |
Implements kagome::crypto::CryptoStore.
Definition at line 121 of file crypto_store_impl.cpp.
|
overridevirtual |
searches for key pair
key_type | key category |
pk | public key to look for |
Implements kagome::crypto::CryptoStore.
Definition at line 142 of file crypto_store_impl.cpp.
|
overridevirtual |
searches for key pair
key_type | key category |
pk | public key to look for |
Implements kagome::crypto::CryptoStore.
Definition at line 157 of file crypto_store_impl.cpp.
|
overridevirtual |
generates ecdsa keypair and stores it in memory
key_type | key type identifier |
mnemonic_phrase | mnemonic phrase |
Implements kagome::crypto::CryptoStore.
Definition at line 58 of file crypto_store_impl.cpp.
|
overridevirtual |
generates ecdsa keypair and stores it in memory
key_type | key type identifier |
seed | seed for generating keys |
Implements kagome::crypto::CryptoStore.
Definition at line 82 of file crypto_store_impl.cpp.
|
overridevirtual |
generates ecdsa keypair and stores it on disk
key_type | key type identifier |
Implements kagome::crypto::CryptoStore.
Definition at line 106 of file crypto_store_impl.cpp.
|
overridevirtual |
generates Ed25519 keypair and stores it in memory
key_type | key type identifier |
mnemonic_phrase | mnemonic phrase |
Implements kagome::crypto::CryptoStore.
Definition at line 66 of file crypto_store_impl.cpp.
|
overridevirtual |
generates Ed25519 keypair and stores it in memory
key_type | key type identifier |
seed | seed for generating keys |
Implements kagome::crypto::CryptoStore.
Definition at line 90 of file crypto_store_impl.cpp.
|
overridevirtual |
generates Ed25519 keypair and stores it on disk
key_type | key type identifier |
Implements kagome::crypto::CryptoStore.
Definition at line 111 of file crypto_store_impl.cpp.
|
inlineprivate |
Definition at line 155 of file crypto_store_impl.hpp.
|
inlineprivate |
Definition at line 171 of file crypto_store_impl.hpp.
|
overridevirtual |
generates SR25519 keypair and stores it in memory
key_type | key type identifier |
mnemonic_phrase | mnemonic phrase |
Implements kagome::crypto::CryptoStore.
Definition at line 74 of file crypto_store_impl.cpp.
|
overridevirtual |
generates SR25519 keypair and stores it in memory
key_type | key type identifier |
seed | seed for generating keys |
Implements kagome::crypto::CryptoStore.
Definition at line 98 of file crypto_store_impl.cpp.
|
overridevirtual |
generates SR25519 keypair and stores it on disk
key_type | key type identifier |
Implements kagome::crypto::CryptoStore.
Definition at line 116 of file crypto_store_impl.cpp.
|
inlineprivate |
Definition at line 182 of file crypto_store_impl.hpp.
|
overridevirtual |
searches for ecdsa keys of specified type
key_type | key type identifier to look for |
Implements kagome::crypto::CryptoStore.
Definition at line 173 of file crypto_store_impl.cpp.
|
overridevirtual |
searches for Ed25519 keys of specified type
key_type | key type identifier to look for |
Implements kagome::crypto::CryptoStore.
Definition at line 180 of file crypto_store_impl.cpp.
|
overridevirtual |
Implements kagome::crypto::CryptoStore.
Definition at line 191 of file crypto_store_impl.cpp.
|
inlineprivate |
Definition at line 104 of file crypto_store_impl.hpp.
|
overridevirtual |
searches for SR25519 keys of specified type
key_type | key type identifier to look for |
Implements kagome::crypto::CryptoStore.
Definition at line 186 of file crypto_store_impl.cpp.
|
overridevirtual |
Acquires the key from user-provided path or generates and saves the key under the path. Used when –node-key-file flag gets processed.
path | - path the key file (raw bytes or hex-encoded) |
Implements kagome::crypto::CryptoStore.
Definition at line 204 of file crypto_store_impl.cpp.
|
private |
Definition at line 202 of file crypto_store_impl.hpp.
|
mutableprivate |
Definition at line 195 of file crypto_store_impl.hpp.
|
private |
Definition at line 199 of file crypto_store_impl.hpp.
|
mutableprivate |
Definition at line 196 of file crypto_store_impl.hpp.
|
private |
Definition at line 200 of file crypto_store_impl.hpp.
|
private |
Definition at line 198 of file crypto_store_impl.hpp.
|
private |
Definition at line 203 of file crypto_store_impl.hpp.
|
mutableprivate |
Definition at line 197 of file crypto_store_impl.hpp.
|
private |
Definition at line 201 of file crypto_store_impl.hpp.