list

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSuchUser              = errors.New("no such user")
	ErrFailedToDecrypt         = errors.New("failed to decrypt key")
	ErrUserRemoved             = errors.New("user was removed from the document")
	ErrDocumentForbidden       = errors.New("your user was forbidden access to the document")
	ErrUserAlreadyExists       = errors.New("user already exists")
	ErrNoSuchRecord            = errors.New("no such record")
	ErrNoSuchInvite            = errors.New("no such invite")
	ErrOldInvite               = errors.New("invite is too old")
	ErrInsufficientPermissions = errors.New("insufficient permissions")
	ErrNoReadKey               = errors.New("acl state doesn't have a read key")
	ErrInvalidSignature        = errors.New("signature is invalid")
	ErrIncorrectRoot           = errors.New("incorrect root")
	ErrIncorrectRecordSequence = errors.New("incorrect prev id of a record")
)
View Source
var ErrIncorrectCID = errors.New("incorrect CID")

Functions

This section is empty.

Types

type AclList

type AclList interface {
	RWLocker
	Id() string
	Root() *aclrecordproto.RawAclRecordWithId
	Records() []*AclRecord
	AclState() *AclState
	IsAfter(first string, second string) (bool, error)
	Head() *AclRecord
	Get(id string) (*AclRecord, error)
	Iterate(iterFunc IterFunc)
	IterateFrom(startId string, iterFunc IterFunc)
	KeyStorage() crypto.KeyStorage

	AddRawRecord(rawRec *aclrecordproto.RawAclRecordWithId) (added bool, err error)

	Close() (err error)
}

func BuildAclList

func BuildAclList(storage liststorage.ListStorage) (AclList, error)

func BuildAclListWithIdentity

func BuildAclListWithIdentity(acc *accountdata.AccountKeys, storage liststorage.ListStorage) (AclList, error)

func NewTestDerivedAcl

func NewTestDerivedAcl(spaceId string, keys *accountdata.AccountKeys) (AclList, error)

type AclRecord

type AclRecord struct {
	Id        string
	PrevId    string
	ReadKeyId string
	Timestamp int64
	Data      []byte
	Identity  crypto.PubKey
	Model     interface{}
	Signature []byte
}

type AclRecordBuilder

type AclRecordBuilder interface {
	Unmarshall(rawIdRecord *aclrecordproto.RawAclRecordWithId) (rec *AclRecord, err error)
	BuildRoot(content RootContent) (rec *aclrecordproto.RawAclRecordWithId, err error)
}

func NewAclRecordBuilder

func NewAclRecordBuilder(id string, keyStorage crypto.KeyStorage) AclRecordBuilder

type AclState

type AclState struct {
	// contains filtered or unexported fields
}

func (*AclState) CurrentReadKey

func (st *AclState) CurrentReadKey() (crypto.SymKey, error)

func (*AclState) CurrentReadKeyId

func (st *AclState) CurrentReadKeyId() string

func (*AclState) HasPermission

func (st *AclState) HasPermission(identity crypto.PubKey, permission aclrecordproto.AclUserPermissions) bool

func (*AclState) Invite

func (st *AclState) Invite(acceptPubKey []byte) (invite *aclrecordproto.AclUserInvite, err error)

func (*AclState) LastRecordId

func (st *AclState) LastRecordId() string

func (*AclState) StateAtRecord

func (st *AclState) StateAtRecord(id string, pubKey crypto.PubKey) (AclUserState, error)

func (*AclState) UserReadKeys

func (st *AclState) UserReadKeys() map[string]crypto.SymKey

func (*AclState) UserStates

func (st *AclState) UserStates() map[string]AclUserState

type AclUserState

type AclUserState struct {
	PubKey      crypto.PubKey
	Permissions aclrecordproto.AclUserPermissions
}

type IterFunc

type IterFunc = func(record *AclRecord) (IsContinue bool)

type RWLocker

type RWLocker interface {
	sync.Locker
	RLock()
	RUnlock()
}

type RootContent

type RootContent struct {
	PrivKey          crypto.PrivKey
	MasterKey        crypto.PrivKey
	SpaceId          string
	EncryptedReadKey []byte
}

type UserPermissionPair

type UserPermissionPair struct {
	Identity   crypto.PubKey
	Permission aclrecordproto.AclUserPermissions
}

Directories

Path Synopsis
Package mock_list is a generated GoMock package.
Package mock_list is a generated GoMock package.

Jump to

Keyboard shortcuts

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