Documentation
¶
Index ¶
- Variables
- type AcceptorVerifier
- type AccountRemovePayload
- type AclList
- func BuildAclList(storage liststorage.ListStorage, verifier AcceptorVerifier) (AclList, error)
- func BuildAclListWithIdentity(acc *accountdata.AccountKeys, storage liststorage.ListStorage, ...) (AclList, error)
- func NewTestAclWithRoot(keys *accountdata.AccountKeys, root *consensusproto.RawRecordWithId) (AclList, error)
- func NewTestDerivedAcl(spaceId string, keys *accountdata.AccountKeys) (AclList, error)
- type AclPermissions
- type AclRecord
- type AclRecordBuilder
- type AclState
- func (st *AclState) CurrentReadKey() (crypto.SymKey, error)
- func (st *AclState) CurrentReadKeyId() string
- func (st *AclState) JoinRecords() (records []RequestRecord)
- func (st *AclState) LastRecordId() string
- func (st *AclState) Permissions(identity crypto.PubKey) AclPermissions
- func (st *AclState) RemoveRecords() (records []RequestRecord)
- func (st *AclState) StateAtRecord(id string, pubKey crypto.PubKey) (AclUserState, error)
- func (st *AclState) UserReadKeys() map[string]crypto.SymKey
- func (st *AclState) Validator() ContentValidator
- type AclUserState
- type ContentValidator
- type InviteResult
- type IterFunc
- type NoOpAcceptorVerifier
- type PermissionChangePayload
- type RWLocker
- type RequestAcceptPayload
- type RequestJoinPayload
- type RequestRecord
- type RequestType
- type RootContent
- type UserPermissionPair
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoSuchAccount = errors.New("no such account") ErrPendingRequest = errors.New("already exists pending request") ErrUnexpectedContentType = errors.New("unexpected content type") ErrIncorrectIdentity = errors.New("incorrect identity") ErrIncorrectInviteKey = errors.New("incorrect invite key") ErrFailedToDecrypt = errors.New("failed to decrypt key") ErrNoSuchRecord = errors.New("no such record") ErrNoSuchRequest = errors.New("no such request") ErrNoSuchInvite = errors.New("no such invite") ErrInsufficientPermissions = errors.New("insufficient permissions") ErrIsOwner = errors.New("can't be made by owner") ErrIncorrectNumberOfAccounts = errors.New("incorrect number of accounts") ErrDuplicateAccounts = errors.New("duplicate accounts") ErrNoReadKey = errors.New("acl state doesn't have a read key") ErrIncorrectReadKey = errors.New("incorrect 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") ErrRecordAlreadyExists = errors.New("record already exists") )
Functions ¶
This section is empty.
Types ¶
type AcceptorVerifier ¶ added in v0.2.11
type AcceptorVerifier interface {
VerifyAcceptor(rec *consensusproto.RawRecord) (err error)
}
type AccountRemovePayload ¶ added in v0.2.11
type AclList ¶
type AclList interface {
RWLocker
Id() string
Root() *consensusproto.RawRecordWithId
Records() []*AclRecord
AclState() *AclState
IsAfter(first string, second string) (bool, error)
Head() *AclRecord
Get(id string) (*AclRecord, error)
GetIndex(idx int) (*AclRecord, error)
Iterate(iterFunc IterFunc)
IterateFrom(startId string, iterFunc IterFunc)
KeyStorage() crypto.KeyStorage
RecordBuilder() AclRecordBuilder
ValidateRawRecord(record *consensusproto.RawRecord) (err error)
AddRawRecord(rawRec *consensusproto.RawRecordWithId) (err error)
Close() (err error)
}
func BuildAclList ¶
func BuildAclList(storage liststorage.ListStorage, verifier AcceptorVerifier) (AclList, error)
func BuildAclListWithIdentity ¶
func BuildAclListWithIdentity(acc *accountdata.AccountKeys, storage liststorage.ListStorage, verifier AcceptorVerifier) (AclList, error)
func NewTestAclWithRoot ¶ added in v0.2.11
func NewTestAclWithRoot(keys *accountdata.AccountKeys, root *consensusproto.RawRecordWithId) (AclList, error)
func NewTestDerivedAcl ¶
func NewTestDerivedAcl(spaceId string, keys *accountdata.AccountKeys) (AclList, error)
type AclPermissions ¶ added in v0.2.11
type AclPermissions aclrecordproto.AclUserPermissions
func (AclPermissions) CanManageAccounts ¶ added in v0.2.11
func (p AclPermissions) CanManageAccounts() bool
func (AclPermissions) CanWrite ¶ added in v0.2.11
func (p AclPermissions) CanWrite() bool
func (AclPermissions) IsOwner ¶ added in v0.2.11
func (p AclPermissions) IsOwner() bool
func (AclPermissions) NoPermissions ¶ added in v0.2.11
func (p AclPermissions) NoPermissions() bool
type AclRecordBuilder ¶
type AclRecordBuilder interface {
UnmarshallWithId(rawIdRecord *consensusproto.RawRecordWithId) (rec *AclRecord, err error)
Unmarshall(rawRecord *consensusproto.RawRecord) (rec *AclRecord, err error)
BuildRoot(content RootContent) (rec *consensusproto.RawRecordWithId, err error)
BuildInvite() (res InviteResult, err error)
BuildInviteRevoke(inviteRecordId string) (rawRecord *consensusproto.RawRecord, err error)
BuildRequestJoin(payload RequestJoinPayload) (rawRecord *consensusproto.RawRecord, err error)
BuildRequestAccept(payload RequestAcceptPayload) (rawRecord *consensusproto.RawRecord, err error)
BuildRequestDecline(requestRecordId string) (rawRecord *consensusproto.RawRecord, err error)
BuildRequestRemove() (rawRecord *consensusproto.RawRecord, err error)
BuildPermissionChange(payload PermissionChangePayload) (rawRecord *consensusproto.RawRecord, err error)
BuildReadKeyChange(newKey crypto.SymKey) (rawRecord *consensusproto.RawRecord, err error)
BuildAccountRemove(payload AccountRemovePayload) (rawRecord *consensusproto.RawRecord, err error)
}
func NewAclRecordBuilder ¶
func NewAclRecordBuilder(id string, keyStorage crypto.KeyStorage, keys *accountdata.AccountKeys, verifier AcceptorVerifier) AclRecordBuilder
type AclState ¶
type AclState struct {
// contains filtered or unexported fields
}
func (*AclState) CurrentReadKeyId ¶
func (*AclState) JoinRecords ¶ added in v0.2.11
func (st *AclState) JoinRecords() (records []RequestRecord)
func (*AclState) LastRecordId ¶
func (*AclState) Permissions ¶ added in v0.2.11
func (st *AclState) Permissions(identity crypto.PubKey) AclPermissions
func (*AclState) RemoveRecords ¶ added in v0.2.11
func (st *AclState) RemoveRecords() (records []RequestRecord)
func (*AclState) StateAtRecord ¶
func (*AclState) Validator ¶ added in v0.2.11
func (st *AclState) Validator() ContentValidator
type AclUserState ¶
type AclUserState struct {
PubKey crypto.PubKey
Permissions AclPermissions
RequestMetadata []byte
}
type ContentValidator ¶ added in v0.2.11
type ContentValidator interface {
ValidateAclRecordContents(ch *AclRecord) (err error)
ValidatePermissionChange(ch *aclrecordproto.AclAccountPermissionChange, authorIdentity crypto.PubKey) (err error)
ValidateInvite(ch *aclrecordproto.AclAccountInvite, authorIdentity crypto.PubKey) (err error)
ValidateInviteRevoke(ch *aclrecordproto.AclAccountInviteRevoke, authorIdentity crypto.PubKey) (err error)
ValidateRequestJoin(ch *aclrecordproto.AclAccountRequestJoin, authorIdentity crypto.PubKey) (err error)
ValidateRequestAccept(ch *aclrecordproto.AclAccountRequestAccept, authorIdentity crypto.PubKey) (err error)
ValidateRequestDecline(ch *aclrecordproto.AclAccountRequestDecline, authorIdentity crypto.PubKey) (err error)
ValidateAccountRemove(ch *aclrecordproto.AclAccountRemove, authorIdentity crypto.PubKey) (err error)
ValidateRequestRemove(ch *aclrecordproto.AclAccountRequestRemove, authorIdentity crypto.PubKey) (err error)
ValidateReadKeyChange(ch *aclrecordproto.AclReadKeyChange, authorIdentity crypto.PubKey) (err error)
}
type InviteResult ¶ added in v0.2.11
type InviteResult struct {
InviteRec *consensusproto.RawRecord
InviteKey crypto.PrivKey
}
type NoOpAcceptorVerifier ¶ added in v0.2.11
type NoOpAcceptorVerifier struct {
}
func (NoOpAcceptorVerifier) VerifyAcceptor ¶ added in v0.2.11
func (n NoOpAcceptorVerifier) VerifyAcceptor(rec *consensusproto.RawRecord) (err error)
type PermissionChangePayload ¶ added in v0.2.11
type PermissionChangePayload struct {
Identity crypto.PubKey
Permissions AclPermissions
}
type RequestAcceptPayload ¶ added in v0.2.11
type RequestAcceptPayload struct {
RequestRecordId string
Permissions AclPermissions
}
type RequestJoinPayload ¶ added in v0.2.11
type RequestRecord ¶ added in v0.2.11
type RequestRecord struct {
RequestIdentity crypto.PubKey
RequestMetadata []byte
Type RequestType
}
type RequestType ¶ added in v0.2.11
type RequestType int
const ( RequestTypeRemove RequestType = iota RequestTypeJoin )
type RootContent ¶
type UserPermissionPair ¶
type UserPermissionPair struct {
Identity crypto.PubKey
Permission aclrecordproto.AclUserPermissions
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.