npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

orbit-db-access-controllers

v0.4.0

Published

Access Controllers for OrbitDB

Downloads

1,144

Readme

orbit-db-access-controllers

Gitter Matrix

Access Controllers for OrbitDB

Install

This project uses npm and nodejs.

npm i orbit-db-access-controllers

Usage

By default, if no write-array is specified in options, the access control is set so that the initial user is the only one who has access (specified by the identity property of the orbitdb instance given in the argument). For the Ethereum-based contract example, the account which deploys the contract is initially given access.

Creating a custom Access Controller

You can create a custom access controller by implementing the AccessController interface and adding it to the AccessControllers object before passing it to OrbitDB. For more detailed examples, see the implementation of the Ethereum Contract Access Controller and OrbitDB Access Controller.

import AccessControllers from 'orbit-db-access-controllers'

class OtherAccessController extends AccessController {

  static get type () { return 'othertype' } // Return the type for this controller

  async canAppend(entry, identityProvider) {
    // logic to determine if entry can be added, for example:
    if (entry.payload === "hello world" && entry.identity.id === identity.id && identityProvider.verifyIdentity(entry.identity))
      return true

    return false
  }
  async grant (access, identity) {} // Logic for granting access to identity
}

AccessControllers.addAccessController({ AccessController: OtherAccessController })

const orbitdb = await OrbitDB.createInstance(ipfs, {
  AccessControllers: AccessControllers
})

const db = await orbitdb.keyvalue('first-database', {
  accessController: {
    type: 'othertype',
    write: [identity.id]
  }
})

Contribute

We would be happy to accept PRs! If you want to work on something, it'd be good to talk beforehand to make sure nobody else is working on it. You can reach us on Gitter, or in the issues section.

We also have regular community calls, which we announce in the issues in the @OrbitDB welcome repository. Join us!

For specific guidelines for contributing to this repository, check out the Contributing guide. For more on contributing to OrbitDB in general, take a look at the OrbitDB welcome repository. Please note that all interactions in @OrbitDB fall under our Code of Conduct.

License

MIT © 2018 Haja Networks Oy