nucypher

Subpackages

Submodules

class MessageKit(capsule: umbral.capsule.Capsule, ciphertext: bytes, sender_verifying_key: umbral.keys.PublicKey, signature: Optional[umbral.signing.Signature] = None)

Bases: nucypher.utilities.versioning.Versioned

All the components needed to transmit and verify an encrypted message.

classmethod author(recipient_key: umbral.keys.PublicKey, plaintext: bytes, signer: umbral.signing.Signer, sign_plaintext: bool = True)nucypher.core.MessageKit
decrypt(sk: umbral.keys.SecretKey)bytes
decrypt_reencrypted(sk: umbral.keys.SecretKey, policy_key: umbral.keys.PublicKey, cfrags: Sequence[umbral.capsule_frag.VerifiedCapsuleFrag])bytes
class HRAC(hrac_bytes: bytes)

Bases: object

“hashed resource access code”.

A hash of: * Publisher’s verifying key * Bob’s verifying key * the label

Publisher and Bob have all the information they need to construct this. Ursula does not, so we share it with her.

This way, Bob can generate it and use it to find the TreasureMap.

SIZE = 16
classmethod derive(publisher_verifying_key: umbral.keys.PublicKey, bob_verifying_key: umbral.keys.PublicKey, label: bytes)nucypher.core.HRAC
classmethod from_bytes(data: bytes)nucypher.core.HRAC
exception UnauthorizedKeyFragError

Bases: Exception

class AuthorizedKeyFrag(hrac: nucypher.core.HRAC, kfrag_checksum: bytes, writ_signature: umbral.signing.Signature, kfrag: umbral.key_frag.KeyFrag)

Bases: nucypher.utilities.versioning.Versioned

classmethod construct_by_publisher(hrac: nucypher.core.HRAC, verified_kfrag: umbral.key_frag.VerifiedKeyFrag, signer: umbral.signing.Signer)nucypher.core.AuthorizedKeyFrag
verify(hrac: nucypher.core.HRAC, author_verifying_key: umbral.keys.PublicKey, publisher_verifying_key: umbral.keys.PublicKey) → umbral.key_frag.VerifiedKeyFrag
class TreasureMap(threshold: int, hrac: nucypher.core.HRAC, policy_encrypting_key: umbral.keys.PublicKey, destinations: Dict[NewType.<locals>.new_type, nucypher.core.MessageKit])

Bases: nucypher.utilities.versioning.Versioned

classmethod construct_by_publisher(hrac: nucypher.core.HRAC, policy_encrypting_key: umbral.keys.PublicKey, signer: umbral.signing.Signer, assigned_kfrags: Mapping[NewType.<locals>.new_type, Tuple[umbral.keys.PublicKey, umbral.key_frag.VerifiedKeyFrag]], threshold: int)nucypher.core.TreasureMap

Create a new treasure map for a collection of ursulas and kfrags.

encrypt(signer: umbral.signing.Signer, recipient_key: umbral.keys.PublicKey)nucypher.core.EncryptedTreasureMap
class EncryptedTreasureMap(hrac: nucypher.core.HRAC, public_signature: umbral.signing.Signature, encrypted_tmap: nucypher.core.MessageKit)

Bases: nucypher.utilities.versioning.Versioned

classmethod construct_by_publisher(recipient_key: umbral.keys.PublicKey, treasure_map: nucypher.core.TreasureMap, signer: umbral.signing.Signer)nucypher.core.EncryptedTreasureMap
decrypt(sk: umbral.keys.SecretKey, publisher_verifying_key: umbral.keys.PublicKey)nucypher.core.TreasureMap

Decrypt the treasure map and ensure it is signed by the publisher.

class ReencryptionRequest(hrac: nucypher.core.HRAC, alice_verifying_key: umbral.keys.PublicKey, bob_verifying_key: umbral.keys.PublicKey, encrypted_kfrag: nucypher.core.MessageKit, capsules: List[umbral.capsule.Capsule])

Bases: nucypher.utilities.versioning.Versioned

A request for an Ursula to reencrypt for several capsules.

classmethod from_treasure_map(ursula_address: NewType.<locals>.new_type, capsules: Sequence[umbral.capsule.Capsule], treasure_map: nucypher.core.TreasureMap, alice_verifying_key: umbral.keys.PublicKey, bob_verifying_key: umbral.keys.PublicKey)nucypher.core.ReencryptionRequest
class ReencryptionResponse(cfrags: List[umbral.capsule_frag.CapsuleFrag], signature: umbral.signing.Signature)

Bases: nucypher.utilities.versioning.Versioned

A response from Ursula with reencrypted capsule frags.

classmethod construct_by_ursula(capsules: List[umbral.capsule.Capsule], cfrags: List[umbral.capsule_frag.VerifiedCapsuleFrag], signer: umbral.signing.Signer)nucypher.core.ReencryptionResponse
class RetrievalKit(capsule: umbral.capsule.Capsule, queried_addresses: Iterable[NewType.<locals>.new_type])

Bases: nucypher.utilities.versioning.Versioned

An object encapsulating the information necessary for retrieval of cfrags from Ursulas. Contains the capsule and the checksum addresses of Ursulas from which the requester already received cfrags.

classmethod from_message_kit(message_kit: nucypher.core.MessageKit)nucypher.core.RetrievalKit
class Arrangement(publisher_verifying_key: umbral.keys.PublicKey, expiration_epoch: int)

Bases: nucypher.utilities.versioning.Versioned

A contract between Alice and a single Ursula.

class ArrangementResponse(signature: umbral.signing.Signature)

Bases: nucypher.utilities.versioning.Versioned

Ursula’s response to an Arrangement.

classmethod for_arrangement(arrangement: nucypher.core.Arrangement, signer: umbral.signing.Signer)
class RevocationOrder(ursula_address: NewType.<locals>.new_type, encrypted_kfrag: nucypher.core.MessageKit, signature: umbral.signing.Signature)

Bases: nucypher.utilities.versioning.Versioned

Represents a string used by characters to perform a revocation on a specific Ursula.

classmethod author(ursula_address: NewType.<locals>.new_type, encrypted_kfrag: nucypher.core.MessageKit, signer: umbral.signing.Signer)nucypher.core.RevocationOrder
verify_signature(alice_verifying_key: umbral.keys.PublicKey)bool

Verifies the revocation was from the provided pubkey.

class NodeMetadata(public_address: bytes, domain: str, timestamp_epoch: int, interface_signature: umbral.signing.Signature, decentralized_identity_evidence: bytes, verifying_key: umbral.keys.PublicKey, encrypting_key: umbral.keys.PublicKey, certificate_bytes: bytes, host: str, port: int)

Bases: nucypher.utilities.versioning.Versioned

classmethod batch_from_bytes(data: bytes)
class MetadataRequest(fleet_state_checksum: str, announce_nodes: Optional[Iterable[nucypher.core.NodeMetadata]] = None)

Bases: nucypher.utilities.versioning.Versioned

class MetadataResponse(signature: umbral.signing.Signature, timestamp_epoch: int, this_node: Optional[nucypher.core.NodeMetadata] = None, other_nodes: Optional[List[nucypher.core.NodeMetadata]] = None)

Bases: nucypher.utilities.versioning.Versioned

classmethod author(signer: umbral.signing.Signer, timestamp_epoch: int, this_node: Optional[nucypher.core.NodeMetadata] = None, other_nodes: Optional[Iterable[nucypher.core.NodeMetadata]] = None)
verify(verifying_pk: umbral.keys.PublicKey)
exception DevelopmentInstallationRequired(importable_name: str, *args, **kwargs)

Bases: RuntimeError

MESSAGE = '\n A development installation of nucypher is required to import {importable_name}. \n Please follow the installation instructions published at:\n https://docs.nucypher.com/en/latest/installation.html\n '
class WorklockParameters

Bases: tuple, typing.Generic

token_supply: NuNits = None
start_bid_date: Timestamp = None
end_bid_date: Timestamp = None
end_cancellation_date: Timestamp = None
boosting_refund: int = None
staking_periods: int = None
min_allowed_bid: Wei = None
class StakingEscrowParameters

Bases: tuple, typing.Generic

seconds_per_period: int = None
minting_coefficient: int = None
lock_duration_coefficient_1: int = None
lock_duration_coefficient_2: int = None
maximum_rewarded_periods: int = None
first_phase_total_supply: NuNits = None
first_phase_max_issuance: NuNits = None
min_locked_periods: PeriodDelta = None
min_allowable_locked_tokens: NuNits = None
max_allowable_locked_tokens: NuNits = None
min_worker_periods: PeriodDelta = None
class SubStakeInfo(first_period, last_period, locked_value)

Bases: tuple

property first_period

Alias for field number 0

property last_period

Alias for field number 1

property locked_value

Alias for field number 2

class RawSubStakeInfo(first_period, last_period, unlocking_duration, locked_value)

Bases: tuple

property first_period

Alias for field number 0

property last_period

Alias for field number 1

property unlocking_duration

Alias for field number 2

property locked_value

Alias for field number 3

class Downtime(start_period, end_period)

Bases: tuple

property start_period

Alias for field number 0

property end_period

Alias for field number 1

class StakerFlags(wind_down_flag, restake_flag, measure_work_flag, snapshot_flag, migration_flag)

Bases: tuple

property wind_down_flag

Alias for field number 0

property restake_flag

Alias for field number 1

property measure_work_flag

Alias for field number 2

property snapshot_flag

Alias for field number 3

property migration_flag

Alias for field number 4

class StakerInfo(value, current_committed_period, next_committed_period, last_committed_period, lock_restake_until_period, completed_work, worker_start_period, worker, flags)

Bases: tuple

property value

Alias for field number 0

property current_committed_period

Alias for field number 1

property next_committed_period

Alias for field number 2

property last_committed_period

Alias for field number 3

property lock_restake_until_period

Alias for field number 4

property completed_work

Alias for field number 5

property worker_start_period

Alias for field number 6

property worker

Alias for field number 7

property flags

Alias for field number 8

class PolicyInfo(disabled, sponsor, owner, fee_rate, start_timestamp, end_timestamp)

Bases: tuple

property disabled

Alias for field number 0

property sponsor

Alias for field number 1

property owner

Alias for field number 2

property fee_rate

Alias for field number 3

property start_timestamp

Alias for field number 4

property end_timestamp

Alias for field number 5

class ArrangementInfo(node, downtime_index, last_refunded_period)

Bases: tuple

property node

Alias for field number 0

property downtime_index

Alias for field number 1

property last_refunded_period

Alias for field number 2