Declaration of Client
class.
Client class, which can be used to manage keys, encrypt arguments and decrypt results.
__init__(
client_specs: ClientSpecs,
keyset_cache_directory: Optional[Path, str] = None
)
Get evaluation keys for encrypted computation.
Returns: EvaluationKeys evaluation keys for encrypted computation
Get the keys for the client.
decrypt(
*results: Union[Value, Tuple[Value, ]],
function_name: str = 'main'
) → Union[int, ndarray, Tuple[Union[int, ndarray, NoneType], ], NoneType]
Decrypt result(s) of evaluation.
Args: *results (Union[Value, Tuple[Value, ...]]): result(s) of evaluation function_name (str): name of the function to decrypt for
Returns: Optional[Union[int, np.ndarray, Tuple[Optional[Union[int, np.ndarray]], ...]]]: decrypted result(s) of evaluation
encrypt(
*args: Optional[int, ndarray, List],
function_name: str = 'main'
) → Union[Value, Tuple[Optional[Value], ], NoneType]
Encrypt argument(s) to for evaluation.
Args: *args (Optional[Union[int, np.ndarray, List]]): argument(s) for evaluation function_name (str): name of the function to encrypt
Returns: Optional[Union[Value, Tuple[Optional[Value], ...]]]: encrypted argument(s) for evaluation
keygen(
force: bool = False,
seed: Optional[int] = None,
encryption_seed: Optional[int] = None
)
Generate keys required for homomorphic evaluation.
Args: force (bool, default = False): whether to generate new keys even if keys are already generated
seed (Optional[int], default = None): seed for private keys randomness
encryption_seed (Optional[int], default = None): seed for encryption randomness
load(
path: Union[str, Path],
keyset_cache_directory: Optional[Path, str] = None
) → Client
Load the client from the given path in zip format.
Args: path (Union[str, Path]): path to load the client from
keyset_cache_directory (Optional[Union[str, Path]], default = None): keyset cache directory to use
Returns: Client: client loaded from the filesystem
save(path: Union[str, Path])
Save the client into the given path in zip format.
Args: path (Union[str, Path]): path to save the client