v1.22.1 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 12 Imported by: 8



accesscontroller is a package handling permissions for OrbitDB stores



This section is empty.


This section is empty.


func CreateManifest

func CreateManifest(ctx context.Context, ipfs coreiface.CoreAPI, controllerType string, params ManifestParams) (cid.Cid, error)

CreateManifest Creates a new manifest and returns its CID

func WithLogger added in v1.5.0

func WithLogger(logger *zap.Logger) func(ac Interface)


type CanAppendAdditionalContext added in v0.1.0

type CanAppendAdditionalContext = accesscontroller.CanAppendAdditionalContext

type CreateAccessControllerOptions added in v0.1.0

type CreateAccessControllerOptions struct {
	SkipManifest bool
	Address      cid.Cid
	Type         string
	Name         string
	Access       map[string][]string
	// contains filtered or unexported fields

CreateAccessControllerOptions Options used to create an Access Controller

func CloneManifestParams added in v0.1.0

func CloneManifestParams(m ManifestParams) *CreateAccessControllerOptions

func (*CreateAccessControllerOptions) GetAccess added in v0.1.0

func (m *CreateAccessControllerOptions) GetAccess(role string) []string

func (*CreateAccessControllerOptions) GetAddress added in v0.1.0

func (m *CreateAccessControllerOptions) GetAddress() cid.Cid

func (*CreateAccessControllerOptions) GetAllAccess added in v0.1.0

func (m *CreateAccessControllerOptions) GetAllAccess() map[string][]string

func (*CreateAccessControllerOptions) GetName added in v0.1.0

func (*CreateAccessControllerOptions) GetSkipManifest added in v0.1.0

func (m *CreateAccessControllerOptions) GetSkipManifest() bool

func (*CreateAccessControllerOptions) GetType added in v0.1.0

func (*CreateAccessControllerOptions) SetAccess added in v0.1.0

func (m *CreateAccessControllerOptions) SetAccess(role string, allowed []string)

func (*CreateAccessControllerOptions) SetAddress added in v0.1.0

func (m *CreateAccessControllerOptions) SetAddress(c cid.Cid)

func (*CreateAccessControllerOptions) SetName added in v0.1.0

func (m *CreateAccessControllerOptions) SetName(name string)

func (*CreateAccessControllerOptions) SetType added in v0.1.0

func (m *CreateAccessControllerOptions) SetType(t string)

type Interface

type Interface interface {

	// Type Returns the type of the store as a string
	Type() string

	// GetAuthorizedByRole Returns the list of keys authorized for a given role
	GetAuthorizedByRole(role string) ([]string, error)

	// Grant Allows a new key for a given role
	Grant(ctx context.Context, capability string, keyID string) error

	// Revoke Removes the permission of a key to perform an action
	Revoke(ctx context.Context, capability string, keyID string) error

	// Load Fetches the configuration of the access controller using the given
	// address
	Load(ctx context.Context, address string) error

	// Save Persists the store configuration (its manifest)
	Save(ctx context.Context) (ManifestParams, error)

	// Close Closes the store
	Close() error

	SetLogger(logger *zap.Logger)
	Logger() *zap.Logger

Interface The interface for OrbitDB Access Controllers

type LogEntry added in v0.1.0

type LogEntry = iface.IPFSLogEntry

type Manifest

type Manifest struct {
	Type   string
	Params *CreateAccessControllerOptions

Manifest An access controller manifest

func ResolveManifest

func ResolveManifest(ctx context.Context, ipfs coreiface.CoreAPI, manifestAddress string, params ManifestParams) (*Manifest, error)

ResolveManifest Retrieves a manifest from its address

type ManifestParams

type ManifestParams interface {
	GetSkipManifest() bool
	GetAddress() cid.Cid
	GetType() string

	GetName() string
	SetAccess(string, []string)
	GetAccess(string) []string
	GetAllAccess() map[string][]string

ManifestParams List of getters for a manifest parameters

func NewEmptyManifestParams added in v0.1.0

func NewEmptyManifestParams() ManifestParams

func NewManifestParams

func NewManifestParams(address cid.Cid, skipManifest bool, manifestType string) ManifestParams

Create a new manifest parameters instance

func NewSimpleManifestParams added in v0.1.0

func NewSimpleManifestParams(manifestType string, access map[string][]string) ManifestParams

type Option added in v1.5.0

type Option func(ac Interface)


Path Synopsis
ipfs is an access controller
ipfs is an access controller
orbitdb is an access controller for OrbitDB stores
orbitdb is an access controller for OrbitDB stores
simple is an access controller without any persistence
simple is an access controller without any persistence
utils is a package containing tools related to access controllers
utils is a package containing tools related to access controllers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL