Help us shape the future of Go! Take the 2026 Go Developer Survey

identity_world

package
v0.57.21 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DomainInfoPrefix is the prefix applied to the domain info.
	DomainInfoPrefix = "d/"
	// DomainInfoTypeID is the type identifier for a DomainInfo.
	DomainInfoTypeID = "identity/domain"
)
View Source
const (
	// EntityPrefix is the prefix applied to domain-id/entity-id.
	EntityPrefix = "e/"
	// EntityTypeID is the type identifier for a Entity.
	EntityTypeID = "identity/entity"

	// PredEntityToDomainInfo is the predicate linking Entity to a DomainInfo.
	PredEntityToDomainInfo = quad.IRI("identity/entity-domain")
)
View Source
const (
	// KeypairPrefix is the prefix applied to the keypair peer id.
	KeypairPrefix = "kp/"
	// KeypairTypeID is the type identifier for a Keypair.
	KeypairTypeID = "identity/keypair"

	// PredObjectToKeypair links any object to a Keypair.
	// The meaning of the link is source-specific.
	PredObjectToKeypair = quad.IRI(KeypairTypeID + "-link")
)

Variables

View Source
var DomainInfoUpdateOpId = DomainInfoTypeID + "/update"

DomainInfoUpdateOpId is the domain info update operation id.

View Source
var EntityUpdateOpId = EntityTypeID + "/update"

EntityUpdateOpId is the entity update operation id.

View Source
var KeypairUpdateOpId = KeypairTypeID + "/update"

KeypairUpdateOpId is the keypair update operation id.

LookupOp looks up any of the aperture-identity ops.

Functions

func CollectAllDomainInfos

func CollectAllDomainInfos(ctx context.Context, w world.WorldState) ([]*identity_domain.DomainInfo, []string, error)

CollectAllDomainInfos collects all DomainInfo states located in the store. returns list of entities and object keys

func CollectAllEntities

func CollectAllEntities(ctx context.Context, w world.WorldState) ([]*identity.Entity, []string, error)

CollectAllEntities collects all Entity states located in the store. returns list of entities and object keys

func CollectAllKeypairs

func CollectAllKeypairs(ctx context.Context, w world.WorldState) ([]*identity.Keypair, []string, error)

CollectAllKeypairs collects all Keypair states located in the store. returns list of entities and object keys

func CollectDomainInfoEntities

func CollectDomainInfoEntities(ctx context.Context, w world.WorldState, domainKeys ...string) ([]*identity.Entity, error)

CollectDomainInfoEntities collects all Entity linking to the domain. returns list of Entities and object keys

func CollectEntityKeypairs

func CollectEntityKeypairs(ctx context.Context, w world.WorldState, entityKeys ...string) ([]*identity.Keypair, []string, error)

CollectEntityKeypairs collects all Keypair linked to by the given entities. returns list of Keypair for each object key

func CollectKeypairEntities

func CollectKeypairEntities(ctx context.Context, w world.WorldState, keypairKeys ...string) ([]*identity.Entity, []string, error)

CollectKeypairEntities collects all Entity linking to the keypairs. returns list of Entities and object keys

func CollectObjectKeypairs

func CollectObjectKeypairs(ctx context.Context, w world.WorldState, objectKeys ...string) ([]*identity.Keypair, []string, error)

CollectObjectKeypairs collects all Keypair linked to by the given Objects. returns list of Keypair

func EnsureKeypairsExist

func EnsureKeypairsExist(
	ctx context.Context,
	ws world.WorldState,
	sender peer.ID,
	kps []*identity.Keypair,
	overwrite bool,
) ([]string, error)

EnsureKeypairsExist ensures keypairs are written to storage. checks for duplicates in the list returns object keys

func FollowDomainInfo

func FollowDomainInfo(
	ctx context.Context,
	accessState world.AccessWorldStateFunc,
	domainInfoRef *bucket.ObjectRef,
) (*identity_domain.DomainInfo, error)

FollowDomainInfo follows & checks a reference to a DomainInfo.

func FollowEntity

func FollowEntity(
	ctx context.Context,
	accessState world.AccessWorldStateFunc,
	entityRef *bucket.ObjectRef,
) (*identity.Entity, error)

FollowEntity follows & checks a reference to a Entity.

func FollowKeypair

func FollowKeypair(
	ctx context.Context,
	accessState world.AccessWorldStateFunc,
	keypairRef *bucket.ObjectRef,
) (*identity.Keypair, error)

FollowKeypair follows & checks a reference to a Keypair.

func LinkObjectToKeypair

func LinkObjectToKeypair(
	ctx context.Context,
	w world.WorldState,
	sender peer.ID,
	objKey string,
	keypairPeer peer.ID,
	authMethodID string,
	authMethodParams []byte,
) (*identity.Keypair, string, error)

LinkObjectToKeypair looks up the keypair w/ the peer ID or creates it. Links objKey to the keypair using the object linking quad.

func ListDomainInfoEntities

func ListDomainInfoEntities(ctx context.Context, w world.WorldState, domainKeys ...string) ([]string, error)

ListDomainInfoEntities lists all Entity that link to the given domain object keys. returns list of object keys

func ListEntityKeypairs

func ListEntityKeypairs(ctx context.Context, w world.WorldState, entityKeys ...string) ([]string, error)

ListEntityKeypairs lists all Keypair linked to by the given entities. returns list of object keys

func ListKeypairEntities

func ListKeypairEntities(ctx context.Context, w world.WorldState, keypairKeys ...string) ([]string, error)

ListKeypairEntities lists all Entity that link to the given keypairs. returns list of object keys

func ListKeypairLinks(ctx context.Context, w world.WorldState, keypairKeys ...string) ([]string, error)

ListKeypairLinks collects all Object linking directly to the Keypair. returns list of object keys

func ListObjectKeypairs

func ListObjectKeypairs(ctx context.Context, w world.WorldState, objectKeys ...string) ([]string, error)

ListObjectKeypairs lists all Keypair linked to directly by the Objects.

func LookupDomainInfo

func LookupDomainInfo(ctx context.Context, w world.WorldState, objKey string) (*identity_domain.DomainInfo, world.ObjectState, error)

LookupDomainInfo looks up an entity with the given key. returns nil, nil, nil if not found.

func LookupDomainInfoOp

func LookupDomainInfoOp(ctx context.Context, opTypeID string) (world.Operation, error)

LookupDomainInfoOp performs the lookup operation for the DomainInfo op types.

func LookupDomainInfos

func LookupDomainInfos(ctx context.Context, w world.WorldState, objKeys []string) ([]*identity_domain.DomainInfo, error)

LookupDomainInfos looks up a set of keypairs.

func LookupEntities

func LookupEntities(ctx context.Context, w world.WorldState, objKeys []string) ([]*identity.Entity, error)

LookupEntities looks up a list of entities by object key.

func LookupEntity

func LookupEntity(ctx context.Context, w world.WorldState, objKey string) (*identity.Entity, world.ObjectState, error)

LookupEntity looks up an entity with the given key. returns nil, nil, nil if not found.

func LookupEntityOp

func LookupEntityOp(ctx context.Context, opTypeID string) (world.Operation, error)

LookupEntityOp performs the lookup operation for the Entity op types.

func LookupKeypair

func LookupKeypair(ctx context.Context, w world.WorldState, objKey string) (*identity.Keypair, world.ObjectState, error)

LookupKeypair looks up an entity with the given key. returns nil, nil, nil if not found.

func LookupKeypairBody added in v0.57.2

func LookupKeypairBody(ctx context.Context, w world.WorldState, objKey string) (*identity.Keypair, error)

LookupKeypairBody looks up a keypair without returning its object-state handle.

func LookupKeypairOp

func LookupKeypairOp(ctx context.Context, opTypeID string) (world.Operation, error)

LookupKeypairOp performs the lookup operation for the Keypair op types.

func LookupKeypairs

func LookupKeypairs(ctx context.Context, w world.WorldState, objKeys []string) ([]*identity.Keypair, error)

LookupKeypairs looks up a set of keypairs.

func LookupOrStoreKeypair

func LookupOrStoreKeypair(
	ctx context.Context,
	w world.WorldState,
	sender peer.ID,
	keypairPeer peer.ID,
	authMethodID string,
	authMethodParams []byte,
) (*identity.Keypair, string, error)

LookupOrStoreKeypair looks up the keypair with peer ID or stores a new keypair. Returns an error if storing keypair and cannot extract pubkey from peer id.

func NewDomainInfoKey

func NewDomainInfoKey(id string) string

NewDomainInfoKey builds a key from a domain id.

func NewEntityKey

func NewEntityKey(domainID, entityID string) string

NewEntityKey builds a key from a session id.

func NewEntityToDomainInfoQuad

func NewEntityToDomainInfoQuad(entityObjKey, domainInfoObjKey string) world.GraphQuad

NewEntityToDomainInfoQuad creates a quad linking an entity to a domain info.

func NewKeypairKey

func NewKeypairKey(peerIDString string) string

NewKeypairKey builds a key from a peer id.

func NewObjectToKeypairQuad

func NewObjectToKeypairQuad(objKey, keypairObjKey string) world.GraphQuad

NewObjectToKeypairQuad creates a quad linking any object to a Keypair.

func StoreDomainInfo

func StoreDomainInfo(
	ctx context.Context,
	w world.WorldState,
	sender peer.ID,
	di *identity_domain.DomainInfo,
) (uint64, bool, error)

StoreDomainInfo stores a domain info to a object using DomainInfoUpdate. Returns seqno, sysErr, error.

func StoreEntity

func StoreEntity(
	ctx context.Context,
	w world.WorldState,
	sender peer.ID,
	entity *identity.Entity,
) (uint64, bool, error)

StoreEntity stores an entity to an object using EntityUpdate. Returns seqno, sysErr, error.

func StoreKeypair

func StoreKeypair(
	ctx context.Context,
	w world.WorldState,
	sender peer.ID,
	kp *identity.Keypair,
	overwrite bool,
) (uint64, bool, error)

StoreKeypair stores a keypair to a object using KeypairUpdate. If !overwrite, returns if already exists. Returns seqno, sysErr, error.

Types

type DomainInfoUpdateOp

type DomainInfoUpdateOp struct {

	// DomainInfoRef is the reference to the DomainInfo object.
	DomainInfoRef *bucket.ObjectRef `protobuf:"bytes,1,opt,name=domain_info_ref,json=domainInfoRef,proto3" json:"domainInfoRef,omitempty"`
	// contains filtered or unexported fields
}

DomainInfoUpdateOp updates a DomainInfo.

func NewDomainInfoUpdateOp

func NewDomainInfoUpdateOp(domainInfoRef *bucket.ObjectRef) *DomainInfoUpdateOp

NewDomainInfoUpdateOp constructs a new DomainInfoUpdateOp block.

func (*DomainInfoUpdateOp) ApplyWorldObjectOp

func (o *DomainInfoUpdateOp) ApplyWorldObjectOp(
	ctx context.Context,
	le *logrus.Entry,
	objectHandle world.ObjectState,
	sender peer.ID,
) (sysErr bool, err error)

ApplyWorldObjectOp applies the operation to a world object handle.

func (*DomainInfoUpdateOp) ApplyWorldOp

func (o *DomainInfoUpdateOp) ApplyWorldOp(
	ctx context.Context,
	le *logrus.Entry,
	worldHandle world.WorldState,
	sender peer.ID,
) (sysErr bool, err error)

ApplyWorldOp applies the operation as a world operation.

func (*DomainInfoUpdateOp) CloneMessageVT

func (m *DomainInfoUpdateOp) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*DomainInfoUpdateOp) CloneVT

func (m *DomainInfoUpdateOp) CloneVT() *DomainInfoUpdateOp

func (*DomainInfoUpdateOp) EqualMessageVT

func (this *DomainInfoUpdateOp) EqualMessageVT(thatMsg any) bool

func (*DomainInfoUpdateOp) EqualVT

func (this *DomainInfoUpdateOp) EqualVT(that *DomainInfoUpdateOp) bool

func (*DomainInfoUpdateOp) GetDomainInfoRef

func (x *DomainInfoUpdateOp) GetDomainInfoRef() *bucket.ObjectRef

func (*DomainInfoUpdateOp) GetOperationTypeId

func (o *DomainInfoUpdateOp) GetOperationTypeId() string

GetOperationTypeId returns the operation type identifier.

func (*DomainInfoUpdateOp) MarshalBlock

func (o *DomainInfoUpdateOp) MarshalBlock() ([]byte, error)

MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.

func (*DomainInfoUpdateOp) MarshalJSON

func (x *DomainInfoUpdateOp) MarshalJSON() ([]byte, error)

MarshalJSON marshals the DomainInfoUpdateOp to JSON.

func (*DomainInfoUpdateOp) MarshalProtoJSON

func (x *DomainInfoUpdateOp) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the DomainInfoUpdateOp message to JSON.

func (*DomainInfoUpdateOp) MarshalProtoText

func (x *DomainInfoUpdateOp) MarshalProtoText() string

func (*DomainInfoUpdateOp) MarshalToSizedBufferVT

func (m *DomainInfoUpdateOp) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*DomainInfoUpdateOp) MarshalToVT

func (m *DomainInfoUpdateOp) MarshalToVT(dAtA []byte) (int, error)

func (*DomainInfoUpdateOp) MarshalVT

func (m *DomainInfoUpdateOp) MarshalVT() (dAtA []byte, err error)

func (*DomainInfoUpdateOp) ProtoMessage

func (*DomainInfoUpdateOp) ProtoMessage()

func (*DomainInfoUpdateOp) Reset

func (x *DomainInfoUpdateOp) Reset()

func (*DomainInfoUpdateOp) SizeVT

func (m *DomainInfoUpdateOp) SizeVT() (n int)

func (*DomainInfoUpdateOp) String

func (x *DomainInfoUpdateOp) String() string

func (*DomainInfoUpdateOp) UnmarshalBlock

func (o *DomainInfoUpdateOp) UnmarshalBlock(data []byte) error

UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.

func (*DomainInfoUpdateOp) UnmarshalJSON

func (x *DomainInfoUpdateOp) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the DomainInfoUpdateOp from JSON.

func (*DomainInfoUpdateOp) UnmarshalProtoJSON

func (x *DomainInfoUpdateOp) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the DomainInfoUpdateOp message from JSON.

func (*DomainInfoUpdateOp) UnmarshalVT

func (m *DomainInfoUpdateOp) UnmarshalVT(dAtA []byte) error

func (*DomainInfoUpdateOp) Validate

func (o *DomainInfoUpdateOp) Validate() error

Validate performs cursory validation of the operation. Should not block.

type EntityUpdateOp

type EntityUpdateOp struct {

	// EntityRef is the reference to the latest Entity object.
	EntityRef *bucket.ObjectRef `protobuf:"bytes,1,opt,name=entity_ref,json=entityRef,proto3" json:"entityRef,omitempty"`
	// contains filtered or unexported fields
}

EntityUpdateOp updates an entity and links to other objects. Operation verifies signatures on/for the Entity. Adds/updates a Keypair object for each valid Keypair. Adds links between the Entity and the Keypair. Can only be applied as a world op.

func NewEntityUpdateOp

func NewEntityUpdateOp(entityRef *bucket.ObjectRef) *EntityUpdateOp

NewEntityUpdateOp constructs a new EntityUpdateOp block.

func (*EntityUpdateOp) ApplyWorldObjectOp

func (o *EntityUpdateOp) ApplyWorldObjectOp(
	ctx context.Context,
	le *logrus.Entry,
	objectHandle world.ObjectState,
	sender peer.ID,
) (sysErr bool, err error)

ApplyWorldObjectOp applies the operation to a world object handle.

func (*EntityUpdateOp) ApplyWorldOp

func (o *EntityUpdateOp) ApplyWorldOp(
	ctx context.Context,
	le *logrus.Entry,
	worldHandle world.WorldState,
	sender peer.ID,
) (sysErr bool, err error)

ApplyWorldOp applies the operation as a world operation.

func (*EntityUpdateOp) CloneMessageVT

func (m *EntityUpdateOp) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*EntityUpdateOp) CloneVT

func (m *EntityUpdateOp) CloneVT() *EntityUpdateOp

func (*EntityUpdateOp) EqualMessageVT

func (this *EntityUpdateOp) EqualMessageVT(thatMsg any) bool

func (*EntityUpdateOp) EqualVT

func (this *EntityUpdateOp) EqualVT(that *EntityUpdateOp) bool

func (*EntityUpdateOp) GetEntityRef

func (x *EntityUpdateOp) GetEntityRef() *bucket.ObjectRef

func (*EntityUpdateOp) GetOperationTypeId

func (o *EntityUpdateOp) GetOperationTypeId() string

GetOperationTypeId returns the operation type identifier.

func (*EntityUpdateOp) MarshalBlock

func (o *EntityUpdateOp) MarshalBlock() ([]byte, error)

MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.

func (*EntityUpdateOp) MarshalJSON

func (x *EntityUpdateOp) MarshalJSON() ([]byte, error)

MarshalJSON marshals the EntityUpdateOp to JSON.

func (*EntityUpdateOp) MarshalProtoJSON

func (x *EntityUpdateOp) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the EntityUpdateOp message to JSON.

func (*EntityUpdateOp) MarshalProtoText

func (x *EntityUpdateOp) MarshalProtoText() string

func (*EntityUpdateOp) MarshalToSizedBufferVT

func (m *EntityUpdateOp) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*EntityUpdateOp) MarshalToVT

func (m *EntityUpdateOp) MarshalToVT(dAtA []byte) (int, error)

func (*EntityUpdateOp) MarshalVT

func (m *EntityUpdateOp) MarshalVT() (dAtA []byte, err error)

func (*EntityUpdateOp) ProtoMessage

func (*EntityUpdateOp) ProtoMessage()

func (*EntityUpdateOp) Reset

func (x *EntityUpdateOp) Reset()

func (*EntityUpdateOp) SizeVT

func (m *EntityUpdateOp) SizeVT() (n int)

func (*EntityUpdateOp) String

func (x *EntityUpdateOp) String() string

func (*EntityUpdateOp) UnmarshalBlock

func (o *EntityUpdateOp) UnmarshalBlock(data []byte) error

UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.

func (*EntityUpdateOp) UnmarshalJSON

func (x *EntityUpdateOp) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the EntityUpdateOp from JSON.

func (*EntityUpdateOp) UnmarshalProtoJSON

func (x *EntityUpdateOp) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the EntityUpdateOp message from JSON.

func (*EntityUpdateOp) UnmarshalVT

func (m *EntityUpdateOp) UnmarshalVT(dAtA []byte) error

func (*EntityUpdateOp) Validate

func (o *EntityUpdateOp) Validate() error

Validate performs cursory validation of the operation. Should not block.

type KeypairUpdateOp

type KeypairUpdateOp struct {

	// KeypairRef is the reference to the Keypair object.
	KeypairRef *bucket.ObjectRef `protobuf:"bytes,1,opt,name=keypair_ref,json=keypairRef,proto3" json:"keypairRef,omitempty"`
	// contains filtered or unexported fields
}

KeypairUpdateOp updates a Keypair.

func NewKeypairUpdateOp

func NewKeypairUpdateOp(keypairRef *bucket.ObjectRef) *KeypairUpdateOp

NewKeypairUpdateOp constructs a new KeypairUpdateOp block.

func (*KeypairUpdateOp) ApplyWorldObjectOp

func (o *KeypairUpdateOp) ApplyWorldObjectOp(
	ctx context.Context,
	le *logrus.Entry,
	objectHandle world.ObjectState,
	sender peer.ID,
) (sysErr bool, err error)

ApplyWorldObjectOp applies the operation to a world object handle.

func (*KeypairUpdateOp) ApplyWorldOp

func (o *KeypairUpdateOp) ApplyWorldOp(
	ctx context.Context,
	le *logrus.Entry,
	worldHandle world.WorldState,
	sender peer.ID,
) (sysErr bool, err error)

ApplyWorldOp applies the operation as a world operation.

func (*KeypairUpdateOp) CloneMessageVT

func (m *KeypairUpdateOp) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*KeypairUpdateOp) CloneVT

func (m *KeypairUpdateOp) CloneVT() *KeypairUpdateOp

func (*KeypairUpdateOp) EqualMessageVT

func (this *KeypairUpdateOp) EqualMessageVT(thatMsg any) bool

func (*KeypairUpdateOp) EqualVT

func (this *KeypairUpdateOp) EqualVT(that *KeypairUpdateOp) bool

func (*KeypairUpdateOp) GetKeypairRef

func (x *KeypairUpdateOp) GetKeypairRef() *bucket.ObjectRef

func (*KeypairUpdateOp) GetOperationTypeId

func (o *KeypairUpdateOp) GetOperationTypeId() string

GetOperationTypeId returns the operation type identifier.

func (*KeypairUpdateOp) MarshalBlock

func (o *KeypairUpdateOp) MarshalBlock() ([]byte, error)

MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.

func (*KeypairUpdateOp) MarshalJSON

func (x *KeypairUpdateOp) MarshalJSON() ([]byte, error)

MarshalJSON marshals the KeypairUpdateOp to JSON.

func (*KeypairUpdateOp) MarshalProtoJSON

func (x *KeypairUpdateOp) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the KeypairUpdateOp message to JSON.

func (*KeypairUpdateOp) MarshalProtoText

func (x *KeypairUpdateOp) MarshalProtoText() string

func (*KeypairUpdateOp) MarshalToSizedBufferVT

func (m *KeypairUpdateOp) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*KeypairUpdateOp) MarshalToVT

func (m *KeypairUpdateOp) MarshalToVT(dAtA []byte) (int, error)

func (*KeypairUpdateOp) MarshalVT

func (m *KeypairUpdateOp) MarshalVT() (dAtA []byte, err error)

func (*KeypairUpdateOp) ProtoMessage

func (*KeypairUpdateOp) ProtoMessage()

func (*KeypairUpdateOp) Reset

func (x *KeypairUpdateOp) Reset()

func (*KeypairUpdateOp) SizeVT

func (m *KeypairUpdateOp) SizeVT() (n int)

func (*KeypairUpdateOp) String

func (x *KeypairUpdateOp) String() string

func (*KeypairUpdateOp) UnmarshalBlock

func (o *KeypairUpdateOp) UnmarshalBlock(data []byte) error

UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.

func (*KeypairUpdateOp) UnmarshalJSON

func (x *KeypairUpdateOp) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the KeypairUpdateOp from JSON.

func (*KeypairUpdateOp) UnmarshalProtoJSON

func (x *KeypairUpdateOp) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the KeypairUpdateOp message from JSON.

func (*KeypairUpdateOp) UnmarshalVT

func (m *KeypairUpdateOp) UnmarshalVT(dAtA []byte) error

func (*KeypairUpdateOp) Validate

func (o *KeypairUpdateOp) Validate() error

Validate performs cursory validation of the operation. Should not block.

Jump to

Keyboard shortcuts

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