mirror of
https://github.com/blyssprivacy/sdk.git
synced 2026-01-12 16:48:06 -05:00
24 lines
596 B
TypeScript
24 lines
596 B
TypeScript
import type { Bucket } from '@blyss/sdk';
|
|
const blyss = require('@blyss/sdk/node');
|
|
process.removeAllListeners('warning');
|
|
|
|
async function main() {
|
|
const bucket: Bucket = await blyss.Bucket.initializeLocal(
|
|
'http://localhost:8008'
|
|
);
|
|
|
|
// Write some data to it
|
|
await bucket.write({
|
|
Ohio: 'Columbus',
|
|
California: 'Sacramento',
|
|
Washington: 'Olympia'
|
|
});
|
|
|
|
// This is a completely *private* query:
|
|
// the server *cannot* learn that you looked up "California"!
|
|
const capital = await bucket.privateRead('California');
|
|
console.log(`Got capital: ${capital}`);
|
|
}
|
|
|
|
main();
|