Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 0931fea

Browse files
author
haydenyoung
committed
Expose db identity information. Update write permissions by adding another public key to the store.
1 parent 9e60b20 commit 0931fea

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/lib/orbitdb-api.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,23 @@ class OrbitdbAPI extends Express {
201201
return contents
202202
}
203203

204+
this.get('/db/:dbname/identity', asyncMiddleware( async (req, res, next) => {
205+
const db = await dbm.get(req.params.dbname);
206+
const identity = db.identity;
207+
208+
return res.json(identity);
209+
}));
210+
211+
var db_put_write_public_key = asyncMiddleware( async (req, res, next) => {
212+
let db
213+
db = await dbm.get(req.params.dbname)
214+
await db.access.grant('write', req.params.pubkey)
215+
216+
return res.json('')
217+
});
218+
219+
this.put('/db/:dbname/access/write/:pubkey', db_put_write_public_key);
220+
204221
this.get('/db/:dbname/:item', asyncMiddleware( async (req, res, next) => {
205222
let result, contents
206223
contents = await getraw(req,res, next)

0 commit comments

Comments
 (0)