mirror of https://github.com/nucypher/nucypher.git
Accomodate latest changes to `nucypher-core`.
parent
b5aa20e602
commit
d989445ffc
|
@ -575,7 +575,7 @@ class Bob(Character):
|
|||
if context:
|
||||
context = Context(json.dumps(context))
|
||||
decryption_request = ThresholdDecryptionRequest(
|
||||
id=ritual_id,
|
||||
ritual_id=ritual_id,
|
||||
variant=int(variant.value),
|
||||
ciphertext=bytes(ciphertext),
|
||||
conditions=conditions,
|
||||
|
@ -1419,7 +1419,7 @@ class Enrico:
|
|||
ciphertext = self.encrypt_for_dkg(plaintext=plaintext,
|
||||
conditions=conditions)
|
||||
tdr = ThresholdDecryptionRequest(
|
||||
id=ritual_id,
|
||||
ritual_id=ritual_id,
|
||||
ciphertext=bytes(ciphertext),
|
||||
conditions=Conditions(json.dumps(conditions)),
|
||||
context=context,
|
||||
|
|
|
@ -345,11 +345,11 @@ class ThresholdRequestDecryptingPower(DerivedKeyBasedPower):
|
|||
self, encrypted_request: EncryptedThresholdDecryptionRequest
|
||||
) -> Tuple[ThresholdDecryptionRequest, PublicKey]:
|
||||
try:
|
||||
priv_key = self._get_privkey_from_ritual_id(encrypted_request.id)
|
||||
e2ee_request = encrypted_request.decrypt(sk=priv_key)
|
||||
priv_key = self._get_privkey_from_ritual_id(encrypted_request.ritual_id)
|
||||
e2e_request = encrypted_request.decrypt(sk=priv_key)
|
||||
return (
|
||||
e2ee_request.decryption_request,
|
||||
e2ee_request.response_encrypting_key,
|
||||
e2e_request.decryption_request,
|
||||
e2e_request.response_encrypting_key,
|
||||
)
|
||||
except Exception as e:
|
||||
raise self.ThresholdRequestDecryptionFailed from e
|
||||
|
|
|
@ -156,7 +156,9 @@ def _make_rest_app(this_node, log: Logger) -> Flask:
|
|||
encrypted_request=encrypted_decryption_request
|
||||
)
|
||||
|
||||
log.info(f"Threshold decryption request for ritual ID #{decryption_request.id}")
|
||||
log.info(
|
||||
f"Threshold decryption request for ritual ID #{decryption_request.ritual_id}"
|
||||
)
|
||||
|
||||
# Deserialize and instantiate ConditionLingo from the request data
|
||||
conditions_data = str(decryption_request.conditions) # nucypher_core.Conditions -> str
|
||||
|
@ -178,17 +180,22 @@ def _make_rest_app(this_node, log: Logger) -> Flask:
|
|||
|
||||
# TODO: #3052 consider using the DKGStorage cache instead of the coordinator agent
|
||||
# dkg_public_key = this_node.dkg_storage.get_public_key(decryption_request.ritual_id)
|
||||
ritual = this_node.coordinator_agent.get_ritual(decryption_request.id, with_participants=True)
|
||||
ritual = this_node.coordinator_agent.get_ritual(
|
||||
decryption_request.ritual_id, with_participants=True
|
||||
)
|
||||
participants = [p.provider for p in ritual.participants]
|
||||
|
||||
# enforces that the node is part of the ritual
|
||||
if this_node.checksum_address not in participants:
|
||||
return Response(f'Node not part of ritual {decryption_request.id}', status=HTTPStatus.FORBIDDEN)
|
||||
return Response(
|
||||
f"Node not part of ritual {decryption_request.ritual_id}",
|
||||
status=HTTPStatus.FORBIDDEN,
|
||||
)
|
||||
|
||||
# derive the decryption share
|
||||
ciphertext = Ciphertext.from_bytes(decryption_request.ciphertext)
|
||||
decryption_share = this_node.derive_decryption_share(
|
||||
ritual_id=decryption_request.id,
|
||||
ritual_id=decryption_request.ritual_id,
|
||||
ciphertext=ciphertext,
|
||||
conditions=decryption_request.conditions,
|
||||
variant=FerveoVariant(decryption_request.variant),
|
||||
|
|
|
@ -56,7 +56,7 @@ msgpack==1.0.5
|
|||
msgpack-python==0.5.6
|
||||
multidict==5.2.0 ; python_version >= '3.6'
|
||||
mypy-extensions==0.4.4 ; python_version >= '2.7'
|
||||
nucypher-core @ git+https://github.com/derekpierre/nucypher-core.git@124a8a2bb21c21990ca843d8e0bf22b497d12cb9#subdirectory=nucypher-core-python
|
||||
nucypher-core @ git+https://github.com/derekpierre/nucypher-core.git@9cb792197dbb20d4997448fc37b116f9f1fb686c#subdirectory=nucypher-core-python
|
||||
packaging==23.1 ; python_version >= '3.7'
|
||||
parsimonious==0.9.0
|
||||
pendulum==3.0.0a1 ; python_version >= '3.7' and python_version < '4.0'
|
||||
|
|
|
@ -169,7 +169,7 @@ def test_ritualist(temp_dir_path, testerchain, dkg_public_key):
|
|||
enrico = Enrico(encrypting_key=dkg_public_key)
|
||||
ciphertext = enrico.encrypt_for_dkg(plaintext=plaintext, conditions=CONDITIONS)
|
||||
decryption_request = ThresholdDecryptionRequest(
|
||||
id=ritual_id,
|
||||
ritual_id=ritual_id,
|
||||
variant=0,
|
||||
ciphertext=bytes(ciphertext),
|
||||
conditions=Conditions(json.dumps(CONDITIONS)),
|
||||
|
|
Loading…
Reference in New Issue