Last updated:
0 purchases
apsi 0.1.2
PyAPSI
Python wrapper for labeled and unlabeled asynchronous private set intersection
(APSI).
Setup
For manylinux_2_31_x86_64 compatible platforms you can install PyAPSI from
PyPi with
pip install apsi
You can check the system library versions that are required to be
manylinux_2_31_x86_64 compatible in the
auditwheel policy.
In case you feel like contributing a build setup for Windows and OSX compatible wheels
or extend the "From Source" section below, I would be happy to review your pull request.
Example
Example usage of the labeled APSI server and client.
The unlabeled variant can be used analogous to this.
from apsi import LabeledServer, LabeledClient
apsi_params = """
{
"table_params": {
"hash_func_count": 3,
"table_size": 512,
"max_items_per_bin": 92
},
"item_params": {"felts_per_item": 8},
"query_params": {
"ps_low_degree": 0,
"query_powers": [1, 3, 4, 5, 8, 14, 20, 26, 32, 38, 41, 42, 43, 45, 46]
},
"seal_params": {
"plain_modulus": 40961,
"poly_modulus_degree": 4096,
"coeff_modulus_bits": [40, 32, 32]
}
}
"""
server = LabeledServer()
server.init_db(apsi_params, max_label_length=10)
server.add_items([("item", "1234567890"), ("abc", "123"), ("other", "my label")])
client = LabeledClient(apsi_params)
oprf_request = client.oprf_request(["item", "abc"])
oprf_response = server.handle_oprf_request(oprf_request)
query = client.build_query(oprf_response)
response = server.handle_query(query)
result = client.extract_result(response)
assert result == {"item": "1234567890", "abc": "123"}
To control multi threading and logging in APSI see
apsi.utils.
Building & Testing
Docker
Before you start, make sure that Taskfile,
Docker and
Poetry are installed.
You can then run a full build with tests that will generate a wheel file in dist/ as
follows:
task wheel PYTHON_VERSION=3.10.4
Note: Only Python 3.8, 3.9, 3.10, and their patch versions for which
official Python Docker images exist are supported.
From Source
Please have a look at the files inside
docker/ for the required vcpkg
setup and apsi AVX2 patch, in case you'd like to build from source in a custom
environment.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.