cleanup and refactor encrypt.py#42
Conversation
KPrasch
left a comment
There was a problem hiding this comment.
This PR is looking great! It will be beneficial to use click (since it will generate help text for the commands) and also document a usage example of the new CLI.
None of my comments are meant to be blocking, and can be follow-ups. Approved 👍🏻
encrypt.py
Outdated
| definitely_tony = tony.read() | ||
|
|
||
| def encapsulate(secret): | ||
| def encapsulate(secret: bytes, clear_text: bytes) -> bytes: |
There was a problem hiding this comment.
clear_text -> cleartext is conventional.
| from typing import TypedDict | ||
| from nucypher.policy.conditions.lingo import ConditionLingo, Lingo | ||
|
|
||
| class TMK(TypedDict): |
encrypt.py
Outdated
| parser = argparse.ArgumentParser(description="Encrypt file using threshold encryption.") | ||
| parser.add_argument("--file_path", type=str, default="manzana.mp3", help="Path to the file to be encrypted") | ||
| parser.add_argument("--ritual_id", type=int, help="Ritual ID obtained from a side channel", default=15) | ||
| parser.add_argument("--coordinator_provider_uri", type=str, help="URI of the coordinator provider", required=True) | ||
| parser.add_argument("--coordinator_network", type=str, default="mumbai", help="Network for the coordinator", choices=["mumbai", "rinkeby", "mainnet", "goerli", "ropsten", "kovan"]) | ||
| parser.add_argument("--chain", type=int, help="Ethereum chain ID", default=80001) | ||
| parser.add_argument("--eth_address", type=str, help="Ethereum address for balance check", default="0x210eeAC07542F815ebB6FD6689637D8cA2689392") | ||
| parser.add_argument("--output-file", type=str, default="tony.tmk", help="Output file for encrypted data") |
There was a problem hiding this comment.
It's nice to see this tool formalized. With this many options and custom parsing you may want to consider using click instead! https://click.palletsprojects.com/en/8.1.x/
There was a problem hiding this comment.
@KPrasch the code is now udpated with click as cmdline arg parser.
Just wondering - what is it's benefit compared to argparse?
| "chain": chain, | ||
| "method": "eth_getBalance", | ||
| "parameters": [eth_address, "latest"], | ||
| "returnValueTest": {"comparator": ">=", "value": eth_minimum_balance}, |
There was a problem hiding this comment.
I changed the comparator and added an eth_minimim_balance parameter, because in the final incrypt we want to set this to 10 ETH and not 0, right?
|
What was done from the last PR round:
|
|
When #41 gets merged, we should add |
|
May be superseded by #47 |
No description provided.