QKDSimkit package
Subpackages
Channel module
This module contains channel’s interface
Client module
This module contains client’s procedure to retrieve keys
- QKDSimkit.Client.get_key(alice_address: str, channel_address: str, password: str, number: int, size: int)[source]
Runs handshake and starts bob procedure
- Parameters
alice_address (str) – address of server
channel_address (str) – address of channel
token (str) – pre shared token
number (int) – number of keys
size (int) – size of keys (bits)
Server module
This module contains server’s APIs and method to run it
- async QKDSimkit.Server.add_user(token: str)[source]
Saves a token and its hash in memory
- Parameters
token (str) – token representing a user
- async QKDSimkit.Server.cache_get(key: str)[source]
Retrieve a value from cache
- Parameters
key (str) – key
- async QKDSimkit.Server.cache_set(key: str, value)[source]
Save a value in cahce
- Parameters
key (str) – key
value – value
- QKDSimkit.Server.get_key_cli(id)[source]
Synchronous wrapper for get_key
- Returns
list of keys for the given ID
- Return type
keys
- async QKDSimkit.Server.getkey(password: Optional[str] = None)[source]
Retrieves keys from server
- Parameters
password (str) – hashed token
- async QKDSimkit.Server.root(number: int, size: int, hashed: str, hash_proof: str, background_tasks: BackgroundTasks)[source]
Checks handshake and starts alice
- Parameters
number (int) – number of keys
size (int) – size of keys (bits)
hashed (str) – identifier (hash of token)
hash_proof (str) – hash of proof message
background_tasks – background tasks
- async QKDSimkit.Server.start_alice(number: int, size: int, ID: str)[source]
Imports keys from an alice node, saves keys in memory
- Parameters
number (int) – number of keys
size (int) – size of keys (bits)
ID (str) – identifier (hash of token)
- QKDSimkit.Server.start_server(channel_address, address)[source]
Starts server and connect to an external channel
- Parameters
channel_address (str) – address of channel
address (str) – where to bind this server
- QKDSimkit.Server.start_server_and_channel(channel_address: str, noise: float, eve: bool, address: str)[source]
Starts both server and channel
- Returns
address of channel noise (float): ratio of noise in channel eve (bool): simulate an eavesdropper in channel address (str): where to bind this server
- Return type
channel_address (str)
p2p_servers module
This module contains methods to operate a p2p node
- async QKDSimkit.p2p_servers.answer_get(number: int, size: int, ID: str, type: str)[source]
Starts a node
- Parameters
number (int) – number of keys
size (int) – size of keys (bits)
ID (str) – identifier of a pair of nodes
type (str) – alice or bob (sender or receiver)
- Returns
keys
cli module
This module contains the command line interface