ClientNode Class
The ClientNode class represents a client that interacts with the CoFHE (Collaborative Fully Homomorphic Encryption) library to perform computations using on OpenVector network. It provides methods to send computation requests, handle responses, and access cryptographic functionalities.
Public Member Functions
void compute(ComputeRequest request, ComputeResponse **response);
void compute(ComputeRequest request, ComputeResponse **response);Performs a computation using the CoFHE network based on the provided ComputeRequest. The result is stored in the ComputeResponse object.
ComputeRequest request = /* ... */;
ComputeResponse* response = nullptr;
clientNode.compute(request, &response);
// Use the response
if (response->status() == ComputeResponse::Status::OK) {
// Process the result
}Parameters:
request: AComputeRequestobject containing the computation details and input data.response: A double pointer to aComputeResponseobject where the result will be stored.
Usage Notes:
Ensure that the
responsepointer is initialized tonullptrbefore passing it to the function.After the computation, check the status of the
responseto determine if the computation was successful.
CryptoSystem& crypto_system();
CryptoSystem& crypto_system();Returns a reference to the CryptoSystem object used by the client node. This object can be used to perform cryptographic operations such as encryption, decryption, and homomorphic arithmetic that are supported locally.
Usage Notes:
Use this function when you need to perform cryptographic operations without involving the network.
The returned
CryptoSystemprovides methods as defined in the CryptoSystem Interface.
const CryptoSystem& crypto_system() const;
const CryptoSystem& crypto_system() const;Const version of crypto_system(). Returns a constant reference to the CryptoSystem object.
typename CryptoSystem::PublicKey& network_public_key();
typename CryptoSystem::PublicKey& network_public_key();Returns a reference to the public key of the network. This key is used to encrypt data that will be sent to the network for computation.
Usage Notes:
Use this public key to encrypt your data before sending it to the network via a
ComputeRequest.The type of the public key corresponds to
CryptoSystem::PublicKey.
const typename CryptoSystem::PublicKey& network_public_key() const;
const typename CryptoSystem::PublicKey& network_public_key() const;Const version of network_public_key(). Returns a constant reference to the network's public key.
Usage Example
See Also
Last updated