- Notifications
You must be signed in to change notification settings - Fork0
Databunker storage class for nodejs
License
NotificationsYou must be signed in to change notification settings
securitybunker/databunker-store
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
TheDatabunker Store is a Node.js client library forDatabunker API to store personal records.Databunker is a Swiss army knife tool forencrypted storage of personal records or PII:
You need to havedatabunker 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:https://databunker.org/doc/install/
npm install --save @databunker/store
const DatabunkerStore = require('@databunker/store');const databunker = new DatabunkerStore({ url: process.env.DATABUNKER_URL, token: process.env.DATABUNKER_TOKEN});const newUser = { issuer: user.issuer, email: userMetadata.email, lastLoginAt: user.claim.iat};const result = await databunker.users.create(newUser);const user = await databunker.users.get("email", "user@gmail.com");const user2 = await databunker.users.get("token", "a3542566-4491-11eb-8269-2e04ce962524");cont change = { lastLoginAt: user.claim.iat };await databunker.users.set("token", "a3542566-4491-11eb-8269-2e04ce962524", change);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") { agreements.push(r); } } } return agreements;}const appData = {country: "EU"}await databunker.collection("data").set("token", "a3542566-4491-11eb-8269-2e04ce962524", data);const data = await databunker.collection("data").get("token", req.user.token);await databunker.agreements.accept("email", req.body.email, "privacy-accept", {});await databunker.agreements.withdraw("email", req.body.email, "privacy-accept");const { v4: uuidv4 } = require('uuid');const app = require('express')();const DatabunkerStore = require('@databunker/store');const port = 3200;const host = '0.0.0.0';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 = user.data; res.send("user: "+data["email"]+"\n"); res.end();})app.listen(port, host, () => { console.log(`Example app listening at http://${host}:${port}`)})About
Databunker storage class for nodejs
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.