-
Notifications
You must be signed in to change notification settings - Fork 288
Rough key-verification implementation #787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -472,6 +472,21 @@ def onConnected(interface): | |||||
| waitForAckNak = True | ||||||
| interface.getNode(args.dest, False, **getNode_kwargs).removeIgnored(args.remove_ignored_node) | ||||||
|
|
||||||
| if args.key_verification: | ||||||
| closeNow = True | ||||||
| waitForAckNak = True | ||||||
| interface.getNode(args.dest, False, **getNode_kwargs).keyVerification(args.key_verification) | ||||||
|
|
||||||
| if args.key_verification_number: | ||||||
| closeNow = True | ||||||
| waitForAckNak = True | ||||||
| interface.getNode(args.dest, False, **getNode_kwargs).keyVerificationNumber(args.key_verification_number, args.key_verification_nonce) | ||||||
|
|
||||||
| if args.key_verification_confirm: | ||||||
| closeNow = True | ||||||
| waitForAckNak = True | ||||||
| interface.getNode(args.dest, False, **getNode_kwargs).keyVerificationConfirm(args.key_verification_confirm) | ||||||
|
|
||||||
| if args.reset_nodedb: | ||||||
| closeNow = True | ||||||
| waitForAckNak = True | ||||||
|
|
@@ -1832,6 +1847,22 @@ def addRemoteAdminArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPars | |||||
| "Use the node ID with a '!' or '0x' prefix or the node number.", | ||||||
| metavar="!xxxxxxxx" | ||||||
| ) | ||||||
| group.add_argument( | ||||||
| "--key-verification", | ||||||
| help="start key verification. " | ||||||
| "Use the node ID with a '!' or '0x' prefix or the node number.", | ||||||
| metavar="!xxxxxxxx" | ||||||
| ) | ||||||
| group.add_argument( | ||||||
| "--key-verification-number", | ||||||
| help="start key verification. " | ||||||
| "Use the node ID with a '!' or '0x' prefix or the node number.", | ||||||
| ) | ||||||
| group.add_argument( | ||||||
| "--key-verification-confirm", | ||||||
| help="start key verification. " | ||||||
|
||||||
| help="start key verification. " | |
| help="confirm key verification. " |
Copilot
AI
Jul 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The help text is incorrect for this argument. It should describe providing a nonce value, not starting key verification.
| help="start key verification. " | |
| help="Provide a nonce value for key verification. " |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -770,6 +770,49 @@ def removeIgnored(self, nodeId: Union[int, str]): | |||||||||||||||||
| onResponse = self.onAckNak | ||||||||||||||||||
| return self._sendAdmin(p, onResponse=onResponse) | ||||||||||||||||||
|
|
||||||||||||||||||
| def keyVerification(self, nodeId: Union[int, str]): | ||||||||||||||||||
| if isinstance(nodeId, str): | ||||||||||||||||||
| if nodeId.startswith("!"): | ||||||||||||||||||
| nodeId = int(nodeId[1:], 16) | ||||||||||||||||||
| else: | ||||||||||||||||||
| nodeId = int(nodeId) | ||||||||||||||||||
| p = admin_pb2.KeyVerificationAdmin() | ||||||||||||||||||
| p.message_type = p.MessageType.INITIATE_VERIFICATION | ||||||||||||||||||
| p.remote_nodenum = nodeId | ||||||||||||||||||
| p.nonce = 0 | ||||||||||||||||||
|
||||||||||||||||||
| p.nonce = 0 | |
| p.nonce = DEFAULT_NONCE |
Copilot
AI
Jul 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the trailing comma after the last parameter in the function definition.
| def keyVerificationNumber(self, number: int, nonce: int,): | |
| def keyVerificationNumber(self, number: int, nonce: int): |
Copilot
AI
Jul 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug print statements should be removed from production code. Consider using proper logging instead.
| print(int(number)) | |
| print(int(nonce)) | |
| logging.debug(f"Key verification number: {int(number)}") | |
| logging.debug(f"Key verification nonce: {int(nonce)}") |
Copilot
AI
Jul 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug print statements should be removed from production code. Consider using proper logging instead.
| print(int(number)) | |
| print(int(nonce)) | |
| logging.debug(f"Security number: {int(number)}") | |
| logging.debug(f"Nonce: {int(nonce)}") |
Copilot
AI
Jul 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the trailing comma after the last parameter in the function definition.
| def keyVerificationConfirm(self, nonce: int,): | |
| def keyVerificationConfirm(self, nonce: int): |
Copilot
AI
Jul 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug print statements should be removed from production code. Consider using proper logging instead.
| print(int(nonce)) | |
| logging.debug(f"Nonce value: {int(nonce)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The help text is incorrect for this argument. It should describe providing a security number, not starting key verification.