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
Update Porter endpoint for retrieval #2768
Conversation
5718754
to
83b4015
Compare
0f3a094
to
9399a98
Compare
d4f42ba
to
01cbd54
Compare
01cbd54
to
7fc8c6c
Compare
3d7ad2e
to
019d74d
Compare
@@ -311,3 +312,6 @@ def from_bytes(cls, data: bytes): | |||
result = cls(hrac, public_signature, message_kit, blockchain_signature=blockchain_signature) | |||
result._public_verify() | |||
return result | |||
|
|||
def __eq__(self, other): |
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.
Just to double-check, any concerns with this i.e. adding an equality function i.e. for EncryptedTreasureMap
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.
No concerns from me.
…instead of bytes. Minor update to Porter docs for retrieval endpoint.
…yption of treasure map for tests.
…ld to CapsuleFrag. Improve retreive_cfrags test to ensure that the cfrags are valid and can successfully be used by Bob to decrypt the data.
…s - it should be an unencrypted treasure map.
…- remove usage from Porter.
…a list of message kits since the respective Python API was modified to accept a list of message kits. Cleaned up Bob's retrieve_and_decrypt CLI code to account for updated required options - there was code that was based on some options not being required Adjusted associated tests.
9eab9c3
to
2434fe0
Compare
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.
Approved with some minor comments.
alice_verifying_key = PublicKey.from_bytes(alice_verifying_key) | ||
message_kit = MessageKit.from_bytes(message_kit) # TODO #846: May raise UnknownOpenSSLError and InvalidTag. | ||
|
||
if isinstance(encrypted_treasure_map, bytes): |
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.
I suppose the thinking here is that deserialization must be handled by the caller?
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 EncryptedTreasureMap field used in the RetrieveAndDecrypt Schema, automatically handles the deserialization - https://github.com/derekpierre/nucypher/blob/porter-retrieval/nucypher/characters/control/specifications/fields/treasuremap.py#L27.
@@ -311,3 +312,6 @@ def from_bytes(cls, data: bytes): | |||
result = cls(hrac, public_signature, message_kit, blockchain_signature=blockchain_signature) | |||
result._public_verify() | |||
return result | |||
|
|||
def __eq__(self, other): |
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.
No concerns from me.
@@ -39,12 +40,19 @@ def __init__(self, implementer=None, *args, **kwargs): | |||
super().__init__(*args, **kwargs) | |||
|
|||
@classmethod | |||
def connect_cli(cls, action): | |||
def connect_cli(cls, action, exclude: Optional[Set[str]] = None): |
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.
Where is this kwarg being called? The idea here is to provide an alternative method for CLI option exclusion?
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 general idea is that the schema can still be used for populating CLI options, but allow for some CLI options to be modified.
More specifically, it is used here - https://github.com/derekpierre/nucypher/blob/porter-retrieval/nucypher/cli/commands/bob.py#L347 with the nucypher bob retrieve-and-decrypt
CLI command. In this case, the retrieve-and-decrypt
command from the CLI can be used without requiring an alice_verifying_key
to be specified via --alice-verifying-key
option which is required by the schema. An Alice card can be specified from the CLI via --alice
and the verifying key obtained from the Card API.
In this case --alice-verifying-key
needs to be optional and not required. Either Alice's verifying key is provided directly via --alice-verifying-key
or indirectly via --alice
.
Type of PR:
Required reviews:
What this does:
Changes the Porter endpoint intended for part Bob retrieval process to use the updated retrieval protocol in #2730.
Issues fixed/closed:
Based over #2730 .
Related to #2714 , #2751 .
Questions for Reviewers:
__eq__
:^ If keeping the status quo, then I'll need to add documentation about the expected byte structure of the retrieval kit