JavaScript client for your Big Dumb Objects
npm install bdo-jsThis is the JavaScript client SDK for the BDO miniservice.
``javascript
import bdo from 'bdo-js';
const saveKeys = (keys) => { / handle persisting keys here / };
const getKeys = () => { / return keys here. Can be async / };
const hash = 'this hash describes the context for this bdo';
const newBDO = {
youc: 'an',
put: 'whatever',
you: {
want: 'here',
so: 'long',
as: 'it\'s,
},
an: 'object'
};
const uuid = await bdo.createUser(hash, newBDO, saveKeys, getKeys);
newBDO.put = 'something else';
const user = await bdo.updateBDO(uuid, hash, newBDO);
const userAgain = await bdo.getBDO(uuid, hash);
// Get BDO by emojicode (public BDOs only)
const bdoByEmojicode = await bdo.getBDOByEmojicode('🌍🔑💎🌟💎🎨🐉📌');
// Returns: { emojicode, pubKey, bdo: {...}, createdAt: 1697040000000 }
const deleted = await bdo.deleteUser(uuid, hash); // returns true on success
``