Apply API and interface updates to for enrico file handling.

pull/2098/head
Kieran Prasch 2020-06-17 11:30:06 -07:00 committed by Kieran R. Prasch
parent 1409bb2a61
commit 5909c37dd1
8 changed files with 12 additions and 14 deletions

View File

@ -29,7 +29,7 @@ The NuCypher network does not store or handle an application's data; instead - i
Management of encrypted secrets and public keys tends to be highly domain-specific - The surrounding architecture
will vary greatly depending on the throughput, sensitivity, and sharing cadence of application secrets.
In all cases, NuCypher must be integrated with a storage and transport layer in order to function properly.
Along with the transport of ciphertexts, a nucypher application also needs to include channels for Alice and Bob
Along with the transport of ciphertexts, a nucypher application also needs to include channels for Alice and Bob
to discover each other's public keys, and provide policy encrypting information to Bob and Enrico.
Side Channel Application Data
@ -93,7 +93,7 @@ Connecting Nucypher to an Ethereum Provider
Ursula: Untrusted Re-Encryption Proxies
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When initializing an ``Alice``\ , ``Bob``\ , or ``Ursula``\ , an initial "Stranger-\ ``Ursula``\ " is needed to perform
When initializing an ``Alice``\ , ``Bob``\ , or ``Ursula``\ , an initial "Stranger-\ ``Ursula``\ " is needed to perform
the role of a ``Teacher``\ , or "seednode":
.. code-block:: python
@ -151,7 +151,7 @@ Create a NuCypher Keyring
alice.start_learning_loop(now=True)
Alice needs to know about Bob in order to grant access by acquiring Bob's public key's through
Alice needs to know about Bob in order to grant access by acquiring Bob's public key's through
the application side channel:
.. code-block:: python
@ -201,7 +201,7 @@ Encrypt
from nucypher.characters.lawful import Enrico
enrico = Enrico(policy_encrypting_key=policy_encrypting_key)
ciphertext, signature = enrico.encrypt_message(message=b'Peace at dawn.')
ciphertext, signature = enrico.encrypt_message(plaintext=b'Peace at dawn.')
The ciphertext can then be sent to Bob via the application side channel.

View File

@ -55,7 +55,7 @@ def mario_box_cli(plaintext_dir, alice_config, label, outfile):
encoded_plaintext = base64.b64encode(plaintext)
enrico = Enrico(policy_encrypting_key=policy_encrypting_key)
message_kit, _signature = enrico.encrypt_message(message=encoded_plaintext)
message_kit, _signature = enrico.encrypt_message(plaintext=encoded_plaintext)
base64_message_kit = base64.b64encode(bytes(message_kit)).decode()
# Collect Bob Retrieve JSON Requests

View File

@ -28,7 +28,7 @@ class EncryptMessage(BaseSchema):
# input
message = fields.Cleartext(
load_only=False,
load_only=True,
allow_none=True,
click=click.option('--message', help="A unicode message to encrypt for a policy")
)

View File

@ -39,11 +39,9 @@ def get_fields(interface, method_name):
def validate_json_rpc_response_data(response, method_name, interface):
required_output_fileds = get_fields(interface, method_name)[-1]
required_output_fields = get_fields(interface, method_name)[-1]
assert 'jsonrpc' in response.data
for output_field in required_output_fileds:
for output_field in required_output_fields:
assert output_field in response.content
return True

View File

@ -248,7 +248,7 @@ def test_enrico_web_character_control_encrypt_message(enrico_web_controller_test
response = enrico_web_controller_test_client.post('/encrypt_message', data=json.dumps({'bad': 'input'}))
assert response.status_code == 400
del (params['plaintext'])
del (params['message'])
response = enrico_web_controller_test_client.post('/encrypt_message', data=params)
assert response.status_code == 400

View File

@ -571,7 +571,7 @@ def test_collect_rewards_integration(click_runner,
# Encrypt
random_data = os.urandom(random.randrange(20, 100))
message_kit, signature = enrico.encrypt_message(message=random_data)
message_kit, signature = enrico.encrypt_message(plaintext=random_data)
# Decrypt
cleartexts = blockchain_bob.retrieve(message_kit,

View File

@ -473,7 +473,7 @@ def test_collect_rewards_integration(click_runner,
# Encrypt
random_data = os.urandom(random.randrange(20, 100))
ciphertext, signature = enrico.encrypt_message(message=random_data)
ciphertext, signature = enrico.encrypt_message(plaintext=random_data)
# Decrypt
cleartexts = blockchain_bob.retrieve(ciphertext,

View File

@ -107,7 +107,7 @@ def test_alice_can_decrypt(federated_alice):
enrico = Enrico(policy_encrypting_key=policy_pubkey)
message = b"boring test message"
message_kit, signature = enrico.encrypt_message(message=message)
message_kit, signature = enrico.encrypt_message(plaintext=message)
# Interesting thing: if Alice wants to decrypt, she needs to provide the label directly.
cleartext = federated_alice.verify_from(stranger=enrico,