-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tools/shoestring] fix: allow the user to retain their node key
problem: migrating from symbol-bootstrap creates a new node key solution: allow the node to retain its node key during bootstrap import and cert renewal.
- Loading branch information
Showing
19 changed files
with
289 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import shutil | ||
from pathlib import Path | ||
|
||
|
||
class NodeKeyProvider: | ||
"""Generators the Node private key.""" | ||
|
||
def __init__(self, import_source=None): | ||
"""Creates a Node key generator.""" | ||
|
||
self.is_imported = bool(import_source) | ||
if self.is_imported: | ||
self.import_source = Path(import_source).absolute() | ||
|
||
def create_key_file(self, factory): | ||
"""Create node private key file.""" | ||
|
||
if self.is_imported: | ||
shutil.copy(self.import_source, '.') | ||
return | ||
|
||
if not factory: | ||
raise RuntimeError('unable to generate node private key') | ||
|
||
factory.generate_random_node_private_key() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.