mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 03:55:04 -05:00
feat(Clientlib): separate client encryption and server computation
Resolve #200
This commit is contained in:
16
docs/cpp_api/clientlib.rst
Normal file
16
docs/cpp_api/clientlib.rst
Normal file
@@ -0,0 +1,16 @@
|
||||
ClientLib
|
||||
=========
|
||||
|
||||
.. toctree::
|
||||
clientlib/intro
|
||||
clientlib/client_lambda
|
||||
clientlib/server_lambda
|
||||
|
||||
|
||||
Index
|
||||
=====
|
||||
.. toctree::
|
||||
:glob:
|
||||
:maxdepth: 2
|
||||
|
||||
clientlib/*
|
||||
4
docs/cpp_api/clientlib/arguments.rst
Normal file
4
docs/cpp_api/clientlib/arguments.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
LambdaArgument:
|
||||
===============
|
||||
|
||||
.. doxygenfile:: Arguments.h
|
||||
16
docs/cpp_api/clientlib/client_example.cpp
Normal file
16
docs/cpp_api/clientlib/client_example.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <concretelang/ClientLib/ClientLambda.h>
|
||||
|
||||
// Include the header that has been generated by the compiler
|
||||
#include "myinclude/fhe_service/additions.h"
|
||||
|
||||
void query_server(MyConnection conn) {
|
||||
auto libPath = "/opt/fhe_service/libs/additions.so";
|
||||
std::ostream to_server = conn.ostream();
|
||||
std::ostream from_server = conn.istream();
|
||||
// In a real code only load once.
|
||||
auto add2int = additions::add2int::load(libPath, seed_msb, seed_lsb);
|
||||
auto err = add2int->callSerialize(1, 2, to_server);
|
||||
if( err ) { throw MyException() };
|
||||
auto result = add2int->decryptReturned(from_server);
|
||||
assert(result == 3);
|
||||
}
|
||||
5
docs/cpp_api/clientlib/client_lambda.rst
Normal file
5
docs/cpp_api/clientlib/client_lambda.rst
Normal file
@@ -0,0 +1,5 @@
|
||||
ClientLambda:
|
||||
===============
|
||||
|
||||
.. doxygenfile:: ClientLambda.h
|
||||
:sections: briefdescription innernamespace typedef innerclass public-static-func public-func
|
||||
5
docs/cpp_api/clientlib/client_parameters.rst
Normal file
5
docs/cpp_api/clientlib/client_parameters.rst
Normal file
@@ -0,0 +1,5 @@
|
||||
ClientParameters:
|
||||
===============
|
||||
|
||||
.. doxygenstruct:: mlir::concretelang::ClientParameters
|
||||
.. doxygenfile:: ClientParameters.h
|
||||
23
docs/cpp_api/clientlib/intro.rst
Normal file
23
docs/cpp_api/clientlib/intro.rst
Normal file
@@ -0,0 +1,23 @@
|
||||
Description
|
||||
========
|
||||
|
||||
ClientLambda represents a FHE function on the client side.
|
||||
ServerLambda represents a FHE function on the server side.
|
||||
|
||||
These object read/write on istreams/ostreams.
|
||||
|
||||
Implementing a client/server consists in connecting the two, by connecting to actual streams.
|
||||
|
||||
Example on client side:
|
||||
|
||||
.. literalinclude:: client_example.cpp
|
||||
:linenos:
|
||||
:language: bash
|
||||
..
|
||||
For some reason cpp does not work well here.
|
||||
|
||||
Example on server side:
|
||||
|
||||
.. literalinclude:: server_example.cpp
|
||||
:linenos:
|
||||
:language: bash
|
||||
10
docs/cpp_api/clientlib/server_example.cpp
Normal file
10
docs/cpp_api/clientlib/server_example.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <concretelang/ServerLib/ServerLambda.h>
|
||||
|
||||
void answer_client(MyConnection conn) {
|
||||
std::istream from_client = conn.istream();
|
||||
std::ostream to_client = conn.ostream();
|
||||
auto err = serverLambda.read_call_write(serverInput, serverOutput);
|
||||
if (err) {
|
||||
throw MyException();
|
||||
}
|
||||
}
|
||||
4
docs/cpp_api/clientlib/server_lambda.rst
Normal file
4
docs/cpp_api/clientlib/server_lambda.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
ServerLambda:
|
||||
===============
|
||||
|
||||
.. doxygenfile:: ServerLambda.h
|
||||
@@ -1,4 +0,0 @@
|
||||
ClientParameters:
|
||||
===============
|
||||
|
||||
.. doxygenfile:: ClientParameters.h
|
||||
Reference in New Issue
Block a user