koi_net.components.secure_manager

Classes

SecureManager(log, identity, cache, config, ...)

Subsystem handling secure protocol logic.

class koi_net.components.secure_manager.SecureManager(log, identity, cache, config, root_dir)[source]

Bases: object

Subsystem handling secure protocol logic.

Parameters:
cache: Cache
config: ConfigProvider | BaseNodeConfig
create_envelope(payload, target)[source]

Returns signed envelope to target from provided payload.

Return type:

SignedEnvelope

Parameters:
create_priv_key()[source]
handle_unknown_node(envelope)[source]

Attempts to find node profile in proided envelope.

If an unknown node sends an envelope, it may still be able to be validated if that envelope contains their node profile. This is essential for allowing unknown nodes to handshake and introduce themselves. Only an EventsPayload contain a NEW event for a node profile for the source node is permissible.

Return type:

Bundle | None

Parameters:

envelope (SignedEnvelope)

identity: NodeIdentity
load_priv_key()[source]

Loads private key from PEM file path in config.

log: Logger
property pem_path: Path
priv_key: PrivateKey
root_dir: Path
validate_envelope(envelope)[source]

Validates signed envelope from another node.

Parameters:

envelope (SignedEnvelope)