#include <key_file_storage.hpp>
Class for operations over key storage in file system
Definition at line 23 of file key_file_storage.hpp.
Enumerator |
---|
WRONG_KEYFILE_NAME |
|
NOT_REGULAR_FILE |
|
FAILED_OPEN_FILE |
|
FILE_DOESNT_EXIST |
|
INVALID_FILE_FORMAT |
|
INCONSISTENT_KEYFILE |
|
KEYS_PATH_IS_NOT_DIRECTORY |
|
FAILED_CREATE_KEYS_DIRECTORY |
|
Definition at line 25 of file key_file_storage.hpp.
kagome::crypto::KeyFileStorage::KeyFileStorage |
( |
Path |
keystore_path | ) |
|
|
explicitprivate |
outcome::result< std::vector< Buffer > > kagome::crypto::KeyFileStorage::collectPublicKeys |
( |
KeyTypeId |
type | ) |
const |
Collects all public keys of the given type from the key storage
Definition at line 154 of file key_file_storage.cpp.
outcome::result< std::unique_ptr< KeyFileStorage > > kagome::crypto::KeyFileStorage::createAt |
( |
Path |
keystore_path | ) |
|
|
static |
Initializes key storage at the given
- Parameters
-
keystore_path. | Creates its dir if it doesn't exist, but won't create missing parent dirs |
TODO(Harrm): add enforcement of key file permissions (like in SSH)
Definition at line 38 of file key_file_storage.cpp.
outcome::result< void > kagome::crypto::KeyFileStorage::initialize |
( |
| ) |
|
|
private |
outcome::result< std::string > kagome::crypto::KeyFileStorage::loadFileContent |
( |
const Path & |
file_path | ) |
const |
Load key file contents without validation. The file may not exist. Used when –node-key-file flag is specified.
- Parameters
-
file_path | - path to the key. The contents are raw-bytes or hex-encoded key |
- Returns
- file contents. Format interpreting is up to the caller
Definition at line 121 of file key_file_storage.cpp.
outcome::result< std::pair< KeyTypeId, Buffer > > kagome::crypto::KeyFileStorage::parseKeyFileName |
( |
std::string_view |
file_name | ) |
const |
|
private |
outcome::result< void > kagome::crypto::KeyFileStorage::saveKeyHexAtPath |
( |
gsl::span< const uint8_t > |
private_key, |
|
|
const Path & |
path |
|
) |
| const |
Save key as hex to the specific path. Used when –node-key-file flag is specified.
- Parameters
-
key_bytes | - key contents to save |
file_path | - user-provided path to create the file |
- Returns
- an error if any
Definition at line 140 of file key_file_storage.cpp.
outcome::result< void > kagome::crypto::KeyFileStorage::saveKeyPair |
( |
KeyTypeId |
type, |
|
|
gsl::span< const uint8_t > |
public_key, |
|
|
gsl::span< const uint8_t > |
seed |
|
) |
| const |
Stores the
- Parameters
-
seed | that generates the |
public_key | to the key storage |
Definition at line 78 of file key_file_storage.cpp.
outcome::result< std::optional< Buffer > > kagome::crypto::KeyFileStorage::searchForSeed |
( |
KeyTypeId |
type, |
|
|
gsl::span< const uint8_t > |
public_key_bytes |
|
) |
| const |
Searches for a key file for the corresponding type and public key and returns its content if it's a valid hex number
Definition at line 184 of file key_file_storage.cpp.
Path kagome::crypto::KeyFileStorage::keystore_path_ |
|
private |
The documentation for this class was generated from the following files: