Participant API

class ComputationOwnerAPI(token: str)

ComputationOwnerAPI class.

Parameters
tokenstr

Refresh token to authenticate with Cosmian’s backend.

Attributes
connConnection

Manage authentication to Cosmian’s backend.

static random_words() Tuple[str, str, str]

Generate 3 random words to be used as pre-shared secret.

create_computation(name: str, code_provider_email: str, data_providers_emails: List[str], result_consumers_emails: List[str], dev_mode: bool = False) Computation

Invite participants to a new computation named name.

get_computations() List[Computation]

Retriveve all computations related to your account.

class CodeProviderAPI(token: str, ctx: CryptoContext)

CodeProviderAPI class derived from BaseAPI.

Parameters
tokenstr

Refresh token to authenticate with Cosmian’s backend.

ctxCryptoContext

Context with cryptographic secrets.

upload_code(computation_uuid: str, directory_path: Path, patterns: Optional[List[str]] = None, file_exceptions: Optional[List[str]] = None, dir_exceptions: Optional[List[str]] = None) Path

Send your Python code encrypted on a specific computation_uuid.

reset(computation_uuid: str) None

Delete the Python code of computation_uuid on Cosmian’s backend.

download_code(computation_uuid: str, directory_path: Path) Path

Send back your Python code encrypted on a specific computation_uuid.

get_computation(computation_uuid: str) Computation

Retrieve computation information related to computation_uuid.

get_computations() List[Computation]

Retriveve all computations related to your account.

get_status(computation_uuid: str) ComputationStatus

Retrieve computation status related to computation_uuid.

key_provisioning(computation_uuid: str, enclave_public_key: bytes) None

Send your symmetric key sealed for enclave_public_key.

register(computation_uuid: str) None

Send your public key and role for a specific computation_uuid.

wait_for_enclave_identity(computation_uuid: str, sleep_duration: int = 10) bytes

Wait for enclave’s public key to be available.

class DataProviderAPI(token: str, ctx: CryptoContext)

DataProviderAPI class derived from BaseAPI.

Parameters
tokenstr

Refresh token to authenticate with Cosmian’s backend.

ctxCryptoContext

Context with cryptographic secrets.

upload_data(computation_uuid: str, data_name: str, data: bytes) None

Upload encrypted data on computation_uuid.

upload_files(computation_uuid: str, paths: Iterable[Path]) None

Upload encrypted files on computation_uuid.

done(computation_uuid: str) None

Confirm that all data has been sent.

reset(computation_uuid: str) None

Remove all data sent for a specific computation_uuid.

download_code(computation_uuid: str, directory_path: Path) Path

Send back your Python code encrypted on a specific computation_uuid.

get_computation(computation_uuid: str) Computation

Retrieve computation information related to computation_uuid.

get_computations() List[Computation]

Retriveve all computations related to your account.

get_status(computation_uuid: str) ComputationStatus

Retrieve computation status related to computation_uuid.

key_provisioning(computation_uuid: str, enclave_public_key: bytes) None

Send your symmetric key sealed for enclave_public_key.

register(computation_uuid: str) None

Send your public key and role for a specific computation_uuid.

wait_for_enclave_identity(computation_uuid: str, sleep_duration: int = 10) bytes

Wait for enclave’s public key to be available.

class ResultConsumerAPI(token: str, ctx: CryptoContext)

ResultConsumerAPI class derived from BaseAPI.

Parameters
tokenstr

Refresh token to authenticate with Cosmian’s backend.

ctxCryptoContext

Context with cryptographic secrets.

fetch_result(computation_uuid: str) Optional[bytes]

Download the result of the computation if available.

wait_result(computation_uuid: str, sleep_duration: int = 30) bytes

Wait for the result to be available and fetch it.

download_code(computation_uuid: str, directory_path: Path) Path

Send back your Python code encrypted on a specific computation_uuid.

get_computation(computation_uuid: str) Computation

Retrieve computation information related to computation_uuid.

get_computations() List[Computation]

Retriveve all computations related to your account.

get_status(computation_uuid: str) ComputationStatus

Retrieve computation status related to computation_uuid.

key_provisioning(computation_uuid: str, enclave_public_key: bytes) None

Send your symmetric key sealed for enclave_public_key.

register(computation_uuid: str) None

Send your public key and role for a specific computation_uuid.

wait_for_enclave_identity(computation_uuid: str, sleep_duration: int = 10) bytes

Wait for enclave’s public key to be available.