Update ACCESS_CONTROLLERS.md

Added ipfs argument to `Identities` constructor.
This commit is contained in:
Karsten Ohme
2024-01-25 13:28:41 +01:00
committed by GitHub
parent d37d2c9586
commit 9a5ca21577

View File

@@ -88,7 +88,7 @@ const ipfs = await createHelia({ libp2p })
const orbitdb = await createOrbitDB({ ipfs })
const identities = await Identities()
const identities = await Identities({ ipfs })
const anotherIdentity = identities.createIdentity('userB')
const db = orbitdb.open('my-db', { AccessController: OrbitDBAccessController({ write: [orbitdb.identity.id, anotherIdentity.id]) })
@@ -103,6 +103,8 @@ Grant and revoke are not limited to 'write' access only. A custom access capabil
The OrbitDBAccessController is a mutable access controller. Granting and revoking access does not change the address of the database.
The identities are synced using IPFS, hence also the IPFS instance must passed as in `Identities({ ipfs })`.
## Custom Access Controller
Access can be customized by implementing a custom access controller. To implement a custom access controller, specify:
@@ -178,4 +180,4 @@ const ipfs = await createHelia({ libp2p })
useAccessController(CustomAccessController)
const orbitdb = await createOrbitDB({ ipfs })
const db = await orbitdb.open('my-db', { AccessController: CustomAccessController(params) })
```
```