mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-06-15 02:26:37 +00:00
Remove obsolete code from OrbitDB AC
This commit is contained in:
parent
fca6439399
commit
e687b51d96
@ -1,12 +1,9 @@
|
||||
import { EventEmitter } from 'events'
|
||||
import ensureACAddress from '../utils/ensure-ac-address.js'
|
||||
import IPFSAccessController from './ipfs.js'
|
||||
|
||||
const type = 'orbitdb'
|
||||
|
||||
const OrbitDBAccessController = ({ write } = {}) => async ({ orbitdb, identities, address }) => {
|
||||
const events = new EventEmitter()
|
||||
|
||||
address = address || 'default-access-controller'
|
||||
write = write || [orbitdb.identity.id]
|
||||
|
||||
@ -14,12 +11,6 @@ const OrbitDBAccessController = ({ write } = {}) => async ({ orbitdb, identities
|
||||
const db = await orbitdb.open(ensureACAddress(address), { type: 'keyvalue', AccessController: IPFSAccessController({ write }) })
|
||||
address = db.address
|
||||
|
||||
const onUpdate = (entry) => {
|
||||
events.emit('update', entry)
|
||||
}
|
||||
|
||||
db.events.on('update', onUpdate)
|
||||
|
||||
// Return true if entry is allowed to be added to the database
|
||||
const canAppend = async (entry) => {
|
||||
const writerIdentity = await identities.getIdentity(entry.identity)
|
||||
@ -101,7 +92,7 @@ const OrbitDBAccessController = ({ write } = {}) => async ({ orbitdb, identities
|
||||
grant,
|
||||
revoke,
|
||||
close,
|
||||
events
|
||||
events: db.events
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user