mirror of https://github.com/nucypher/nucypher.git
Respond to RFCs in PR #2687 Pt. II.
parent
6192c34c3d
commit
4c03c626f7
|
@ -832,14 +832,12 @@ class Bob(Character):
|
|||
delegating_pk=keys['delegating'],
|
||||
receiving_pk=keys['receiving'])
|
||||
except VerificationError:
|
||||
# TODO: WARNING - This block is untested.
|
||||
from nucypher.policy.disputes import IndisputableEvidence
|
||||
evidence = IndisputableEvidence(task=pre_task, work_order=work_order)
|
||||
# TODO: Implement slashing conditions here.
|
||||
# I got a lot of problems with you people ...
|
||||
the_airing_of_grievances.append(work_order.ursula)
|
||||
else:
|
||||
verified_cfrags.append(verified_cfrag) # FIXME: this is unused
|
||||
pre_task.cfrag = verified_cfrag # FIXME: massive yikes, needs to be done properly
|
||||
verified_cfrags.append(verified_cfrag) # FIXME: this is unused/unimplemented
|
||||
pre_task.cfrag = verified_cfrag # FIXME: massive yikes, needs to be done properly
|
||||
|
||||
if the_airing_of_grievances:
|
||||
return False, the_airing_of_grievances
|
||||
|
@ -847,15 +845,15 @@ class Bob(Character):
|
|||
return True, verified_cfrags
|
||||
|
||||
def _assemble_work_orders(self,
|
||||
*message_kits,
|
||||
enrico,
|
||||
policy_encrypting_key,
|
||||
use_attached_cfrags,
|
||||
publisher_verifying_key,
|
||||
alice_verifying_key,
|
||||
treasure_map,
|
||||
label,
|
||||
use_precedent_work_orders
|
||||
*message_kits: List[UmbralMessageKit],
|
||||
enrico: 'Enrico',
|
||||
policy_encrypting_key: PublicKey,
|
||||
use_attached_cfrags: bool,
|
||||
alice_verifying_key: PublicKey,
|
||||
publisher_verifying_key: Optional[PublicKey],
|
||||
treasure_map: Optional[TreasureMap],
|
||||
label: bytes,
|
||||
use_precedent_work_orders: bool
|
||||
):
|
||||
|
||||
# Part I: Assembling the WorkOrders.
|
||||
|
@ -1003,20 +1001,18 @@ class Bob(Character):
|
|||
# Policy
|
||||
*message_kits: UmbralMessageKit,
|
||||
label: bytes,
|
||||
|
||||
# Alice(s)
|
||||
alice_verifying_key: Union[PublicKey, bytes],
|
||||
publisher_verifying_key: Optional[Union[PublicKey, bytes]] = None,
|
||||
policy_encrypting_key: PublicKey = None,
|
||||
treasure_map: Union['TreasureMap', bytes] = None,
|
||||
|
||||
# Source Authentication
|
||||
enrico: "Enrico" = None,
|
||||
policy_encrypting_key: PublicKey = None,
|
||||
alice_verifying_key: Union[PublicKey, bytes],
|
||||
publisher_verifying_key: Optional[Union[PublicKey, bytes]] = None,
|
||||
|
||||
# Retrieval Behaviour
|
||||
retain_cfrags: bool = False,
|
||||
use_attached_cfrags: bool = False,
|
||||
use_precedent_work_orders: bool = False,
|
||||
treasure_map: Union['TreasureMap', bytes] = None
|
||||
|
||||
) -> List[bytes]:
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ from nucypher.blockchain.eth.constants import POLICY_ID_LENGTH
|
|||
from nucypher.crypto.constants import HRAC_LENGTH
|
||||
from nucypher.crypto.kits import RevocationKit
|
||||
from nucypher.crypto.powers import TransactingPower
|
||||
from nucypher.crypto.splitters import key_splitter
|
||||
from nucypher.crypto.utils import keccak_digest
|
||||
from nucypher.crypto.umbral_adapter import PublicKey, KeyFrag, Signature
|
||||
from nucypher.crypto.utils import construct_policy_id
|
||||
|
@ -43,8 +44,10 @@ class Arrangement:
|
|||
A contract between Alice and a single Ursula.
|
||||
"""
|
||||
|
||||
splitter = BytestringSplitter((PublicKey, PublicKey.serialized_size()), # alice_verifying_key
|
||||
(bytes, VariableLengthBytestring)) # expiration
|
||||
splitter = BytestringSplitter(
|
||||
key_splitter, # alice_verifying_key
|
||||
(bytes, VariableLengthBytestring) # expiration
|
||||
)
|
||||
|
||||
def __init__(self, alice_verifying_key: PublicKey, expiration: maya.MayaDT):
|
||||
self.expiration = expiration
|
||||
|
@ -115,7 +118,7 @@ class TreasureMapPublisher:
|
|||
|
||||
# OK, let's check: if any Ursulas claimed we didn't pay,
|
||||
# we need to re-evaluate our situation here.
|
||||
claims_of_freeloading = sum(response.status_code == 402 for response in responses.values())
|
||||
claims_of_freeloading = any(response.status_code == 402 for response in responses.values())
|
||||
if claims_of_freeloading:
|
||||
raise Policy.Unpaid
|
||||
|
||||
|
|
Loading…
Reference in New Issue