Skip to content

Latest commit

 

History

History
86 lines (69 loc) · 2.83 KB

README.md

File metadata and controls

86 lines (69 loc) · 2.83 KB

logo

HollowDB Client

HollowDB client is the simplest way to use HollowDB, a decentralized & privacy-preserving key-value database.

License: MIT NPM License: MIT Workflow: Tests GitHub: HollowDB Discord

Installation

HollowDB client is an NPM package. You can install it as:

yarn add hollowdb-client    # yarn
npm install hollowdb-client # npm
pnpm add hollowdb-client    # pnpm

Usage

Create a new API key and a database at https://developer.hollowdb.xyz. Create a new client by providing your API key and the database name to connect:

client = await HollowClient.new({
  apiKey: 'your-api-key',
  db: 'your-database-name',
});

After that, using the client is as simple as it gets:

// without zero-knowledge proofs
await client.get(KEY);
await client.put(KEY, VALUE);
await client.update(KEY, VALUE);
await client.remove(KEY);

If you are connecting to a database that has zero-knowledge proof verifications enabled, you will need to provide proofs along with your update & remove requests.

You can use our HollowDB Prover utility to generate proofs with minimal development effort. Assuming that a proof is generated for the respective request, the proof shall be provided as an additional argument to these functions.

// with zero-knowledge proofs
await client.get(KEY);
await client.put(KEY, VALUE);
await client.update(KEY, VALUE, PROOF);
await client.remove(KEY, PROOF);

Testing

To run tests:

yarn test

The API calls are mocked during the test, so you can run it offline.