Open-source SDK for accessing data privately using homomorphic encryption.
The Blyss SDK lets you use homomorphic encryption to retrieve information privately. With it, you can build new kinds of privacy-preserving services, like private password breach checking, private nameserver resolution, and even private Wikipedia.
You can get an API key by signing up, or run a server locally. Detailed documentation is at docs.blyss.dev.
Warning The SDK has not yet been security reviewed, and the public Blyss service is still in beta. Contact us for access to a production-ready service.
You can quickly try using the SDK with our managed service without downloading anything.
- Get an API key by signing up here.
- Open this StackBlitz and enter your API key where it says
<YOUR API KEY HERE>
. - Try adding users to the service using the "Add a user" button. As you add more users, the service will privately intersect each new users's contacts and the already existing users. Every user's list of contacts stays completely private using homomorphic encryption: it never leaves their device unencrypted.
We also have a simpler example using vanilla JS.
You can also use the Blyss SDK completely locally.
- Clone this repo with
git clone [email protected]:blyssprivacy/sdk.git
. - Run the server by entering
lib/server
and runningcargo run --release
. The server will run onlocalhost:8008
by default. - Run the client by entering
examples/node-local
and runningnpx ts-node main.ts
. This will perform some writes and then a private read to your bucket.
To use the Blyss SDK in an existing TypeScript project, install it with npm install @blyss/sdk
. Then, import the client with import { Client } from '@blyss/sdk';
. If you're using SDK in Node, and prefer not to use ESM, you can instead import it as const blyss = require('@blyss/sdk/node')
.
pip install --upgrade blyss
cd python
from repo root.pip install --upgrade .
The examples/
directory has several examples of how to use the Blyss SDK. Running the examples requires an API key.
The browser example shows how to quickly start using the Blyss SDK from vanilla JavaScript. The blyss-bundle.min.js
build output is a single-file JS bundle that binds the library to window.blyss
. Including this is a fast way to get started, especially if you prefer to use vanilla JS.
- Edit
examples/browser-simple/main.js
to use your API key. - Run a local HTTP server (we suggest serve) in the repo root.
- Go to
http://localhost:3000/examples/browser-simple/
in a browser.
The React example shows how to use the Blyss SDK in modern client-side JS. It also implements a more complicated application: private contact intersection.
- Enter
examples/react-complex
, and runnpm install
. - Edit
src/App.tsx
to use your API key. - Run
npm run start
.
The Node.js example shows how to use the Blyss SDK in server-side JS. Node 18+ is required.
- Enter
examples/node
, and runnpm install
. - Edit
main.ts
to use your API key. - Run
ts-node main.ts
.
- Install blyss.
- Enter
examples/python
. - Run
python main.py
.
All documentation is available at docs.blyss.dev. You can generate the docs by running npm start
in docs/
.
Please feel free to open issues and pull requests! For bugs, try to provide as much context as possible. We are also always open to documentation contributions.
This will build the complete SDK, including the core Rust libraries in lib/spiral-rs
and lib/doublepir
Requires python 3.8+.
- Run
pip install .
inpython
.
The Blyss SDK is structured as:
lib/
,lib/server/
, a Rust project containing the open-source Blyss server.lib/spiral-rs/
, a Rust crate containing the core cryptographic implementation of the Spiral PIR scheme.lib/doublepir/
, a Rust crate containing the core cryptographic implementation of the DoublePIR scheme.
js/
, the TypeScript code that implements the user-facing Blyss SDK.js/bridge/
, a Rust "bridge" crate that exposes key functionality fromspiral-rs
anddoublepir
to the TypeScript code.
python/
, the Python version of the SDK.python/src/lib.rs
, another Rust "bridge" crate that exposes key functionality fromspiral-rs
to the Python code.
MIT (see LICENSE.md)