Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


The Databunker Store is a Node.js client library for Databunker API to store personal records. Databunker is a Swiss army knife tool for encrypted storage of personal records or PII:


You need to have databunker service up and running.

You can use the following command to start Databunker in development mode:

docker run -p 3000:3000 -d --rm --name dbunker securitybunker/databunker demo

For production use, follow the Databunker installation guide:


npm install --save @databunker/store


Init access

const DatabunkerStore = require('@databunker/store');
const databunker = new DatabunkerStore({
  url: process.env.DATABUNKER_URL,
  token: process.env.DATABUNKER_TOKEN

Create user record

const newUser = {
  issuer: user.issuer,
  lastLoginAt: user.claim.iat
const result = await databunker.users.create(newUser);

Get user record

const user = await databunker.users.get("email", "");
const user2 = await databunker.users.get("token", "a3542566-4491-11eb-8269-2e04ce962524");

Update user record

cont change = { lastLoginAt: user.claim.iat };
await databunker.users.set("token", "a3542566-4491-11eb-8269-2e04ce962524", change);

Extract all agreements to displayed on the signup page

async function loadSignupAgreements() {
  const allAgreements = await databunker.agreements.rawlist();
  let agreements = [];
  if (allAgreements.status == "ok") {
    for (const idx in allAgreements.rows) {
      const r = allAgreements.rows[idx];
      if (r.module == 'signup-page' && r.basistype == "consent") {
  return agreements;

Save data in user app collection

const appData = {country: "EU"}
await databunker.collection("data").set("token", "a3542566-4491-11eb-8269-2e04ce962524", data);

Read user data from app collection

const data = await databunker.collection("data").get("token", req.user.token);

Accept an agreement

await databunker.agreements.accept("email",, "privacy-accept", {});

Withdraw an agreement

await databunker.agreements.withdraw("email",, "privacy-accept");

Full example

const { v4: uuidv4 } = require('uuid');
const app = require('express')();
const DatabunkerStore = require('@databunker/store');

const port = 3200;
const host = '';
const DataBunkerConf = {
  url: 'http://localhost:3000',
  token: 'DEMO'
const databunker = new DatabunkerStore(DataBunkerConf);

app.get('/', async (req, res) => {
  const user = await databunker.users.get("phone", "4444");
  const data =;
  res.send("user: "+data["email"]+"\n");

app.listen(port, host, () => {
  console.log(`Example app listening at http://${host}:${port}`)