identity

package
v0.51.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EntityChangeType_name = map[int32]string{
		0: "EntityChangeType_UNKNOWN",
		1: "EntityChangeType_REGISTER_KEYPAIR",
		2: "EntityChangeType_REMOVE_KEYPAIR",
	}
	EntityChangeType_value = map[string]int32{
		"EntityChangeType_UNKNOWN":          0,
		"EntityChangeType_REGISTER_KEYPAIR": 1,
		"EntityChangeType_REMOVE_KEYPAIR":   2,
	}
)

Enum value maps for EntityChangeType.

View Source
var ErrUnableDerivePrivKey = errors.New("unable to derive any private key")

ErrUnableDerivePrivKey is returned if we could not derive any matching private keys.

Functions

func ExPromptPassword

func ExPromptPassword(
	ctx context.Context,
	b bus.Bus,
	domainID, reason, reasonDetail string,
	prevErr error,
) (string, error)

ExPromptPassword executes the derive keypair directive.

Returns the first value passed to the callback.

func LookupOrDeriveEntityKeypair

func LookupOrDeriveEntityKeypair(
	ctx context.Context,
	b bus.Bus,
	kps []*EntityKeypair,
) ([]peer.Peer, error)

LookupOrDeriveEntityKeypair attempts to resolve peer.Peer from entity keypairs.

- Find all available local private keys which match the entity keypairs. - Allow the user to interactively derive those keypairs that we don't have.

func LookupOrDeriveKeypair

func LookupOrDeriveKeypair(
	ctx context.Context,
	b bus.Bus,
	kps []*Keypair,
) ([]peer.Peer, error)

LookupOrDeriveKeypair attempts to resolve peer.Peer from keypairs w/o entity info.

func NewEntityBlock

func NewEntityBlock() block.Block

NewEntityBlock constructs a new Entity block

func NewEntityKeypairBlock

func NewEntityKeypairBlock() block.Block

NewEntityKeypairBlock constructs a new Entity block

func NewKeypairBlock

func NewKeypairBlock() block.Block

NewKeypairBlock constructs a new Entity block

func ValidateDomainID

func ValidateDomainID(id string) error

ValidateDomainID checks if a domain ID is valid.

func ValidateDomainUUID

func ValidateDomainUUID(id string) error

ValidateDomainUUID checks if the domain-specific UUID is valid.

func ValidateEntityID

func ValidateEntityID(id string) error

ValidateEntityID checks if a entity ID is valid.

func ValidateUUID

func ValidateUUID(id string) error

ValidateUUID checks if a uuid is valid.

Types

type DeriveEntityKeypair

type DeriveEntityKeypair interface {
	// Directive indicates this is a directive.
	directive.Directive

	// DeriveEntityKeypairList is the list of keypairs to derive for.
	// Any of the keypairs can be resolved.
	// The entity id and domain id fields may be empty.
	DeriveEntityKeypairList() []*EntityKeypair
}

DeriveEntityKeypair asks any running controllers to derive a private key. Controllers should inspect the auth_method_id and auth_method_params. If no controllers derive the keypair, will return not found.

func NewDeriveEntityKeypair

func NewDeriveEntityKeypair(kps []*EntityKeypair) DeriveEntityKeypair

NewDeriveEntityKeypair constructs a new DeriveEntityKeypair directive.

type DeriveEntityKeypairValue

type DeriveEntityKeypairValue = peer.Peer

DeriveEntityKeypairValue is a result of the DeriveEntityKeypair directive. The peer will be matched to the Keypair by peer ID.

func ExDeriveEntityKeypair

func ExDeriveEntityKeypair(
	ctx context.Context,
	b bus.Bus,
	kps []*EntityKeypair,
	waitOne bool,
) ([]DeriveEntityKeypairValue, directive.Instance, directive.Reference, error)

ExDeriveEntityKeypair executes the derive entity keypair directive.

if waitOne is set, we wait for a value before returning. otherwise if the directive becomes idle, returns no values.

func ExDeriveKeypair

func ExDeriveKeypair(
	ctx context.Context,
	b bus.Bus,
	kps []*Keypair,
	waitOne bool,
) ([]DeriveEntityKeypairValue, directive.Instance, directive.Reference, error)

ExDeriveKeypair executes the derive entity keypair directive w/o entity info.

if waitOne is set, we wait for a value before returning. otherwise if the directive becomes idle, returns no values.

type Entity

type Entity struct {

	// EntityId is the user-specified entity identifier, akin to a username.
	// The entity id is not necessarily unique in all domains.
	// Must be a valid DNS label name as defined in RFC 1123.
	// Must be lowercase.
	EntityId string `protobuf:"bytes,1,opt,name=entity_id,json=entityId,proto3" json:"entityId,omitempty"`
	// EntityUuid is a domain-unique unique identifier, generated at account
	// registration time.
	//
	// Usually: UUIDv5(domain_uuid, entity_id)
	EntityUuid string `protobuf:"bytes,2,opt,name=entity_uuid,json=entityUuid,proto3" json:"entityUuid,omitempty"`
	// DomainId is the domain identifier (typically the domain name).
	// This domain controller controls this entity.
	// Must be a valid DNS subdomain name as defined in RFC 1123.
	// Must be lowercase.
	DomainId string `protobuf:"bytes,3,opt,name=domain_id,json=domainId,proto3" json:"domainId,omitempty"`
	// Epoch is the change epoch for the entity, incremented when changes are made.
	Epoch uint64 `protobuf:"varint,4,opt,name=epoch,proto3" json:"epoch,omitempty"`
	// EntityKeypairSet contains marshalled EntityKeypair aliases of the Entity.
	EntityKeypairSet *EntityKeypairSet `protobuf:"bytes,5,opt,name=entity_keypair_set,json=entityKeypairSet,proto3" json:"entityKeypairSet,omitempty"`
	// contains filtered or unexported fields
}

Entity is an individual user or system with a persistent identity.

The root Entity object is not considered to be sensitive information. For an Entity to be valid, all Keypairs must have valid signatures.

func EntityWithPrivKey

func EntityWithPrivKey(
	domainID string,
	entityID, entityUUID string,
	privKey crypto.PrivKey,
	authMethodID string,
	authMethodParams []byte,
) (*Entity, error)

EntityWithPrivKey builds a new Entity from a private key.

authMethodID and authMethodParams can be empty.

func NewEntity

func NewEntity(domainID, entityID, entityUUID string) *Entity

NewEntity constructs a new entity object.

func UnmarshalEntity

func UnmarshalEntity(ctx context.Context, bcs *block.Cursor) (*Entity, error)

UnmarshalEntity unmarshals a Entity from a cursor. If empty, returns nil, nil

func (*Entity) AppendKeypair

func (e *Entity) AppendKeypair(privKey crypto.PrivKey, ekp *EntityKeypair) error

AppendKeypair adds a keypair to the entity.

Signs the keypair + entity data using the private key. The private key must match the given keypair. The keypair must not already exist.

func (*Entity) CloneMessageVT

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

func (*Entity) CloneVT

func (m *Entity) CloneVT() *Entity

func (*Entity) EqualMessageVT

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

func (*Entity) EqualVT

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

func (*Entity) GetDomainId

func (x *Entity) GetDomainId() string

func (*Entity) GetEntityId

func (x *Entity) GetEntityId() string

func (*Entity) GetEntityKeypairSet

func (x *Entity) GetEntityKeypairSet() *EntityKeypairSet

func (*Entity) GetEntityUuid

func (x *Entity) GetEntityUuid() string

func (*Entity) GetEpoch

func (x *Entity) GetEpoch() uint64

func (*Entity) MarshalBlock

func (e *Entity) MarshalBlock() ([]byte, error)

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

func (*Entity) MarshalJSON

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

MarshalJSON marshals the Entity to JSON.

func (*Entity) MarshalProtoJSON

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

MarshalProtoJSON marshals the Entity message to JSON.

func (*Entity) MarshalProtoText

func (x *Entity) MarshalProtoText() string

func (*Entity) MarshalToSizedBufferVT

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

func (*Entity) MarshalToVT

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

func (*Entity) MarshalVT

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

func (*Entity) ProtoMessage

func (*Entity) ProtoMessage()

func (*Entity) Reset

func (x *Entity) Reset()

func (*Entity) SizeVT

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

func (*Entity) String

func (x *Entity) String() string

func (*Entity) UnmarshalBlock

func (e *Entity) UnmarshalBlock(data []byte) error

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

func (*Entity) UnmarshalJSON

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

UnmarshalJSON unmarshals the Entity from JSON.

func (*Entity) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the Entity message from JSON.

func (*Entity) UnmarshalVT

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

func (*Entity) UnmarshalVerifyKeypairs

func (e *Entity) UnmarshalVerifyKeypairs() ([]*EntityKeypair, error)

UnmarshalVerifyKeypairs unmarshals and checks the keypair signatures.

func (*Entity) Validate

func (e *Entity) Validate() error

Validate validates the entity object and all keypair signatures. Auth method params and/or IDs are not validated.

type EntityChangeType

type EntityChangeType int32

EntityChangeType is an entity change transaction type.

const (
	EntityChangeType_EntityChangeType_UNKNOWN          EntityChangeType = 0
	EntityChangeType_EntityChangeType_REGISTER_KEYPAIR EntityChangeType = 1
	EntityChangeType_EntityChangeType_REMOVE_KEYPAIR   EntityChangeType = 2
)

func (EntityChangeType) Enum

func (EntityChangeType) MarshalJSON

func (x EntityChangeType) MarshalJSON() ([]byte, error)

MarshalJSON marshals the EntityChangeType to JSON.

func (EntityChangeType) MarshalProtoJSON

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

MarshalProtoJSON marshals the EntityChangeType to JSON.

func (EntityChangeType) MarshalProtoText

func (x EntityChangeType) MarshalProtoText() string

func (EntityChangeType) MarshalText

func (x EntityChangeType) MarshalText() ([]byte, error)

MarshalText marshals the EntityChangeType to text.

func (EntityChangeType) String

func (x EntityChangeType) String() string

func (*EntityChangeType) UnmarshalJSON

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

UnmarshalJSON unmarshals the EntityChangeType from JSON.

func (*EntityChangeType) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the EntityChangeType from JSON.

func (*EntityChangeType) UnmarshalText

func (x *EntityChangeType) UnmarshalText(b []byte) error

UnmarshalText unmarshals the EntityChangeType from text.

type EntityKeypair

type EntityKeypair struct {

	// EntityId is the entity_id field of the Entity.
	// Must match the entity_id specified in the Entity object.
	// If this is a Domain, this field will be empty.
	EntityId string `protobuf:"bytes,1,opt,name=entity_id,json=entityId,proto3" json:"entityId,omitempty"`
	// DomainId is the domain_id field of the Entity.
	// Must match the domain_id specified in the Entity object.
	DomainId string `protobuf:"bytes,2,opt,name=domain_id,json=domainId,proto3" json:"domainId,omitempty"`
	// Keypair is the keypair to associate with the entity.
	Keypair *Keypair `protobuf:"bytes,3,opt,name=keypair,proto3" json:"keypair,omitempty"`
	// contains filtered or unexported fields
}

EntityKeypair contains a binding between a Keypair and an Entity.

func EntitiesToEntityKeypairs

func EntitiesToEntityKeypairs(ents []*Entity) ([]*EntityKeypair, error)

EntitiesToEntityKeypairs parses all entity keypairs from the entities.

func EntityKeypairWithPubKey

func EntityKeypairWithPubKey(
	domainID, entityID string,
	pubKey crypto.PubKey,
	authMethodID string,
	authMethodParams []byte,
) (*EntityKeypair, error)

EntityKeypairWithPubKey builds a new EntityKeypair from a public key.

authMethodID and authMethodParams can be empty.

func KeypairsToEntityKeypairs

func KeypairsToEntityKeypairs(kps []*Keypair, domainID, entityID string) []*EntityKeypair

KeypairsToEntityKeypairs converts all keypairs to entity keypairs.

func NewEntityKeypair

func NewEntityKeypair(domainID, entityID string, kp *Keypair) *EntityKeypair

NewEntityKeypair constructs a new entity keypair binding.

func UnmarshalEntityKeypair

func UnmarshalEntityKeypair(ctx context.Context, bcs *block.Cursor) (*EntityKeypair, error)

UnmarshalEntityKeypair unmarshals a EntityKeypair from a cursor. If empty, returns nil, nil

func (*EntityKeypair) CheckMatchesEntity

func (k *EntityKeypair) CheckMatchesEntity(e *Entity) bool

CheckMatchesEntity checks if the keypair matches the given entity.

Note: does not check if the entity keypair set contains the entity.

func (*EntityKeypair) CloneMessageVT

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

func (*EntityKeypair) CloneVT

func (m *EntityKeypair) CloneVT() *EntityKeypair

func (*EntityKeypair) EqualMessageVT

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

func (*EntityKeypair) EqualVT

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

func (*EntityKeypair) GetDomainId

func (x *EntityKeypair) GetDomainId() string

func (*EntityKeypair) GetEntityEmpty

func (k *EntityKeypair) GetEntityEmpty() bool

GetEntityEmpty checks if the entity ID or domain ID are empty.

An EntityKeypair can contain just a Keypair if it is not be associated with any domain or entity.

func (*EntityKeypair) GetEntityId

func (x *EntityKeypair) GetEntityId() string

func (*EntityKeypair) GetKeypair

func (x *EntityKeypair) GetKeypair() *Keypair

func (*EntityKeypair) MarshalBlock

func (k *EntityKeypair) MarshalBlock() ([]byte, error)

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

func (*EntityKeypair) MarshalJSON

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

MarshalJSON marshals the EntityKeypair to JSON.

func (*EntityKeypair) MarshalProtoJSON

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

MarshalProtoJSON marshals the EntityKeypair message to JSON.

func (*EntityKeypair) MarshalProtoText

func (x *EntityKeypair) MarshalProtoText() string

func (*EntityKeypair) MarshalToSizedBufferVT

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

func (*EntityKeypair) MarshalToVT

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

func (*EntityKeypair) MarshalVT

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

func (*EntityKeypair) ProtoMessage

func (*EntityKeypair) ProtoMessage()

func (*EntityKeypair) Reset

func (x *EntityKeypair) Reset()

func (*EntityKeypair) SizeVT

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

func (*EntityKeypair) String

func (x *EntityKeypair) String() string

func (*EntityKeypair) UnmarshalBlock

func (k *EntityKeypair) UnmarshalBlock(data []byte) error

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

func (*EntityKeypair) UnmarshalJSON

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

UnmarshalJSON unmarshals the EntityKeypair from JSON.

func (*EntityKeypair) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the EntityKeypair message from JSON.

func (*EntityKeypair) UnmarshalVT

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

func (*EntityKeypair) Validate

func (k *EntityKeypair) Validate() error

Validate validates the keypair.

func (*EntityKeypair) ValidateMatchesEntity

func (k *EntityKeypair) ValidateMatchesEntity(e *Entity) error

ValidateMatchesEntity checks if the keypair matches the given entity.

Note: does not check if the entity keypair set contains the entity.

type EntityKeypairSet

type EntityKeypairSet struct {

	// EntityKeypairs contains marshalled EntityKeypair objects.
	EntityKeypairs [][]byte `protobuf:"bytes,1,rep,name=entity_keypairs,json=entityKeypairs,proto3" json:"entityKeypairs,omitempty"`
	// EntityKeypairSignatures contains the signatures for each Keypair.
	// The signature pub_key must match the peer_id of the Keypair.
	// len(entity_keypair_signatures) must match len(entity_keypairs)
	EntityKeypairSignatures []*peer.Signature `` /* 130-byte string literal not displayed */
	// contains filtered or unexported fields
}

EntityKeypairSet is a signed set of EntityKeypair.

func (*EntityKeypairSet) AppendKeypair

func (e *EntityKeypairSet) AppendKeypair(privKey crypto.PrivKey, ekp *EntityKeypair, ent *Entity) error

AppendKeypair adds a keypair to the set.

Signs the keypair + entity data using the private key. The private key must match the given keypair. The keypair must not already exist. If Entity != nil, checks if the Entity matches the keypair.

func (*EntityKeypairSet) CloneMessageVT

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

func (*EntityKeypairSet) CloneVT

func (m *EntityKeypairSet) CloneVT() *EntityKeypairSet

func (*EntityKeypairSet) EqualMessageVT

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

func (*EntityKeypairSet) EqualVT

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

func (*EntityKeypairSet) GetEntityKeypairSignatures

func (x *EntityKeypairSet) GetEntityKeypairSignatures() []*peer.Signature

func (*EntityKeypairSet) GetEntityKeypairs

func (x *EntityKeypairSet) GetEntityKeypairs() [][]byte

func (*EntityKeypairSet) MarshalBlock

func (e *EntityKeypairSet) MarshalBlock() ([]byte, error)

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

func (*EntityKeypairSet) MarshalJSON

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

MarshalJSON marshals the EntityKeypairSet to JSON.

func (*EntityKeypairSet) MarshalProtoJSON

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

MarshalProtoJSON marshals the EntityKeypairSet message to JSON.

func (*EntityKeypairSet) MarshalProtoText

func (x *EntityKeypairSet) MarshalProtoText() string

func (*EntityKeypairSet) MarshalToSizedBufferVT

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

func (*EntityKeypairSet) MarshalToVT

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

func (*EntityKeypairSet) MarshalVT

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

func (*EntityKeypairSet) ProtoMessage

func (*EntityKeypairSet) ProtoMessage()

func (*EntityKeypairSet) Reset

func (x *EntityKeypairSet) Reset()

func (*EntityKeypairSet) SizeVT

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

func (*EntityKeypairSet) String

func (x *EntityKeypairSet) String() string

func (*EntityKeypairSet) UnmarshalBlock

func (e *EntityKeypairSet) UnmarshalBlock(data []byte) error

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

func (*EntityKeypairSet) UnmarshalJSON

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

UnmarshalJSON unmarshals the EntityKeypairSet from JSON.

func (*EntityKeypairSet) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the EntityKeypairSet message from JSON.

func (*EntityKeypairSet) UnmarshalVT

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

func (*EntityKeypairSet) UnmarshalVerifyKeypairs

func (e *EntityKeypairSet) UnmarshalVerifyKeypairs(ent *Entity) ([]*EntityKeypair, error)

UnmarshalVerifyKeypairs unmarshals and checks the keypair signatures.

If ent != nil, checks that the keypairs match the entity.

func (*EntityKeypairSet) Validate

func (e *EntityKeypairSet) Validate(ent *Entity) error

Validate validates the EntityKeypairSet.

If ent != nil checks that the keypairs match the entity.

type EntityRef

type EntityRef struct {

	// EntityId is the entity_id field of the Entity.
	// Must match the entity_id specified in the Entity object.
	EntityId string `protobuf:"bytes,1,opt,name=entity_id,json=entityId,proto3" json:"entityId,omitempty"`
	// DomainId is the domain_id field of the Entity.
	// Must match the domain_id specified in the Entity object.
	DomainId string `protobuf:"bytes,2,opt,name=domain_id,json=domainId,proto3" json:"domainId,omitempty"`
	// contains filtered or unexported fields
}

EntityRef is a reference to a entity on a domain.

func (*EntityRef) CloneMessageVT

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

func (*EntityRef) CloneVT

func (m *EntityRef) CloneVT() *EntityRef

func (*EntityRef) EqualMessageVT

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

func (*EntityRef) EqualVT

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

func (*EntityRef) GetDomainId

func (x *EntityRef) GetDomainId() string

func (*EntityRef) GetEntityId

func (x *EntityRef) GetEntityId() string

func (*EntityRef) MarshalJSON

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

MarshalJSON marshals the EntityRef to JSON.

func (*EntityRef) MarshalProtoJSON

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

MarshalProtoJSON marshals the EntityRef message to JSON.

func (*EntityRef) MarshalProtoText

func (x *EntityRef) MarshalProtoText() string

func (*EntityRef) MarshalToSizedBufferVT

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

func (*EntityRef) MarshalToVT

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

func (*EntityRef) MarshalVT

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

func (*EntityRef) ProtoMessage

func (*EntityRef) ProtoMessage()

func (*EntityRef) Reset

func (x *EntityRef) Reset()

func (*EntityRef) SizeVT

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

func (*EntityRef) String

func (x *EntityRef) String() string

func (*EntityRef) UnmarshalJSON

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

UnmarshalJSON unmarshals the EntityRef from JSON.

func (*EntityRef) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the EntityRef message from JSON.

func (*EntityRef) UnmarshalVT

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

type IdentityLookupEntity

type IdentityLookupEntity interface {
	// Directive indicates IdentityLookupEntity is a directive.
	directive.Directive

	// IdentityLookupEntityDomainID is the domain identifier.
	// Cannot be empty.
	IdentityLookupEntityDomainID() string

	// IdentityLookupEntityID is the domain-unique identifier (username).
	IdentityLookupEntityID() string
}

IdentityLookupEntity is a directive to search for a entity record. At least one of the search fields should be set. TODO: For now the domain ID must be set.

The entity record contains the list of keypairs which may contain information on how to derive the key, given a secret or local hardware private key. Note that it would not be possible to derive the private key without the secret for each auth method, for username this would be the password (scrypt key generation with proof of work).

func NewIdentityLookupEntity

func NewIdentityLookupEntity(
	domainID string,
	entityID string,
) IdentityLookupEntity

NewIdentityLookupEntity constructs a new lookupEntity directive.

type IdentityLookupEntityValue

type IdentityLookupEntityValue interface {
	// GetError returns any overall error with the process.
	GetError() error
	// IsNotFound indicates if the result was not-found.
	// If this is set and err != nil, err must be a not found error.
	IsNotFound() bool
	// GetEntity returns the entity record that was found.
	GetEntity() *Entity
}

IdentityLookupEntityValue is the result of the IdentityLookupEntity directive.

func ExIdentityLookupEntity

func ExIdentityLookupEntity(ctx context.Context, b bus.Bus, domainID, entityID string) (IdentityLookupEntityValue, error)

ExIdentityLookupEntity executes the lookup entity directive.

func NewIdentityLookupEntityValue

func NewIdentityLookupEntityValue(
	err error,
	notFound bool,
	ent *Entity,
) IdentityLookupEntityValue

NewIdentityLookupEntityValue constructs a new lookupEntity value.

type Keypair

type Keypair struct {

	// PeerId is the peer id of the keypair (derived from pubkey).
	// Must match the pub_key field.
	PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"`
	// PubKey is the PEM-encoded public key with Bifrost keypem.
	// Must match the pub_key of the keypair signature on the Entity.
	PubKey string `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pubKey,omitempty"`
	// AuthMethodId is the authentication method to derive this key.
	// This is a black-box value: it is used to derive the key again later.
	AuthMethodId string `protobuf:"bytes,3,opt,name=auth_method_id,json=authMethodId,proto3" json:"authMethodId,omitempty"`
	// AuthMethodParams is the encoded params object for the method.
	//
	// Params might include the CTAP2 records for binding, attestation.
	AuthMethodParams []byte `protobuf:"bytes,4,opt,name=auth_method_params,json=authMethodParams,proto3" json:"authMethodParams,omitempty"`
	// contains filtered or unexported fields
}

Keypair contains a peer ID (public key) and information to derive the key.

func EntitiesToKeypairs

func EntitiesToKeypairs(ents []*Entity) ([]*Keypair, error)

EntitiesToKeypairs parses all keypairs from the entities.

func EntityKeypairsToKeypairs

func EntityKeypairsToKeypairs(entkps []*EntityKeypair) []*Keypair

EntityKeypairsToKeypairs converts all entity keypairs to keypairs.

func NewKeypair

func NewKeypair(
	pubKey crypto.PubKey,
	authMethodID string,
	authMethodParams []byte,
) (*Keypair, error)

NewKeypair constructs a new keypair.

authMethodID and authMethodParams can be empty.

func UnmarshalKeypair

func UnmarshalKeypair(ctx context.Context, bcs *block.Cursor) (*Keypair, error)

UnmarshalKeypair unmarshals a Keypair from a cursor. If empty, returns nil, nil

func (*Keypair) CloneMessageVT

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

func (*Keypair) CloneVT

func (m *Keypair) CloneVT() *Keypair

func (*Keypair) EqualMessageVT

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

func (*Keypair) EqualVT

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

func (*Keypair) GetAuthMethodId

func (x *Keypair) GetAuthMethodId() string

func (*Keypair) GetAuthMethodParams

func (x *Keypair) GetAuthMethodParams() []byte

func (*Keypair) GetPeerId

func (x *Keypair) GetPeerId() string

func (*Keypair) GetPubKey

func (x *Keypair) GetPubKey() string

func (*Keypair) MarshalBlock

func (k *Keypair) MarshalBlock() ([]byte, error)

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

func (*Keypair) MarshalJSON

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

MarshalJSON marshals the Keypair to JSON.

func (*Keypair) MarshalProtoJSON

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

MarshalProtoJSON marshals the Keypair message to JSON.

func (*Keypair) MarshalProtoText

func (x *Keypair) MarshalProtoText() string

func (*Keypair) MarshalToSizedBufferVT

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

func (*Keypair) MarshalToVT

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

func (*Keypair) MarshalVT

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

func (*Keypair) ParsePeerID

func (k *Keypair) ParsePeerID() (peer.ID, error)

ParsePeerID parses the peer id field.

func (*Keypair) ParsePubKey

func (k *Keypair) ParsePubKey() (crypto.PubKey, error)

ParsePubKey parses the public key field.

func (*Keypair) ProtoMessage

func (*Keypair) ProtoMessage()

func (*Keypair) Reset

func (x *Keypair) Reset()

func (*Keypair) SizeVT

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

func (*Keypair) String

func (x *Keypair) String() string

func (*Keypair) UnmarshalBlock

func (k *Keypair) UnmarshalBlock(data []byte) error

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

func (*Keypair) UnmarshalJSON

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

UnmarshalJSON unmarshals the Keypair from JSON.

func (*Keypair) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the Keypair message from JSON.

func (*Keypair) UnmarshalVT

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

func (*Keypair) Validate

func (k *Keypair) Validate() error

Validate validates the keypair.

type PendingEntityChange

type PendingEntityChange struct {

	// ChangePeerId is the peer id of the transactor submitting the change.
	//
	// This peer ID should be checked against incoming transactions. It should be
	// authenticated to be an ID with authority to change the record: usually
	// either a existing associated identity or a domain authority.
	ChangePeerId string `protobuf:"bytes,1,opt,name=change_peer_id,json=changePeerId,proto3" json:"changePeerId,omitempty"`
	// Epoch is the change epoch, incremented when changes are made.
	Epoch uint64 `protobuf:"varint,2,opt,name=epoch,proto3" json:"epoch,omitempty"`
	// DomainIdentifier is the identifier of the related entity.
	DomainIdentifier string `protobuf:"bytes,3,opt,name=domain_identifier,json=domainIdentifier,proto3" json:"domainIdentifier,omitempty"`
	// EntityChangeType is the type of this entity change.
	EntityChangeType EntityChangeType `protobuf:"varint,4,opt,name=entity_change_type,json=entityChangeType,proto3" json:"entityChangeType,omitempty"`
	// EntityChangeData is the inner data for the entity change.
	EntityChangeData string `protobuf:"bytes,5,opt,name=entity_change_data,json=entityChangeData,proto3" json:"entityChangeData,omitempty"`
	// contains filtered or unexported fields
}

PendingEntityChange is a ongoing change to a entity credential list.

An additional transaction system will manage adding/removing/updating these records, which exist to represent ongoing transactions to update an entity record, for example, adding a new security key via a handshake with hardware.

Specific change transaction types (Create, Update, Dismiss) are implemented by the auth method (not in this system).

func (*PendingEntityChange) CloneMessageVT

func (*PendingEntityChange) CloneVT

func (*PendingEntityChange) EqualMessageVT

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

func (*PendingEntityChange) EqualVT

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

func (*PendingEntityChange) GetChangePeerId

func (x *PendingEntityChange) GetChangePeerId() string

func (*PendingEntityChange) GetDomainIdentifier

func (x *PendingEntityChange) GetDomainIdentifier() string

func (*PendingEntityChange) GetEntityChangeData

func (x *PendingEntityChange) GetEntityChangeData() string

func (*PendingEntityChange) GetEntityChangeType

func (x *PendingEntityChange) GetEntityChangeType() EntityChangeType

func (*PendingEntityChange) GetEpoch

func (x *PendingEntityChange) GetEpoch() uint64

func (*PendingEntityChange) MarshalJSON

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

MarshalJSON marshals the PendingEntityChange to JSON.

func (*PendingEntityChange) MarshalProtoJSON

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

MarshalProtoJSON marshals the PendingEntityChange message to JSON.

func (*PendingEntityChange) MarshalProtoText

func (x *PendingEntityChange) MarshalProtoText() string

func (*PendingEntityChange) MarshalToSizedBufferVT

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

func (*PendingEntityChange) MarshalToVT

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

func (*PendingEntityChange) MarshalVT

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

func (*PendingEntityChange) ProtoMessage

func (*PendingEntityChange) ProtoMessage()

func (*PendingEntityChange) Reset

func (x *PendingEntityChange) Reset()

func (*PendingEntityChange) SizeVT

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

func (*PendingEntityChange) String

func (x *PendingEntityChange) String() string

func (*PendingEntityChange) UnmarshalJSON

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

UnmarshalJSON unmarshals the PendingEntityChange from JSON.

func (*PendingEntityChange) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the PendingEntityChange message from JSON.

func (*PendingEntityChange) UnmarshalVT

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

type PromptPassword

type PromptPassword interface {
	// Directive indicates this is a directive.
	directive.Directive

	// PromptPasswordDomainID is the identity domain id.
	PromptPasswordDomainID() string
	// PromptPasswordReason is the description to show users.
	PromptPasswordReason() string
	// PromptPasswordReasonDetail is additional description to show users.
	PromptPasswordReasonDetail() string
	// PromptPasswordCb is the callback to call with the result.
	PromptPasswordCb(val string)
	// PromptPasswordPrevError is the error for the previous attempt.
	// Usually nil.
	PromptPasswordPrevError() error
}

PromptPassword asks the user to enter a password to derive a key.

func NewPromptPassword

func NewPromptPassword(domainID, reason, reasonDetail string, cb PromptPasswordCb, prevErr error) PromptPassword

NewPromptPassword constructs a new PromptPassword directive.

type PromptPasswordCb

type PromptPasswordCb func(dir PromptPassword, val string)

PromptPasswordCb is the callback to call with the result.

type PromptPasswordValue

type PromptPasswordValue struct{}

PromptPasswordValue is a result of the PromptPassword directive. Note: this is not used, the callback is called instead.

type RegisterKeypair

type RegisterKeypair struct {

	// The public key is derivable from the peer ID.
	// Only one Keypair with this public key / peer ID can be used.
	RegisterPeerId string `protobuf:"bytes,1,opt,name=register_peer_id,json=registerPeerId,proto3" json:"registerPeerId,omitempty"`
	// AuthMethodId is the authentication method to use.
	AuthMethodId string `protobuf:"bytes,2,opt,name=auth_method_id,json=authMethodId,proto3" json:"authMethodId,omitempty"`
	// AuthMethodState is the encoded change state object for the method.
	//
	// State might include the CTAP2 challenge, for example.
	AuthMethodState []byte `protobuf:"bytes,3,opt,name=auth_method_state,json=authMethodState,proto3" json:"authMethodState,omitempty"`
	// contains filtered or unexported fields
}

RegisterKeypair is used when adding a new keypair to a entity.

EntityChangeType_REGISTER_KEYPAIR

func (*RegisterKeypair) CloneMessageVT

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

func (*RegisterKeypair) CloneVT

func (m *RegisterKeypair) CloneVT() *RegisterKeypair

func (*RegisterKeypair) EqualMessageVT

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

func (*RegisterKeypair) EqualVT

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

func (*RegisterKeypair) GetAuthMethodId

func (x *RegisterKeypair) GetAuthMethodId() string

func (*RegisterKeypair) GetAuthMethodState

func (x *RegisterKeypair) GetAuthMethodState() []byte

func (*RegisterKeypair) GetRegisterPeerId

func (x *RegisterKeypair) GetRegisterPeerId() string

func (*RegisterKeypair) MarshalJSON

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

MarshalJSON marshals the RegisterKeypair to JSON.

func (*RegisterKeypair) MarshalProtoJSON

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

MarshalProtoJSON marshals the RegisterKeypair message to JSON.

func (*RegisterKeypair) MarshalProtoText

func (x *RegisterKeypair) MarshalProtoText() string

func (*RegisterKeypair) MarshalToSizedBufferVT

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

func (*RegisterKeypair) MarshalToVT

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

func (*RegisterKeypair) MarshalVT

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

func (*RegisterKeypair) ProtoMessage

func (*RegisterKeypair) ProtoMessage()

func (*RegisterKeypair) Reset

func (x *RegisterKeypair) Reset()

func (*RegisterKeypair) SizeVT

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

func (*RegisterKeypair) String

func (x *RegisterKeypair) String() string

func (*RegisterKeypair) UnmarshalJSON

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

UnmarshalJSON unmarshals the RegisterKeypair from JSON.

func (*RegisterKeypair) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the RegisterKeypair message from JSON.

func (*RegisterKeypair) UnmarshalVT

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

type RemoveKeypair

type RemoveKeypair struct {

	// PeerId is the peer ID to remove from the existing keypairs.
	PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"`
	// contains filtered or unexported fields
}

RemoveKeypair is used to remove a keypair by peer ID from the entity.

EntityChangeType_REMOVE_KEYPAIR

func (*RemoveKeypair) CloneMessageVT

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

func (*RemoveKeypair) CloneVT

func (m *RemoveKeypair) CloneVT() *RemoveKeypair

func (*RemoveKeypair) EqualMessageVT

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

func (*RemoveKeypair) EqualVT

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

func (*RemoveKeypair) GetPeerId

func (x *RemoveKeypair) GetPeerId() string

func (*RemoveKeypair) MarshalJSON

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

MarshalJSON marshals the RemoveKeypair to JSON.

func (*RemoveKeypair) MarshalProtoJSON

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

MarshalProtoJSON marshals the RemoveKeypair message to JSON.

func (*RemoveKeypair) MarshalProtoText

func (x *RemoveKeypair) MarshalProtoText() string

func (*RemoveKeypair) MarshalToSizedBufferVT

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

func (*RemoveKeypair) MarshalToVT

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

func (*RemoveKeypair) MarshalVT

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

func (*RemoveKeypair) ProtoMessage

func (*RemoveKeypair) ProtoMessage()

func (*RemoveKeypair) Reset

func (x *RemoveKeypair) Reset()

func (*RemoveKeypair) SizeVT

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

func (*RemoveKeypair) String

func (x *RemoveKeypair) String() string

func (*RemoveKeypair) UnmarshalJSON

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

UnmarshalJSON unmarshals the RemoveKeypair from JSON.

func (*RemoveKeypair) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the RemoveKeypair message from JSON.

func (*RemoveKeypair) UnmarshalVT

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

type SelectEntityId

type SelectEntityId interface {
	// Directive indicates this is a directive.
	directive.Directive

	// SelectEntityIdPurpose is the purpose of the SelectEntityId.
	// Current: "auth"
	SelectEntityIdPurpose() string
	// SelectEntityIdDomainID is the domain id to select an entity.
	SelectEntityIdDomainID() string
	// SelectEntityIdPrevError is the error for the previous attempt.
	// Usually empty.
	SelectEntityIdPrevError() error
}

SelectEntityId asks the user to enter a entity id in a domain.

func NewSelectEntityId

func NewSelectEntityId(purpose, domainID string, prevErr error) SelectEntityId

NewSelectEntityId constructs a new SelectEntityId directive.

type SelectEntityIdController

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

SelectEntityIdController is a controller that resolves SelectEntityId.

func NewSelectEntityIdController

func NewSelectEntityIdController(entityID string) *SelectEntityIdController

NewSelectEntityIdController constructs a new SelectEntityIdController.

func (*SelectEntityIdController) Close

func (c *SelectEntityIdController) Close() error

Close releases any resources used by the controller. Error indicates any issue encountered releasing.

func (*SelectEntityIdController) Execute

Execute executes the controller goroutine.

func (*SelectEntityIdController) GetControllerInfo

func (c *SelectEntityIdController) GetControllerInfo() *controller.Info

GetControllerInfo returns information about the controller.

func (*SelectEntityIdController) HandleDirective

HandleDirective asks if the handler can resolve the directive.

type SelectEntityIdValue

type SelectEntityIdValue = string

SelectEntityIdValue is the result of the SelectEntityId directive. Note: the pointer might be nil if no entity was selected.

func ExSelectEntityId

func ExSelectEntityId(ctx context.Context, b bus.Bus, purpose, domainID string, prevErr error) (SelectEntityIdValue, error)

ExSelectEntityId executes the select entity id directive.

type SelectIdentityEntity

type SelectIdentityEntity interface {
	// Directive indicates this is a directive.
	directive.Directive

	// SelectIdentityEntityPurpose is the purpose of the SelectIdentityEntity.
	// Current: "auth"
	SelectIdentityEntityPurpose() string
	// SelectIdentityEntityDomainID is the domain id to select an entity.
	SelectIdentityEntityDomainID() string
	// SelectIdentityEntityPrevError is the error for the previous attempt.
	// Usually nil.
	SelectIdentityEntityPrevError() error
}

SelectIdentityEntity asks the domain controller to select an entity.

func NewSelectIdentityEntity

func NewSelectIdentityEntity(purpose, domainID string, prevErr error) SelectIdentityEntity

NewSelectIdentityEntity constructs a new SelectIdentityEntity directive.

type SelectIdentityEntityValue

type SelectIdentityEntityValue = *Entity

SelectIdentityEntityValue is the result of the SelectIdentityEntity directive. Note: the pointer might be nil if no entity was selected.

func ExSelectIdentityEntity

func ExSelectIdentityEntity(
	ctx context.Context,
	b bus.Bus,
	purpose string,
	domainID string,
	prevErr error,
) (SelectIdentityEntityValue, error)

ExSelectIdentityEntity executes the select entity directive.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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