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

session

package
v0.57.28 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SessionType_name = map[int32]string{
		0: "SESSION_TYPE_UNKNOWN",
		1: "SESSION_TYPE_USER",
		2: "SESSION_TYPE_APP",
		3: "SESSION_TYPE_DEVICE",
		4: "SESSION_TYPE_SERVICE",
	}
	SessionType_value = map[string]int32{
		"SESSION_TYPE_UNKNOWN": 0,
		"SESSION_TYPE_USER":    1,
		"SESSION_TYPE_APP":     2,
		"SESSION_TYPE_DEVICE":  3,
		"SESSION_TYPE_SERVICE": 4,
	}
)

Enum value maps for SessionType.

View Source
var (
	SessionLockMode_name = map[int32]string{
		0: "SESSION_LOCK_MODE_AUTO_UNLOCK",
		1: "SESSION_LOCK_MODE_PIN_ENCRYPTED",
	}
	SessionLockMode_value = map[string]int32{
		"SESSION_LOCK_MODE_AUTO_UNLOCK":   0,
		"SESSION_LOCK_MODE_PIN_ENCRYPTED": 1,
	}
)

Enum value maps for SessionLockMode.

View Source
var (
	SessionRecoveryState_name = map[int32]string{
		0: "SESSION_RECOVERY_STATE_UNKNOWN",
		1: "SESSION_RECOVERY_STATE_AVAILABLE",
		2: "SESSION_RECOVERY_STATE_UNAVAILABLE",
	}
	SessionRecoveryState_value = map[string]int32{
		"SESSION_RECOVERY_STATE_UNKNOWN":     0,
		"SESSION_RECOVERY_STATE_AVAILABLE":   1,
		"SESSION_RECOVERY_STATE_UNAVAILABLE": 2,
	}
)

Enum value maps for SessionRecoveryState.

View Source
var ErrSessionNotFound = errors.New("session not found")

ErrSessionNotFound is returned if the session was not found.

Functions

func ExtractPublicKeyFromPeerID

func ExtractPublicKeyFromPeerID(peerID string) (crypto.PubKey, error)

ExtractPublicKeyFromPeerID decodes a base58 peer ID and extracts its public key.

func NewSessionRefBlock

func NewSessionRefBlock() block.Block

NewSessionRefBlock constructs a new SessionRef block.

Types

type BackgroundPlugin

type BackgroundPlugin struct {

	// SpaceId is the shared object ID of the Space.
	SpaceId string `protobuf:"bytes,1,opt,name=space_id,json=spaceId,proto3" json:"spaceId,omitempty"`
	// PluginId is the manifest ID of the plugin.
	PluginId string `protobuf:"bytes,2,opt,name=plugin_id,json=pluginId,proto3" json:"pluginId,omitempty"`
	// Suspended keeps the confirmation while the plugin does not run in the
	// background.
	Suspended bool `protobuf:"varint,3,opt,name=suspended,proto3" json:"suspended,omitempty"`
	// contains filtered or unexported fields
}

BackgroundPlugin is a user's confirmation that one plugin of one Space may run in the background.

func (*BackgroundPlugin) CloneMessageVT

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

func (*BackgroundPlugin) CloneVT

func (m *BackgroundPlugin) CloneVT() *BackgroundPlugin

func (*BackgroundPlugin) EqualMessageVT

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

func (*BackgroundPlugin) EqualVT

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

func (*BackgroundPlugin) GetPluginId

func (x *BackgroundPlugin) GetPluginId() string

func (*BackgroundPlugin) GetSpaceId

func (x *BackgroundPlugin) GetSpaceId() string

func (*BackgroundPlugin) GetSuspended

func (x *BackgroundPlugin) GetSuspended() bool

func (*BackgroundPlugin) MarshalJSON

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

MarshalJSON marshals the BackgroundPlugin to JSON.

func (*BackgroundPlugin) MarshalProtoJSON

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

MarshalProtoJSON marshals the BackgroundPlugin message to JSON.

func (*BackgroundPlugin) MarshalProtoText

func (x *BackgroundPlugin) MarshalProtoText() string

func (*BackgroundPlugin) MarshalToSizedBufferVT

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

func (*BackgroundPlugin) MarshalToVT

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

func (*BackgroundPlugin) MarshalVT

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

func (*BackgroundPlugin) ProtoMessage

func (*BackgroundPlugin) ProtoMessage()

func (*BackgroundPlugin) Reset

func (x *BackgroundPlugin) Reset()

func (*BackgroundPlugin) SizeVT

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

func (*BackgroundPlugin) String

func (x *BackgroundPlugin) String() string

func (*BackgroundPlugin) UnmarshalJSON

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

UnmarshalJSON unmarshals the BackgroundPlugin from JSON.

func (*BackgroundPlugin) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the BackgroundPlugin message from JSON.

func (*BackgroundPlugin) UnmarshalVT

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

type EntityCredential

type EntityCredential struct {

	// Types that are assignable to Credential:
	//	*EntityCredential_Password
	//	*EntityCredential_PemPrivateKey
	Credential isEntityCredential_Credential `protobuf_oneof:"credential"`
	// contains filtered or unexported fields
}

EntityCredential is a credential for deriving an entity private key. Used by local in-process RPCs where the credential never crosses a network boundary (Go WASM and TS share the same browser process).

func (*EntityCredential) CloneMessageVT

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

func (*EntityCredential) CloneVT

func (m *EntityCredential) CloneVT() *EntityCredential

func (*EntityCredential) EqualMessageVT

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

func (*EntityCredential) EqualVT

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

func (*EntityCredential) GetCredential

func (m *EntityCredential) GetCredential() isEntityCredential_Credential

func (*EntityCredential) GetPassword

func (x *EntityCredential) GetPassword() string

func (*EntityCredential) GetPemPrivateKey

func (x *EntityCredential) GetPemPrivateKey() []byte

func (*EntityCredential) MarshalJSON

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

MarshalJSON marshals the EntityCredential to JSON.

func (*EntityCredential) MarshalProtoJSON

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

MarshalProtoJSON marshals the EntityCredential message to JSON.

func (*EntityCredential) MarshalProtoText

func (x *EntityCredential) MarshalProtoText() string

func (*EntityCredential) MarshalToSizedBufferVT

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

func (*EntityCredential) MarshalToVT

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

func (*EntityCredential) MarshalVT

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

func (*EntityCredential) ProtoMessage

func (*EntityCredential) ProtoMessage()

func (*EntityCredential) Reset

func (x *EntityCredential) Reset()

func (*EntityCredential) SizeVT

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

func (*EntityCredential) String

func (x *EntityCredential) String() string

func (*EntityCredential) UnmarshalJSON

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

UnmarshalJSON unmarshals the EntityCredential from JSON.

func (*EntityCredential) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the EntityCredential message from JSON.

func (*EntityCredential) UnmarshalVT

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

type EntityCredential_Password

type EntityCredential_Password struct {
	// Password derives the entity key via triplesec(username, password).
	Password string `protobuf:"bytes,1,opt,name=password,proto3,oneof"`
}

func (*EntityCredential_Password) CloneOneofVT

func (m *EntityCredential_Password) CloneOneofVT() isEntityCredential_Credential

func (*EntityCredential_Password) CloneVT

func (*EntityCredential_Password) EqualVT

func (this *EntityCredential_Password) EqualVT(thatIface isEntityCredential_Credential) bool

func (*EntityCredential_Password) MarshalToSizedBufferVT

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

func (*EntityCredential_Password) MarshalToVT

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

func (*EntityCredential_Password) SizeVT

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

type EntityCredential_PemPrivateKey

type EntityCredential_PemPrivateKey struct {
	// PemPrivateKey is the entity private key in PEM format.
	PemPrivateKey []byte `protobuf:"bytes,2,opt,name=pem_private_key,json=pemPrivateKey,proto3,oneof"`
}

func (*EntityCredential_PemPrivateKey) CloneOneofVT

func (m *EntityCredential_PemPrivateKey) CloneOneofVT() isEntityCredential_Credential

func (*EntityCredential_PemPrivateKey) CloneVT

func (*EntityCredential_PemPrivateKey) EqualVT

func (this *EntityCredential_PemPrivateKey) EqualVT(thatIface isEntityCredential_Credential) bool

func (*EntityCredential_PemPrivateKey) MarshalToSizedBufferVT

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

func (*EntityCredential_PemPrivateKey) MarshalToVT

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

func (*EntityCredential_PemPrivateKey) SizeVT

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

type EntityKeypair

type EntityKeypair struct {

	// PeerId is the peer ID associated with this keypair.
	PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"`
	// AuthMethod is the authentication method.
	AuthMethod string `protobuf:"bytes,2,opt,name=auth_method,json=authMethod,proto3" json:"authMethod,omitempty"`
	// AuthParams is optional authentication parameters.
	AuthParams []byte `protobuf:"bytes,3,opt,name=auth_params,json=authParams,proto3" json:"authParams,omitempty"`
	// contains filtered or unexported fields
}

EntityKeypair is a keypair associated with an entity for authentication.

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) GetAuthMethod

func (x *EntityKeypair) GetAuthMethod() string

func (*EntityKeypair) GetAuthParams

func (x *EntityKeypair) GetAuthParams() []byte

func (*EntityKeypair) GetPeerId

func (x *EntityKeypair) GetPeerId() string

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) 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

type LookupSessionController

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

	// LookupSessionControllerID returns the session controller id to lookup.
	// Empty to return all.
	LookupSessionControllerID() string
}

LookupSessionController is a directive to look up a session controller.

func NewLookupSessionController

func NewLookupSessionController(id string) LookupSessionController

NewLookupSessionController constructs a new LookupSessionController directive.

type LookupSessionControllerValue

type LookupSessionControllerValue = SessionController

LookupSessionControllerValue is the result type for LookupSessionController.

type MountSession

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

	// MountSessionRef returns the session ref to mount.
	MountSessionRef() *SessionRef
}

MountSession is a directive to mount a provider account and session.

func NewMountSession

func NewMountSession(ref *SessionRef) MountSession

NewMountSession constructs a new MountSession directive.

type MountSessionValue

type MountSessionValue = Session

MountSessionValue is the result type for MountSession.

type Session

type Session interface {
	// GetBus returns the bus used by the session.
	GetBus() bus.Bus

	// GetSessionRef returns the ref to the session.
	GetSessionRef() *SessionRef

	// GetPeerId returns the peer id used by the session.
	GetPeerId() peer.ID

	// GetPrivKey returns the session private key.
	// Returns nil if the session is locked.
	GetPrivKey() crypto.PrivKey

	// GetProviderAccount returns the handle to the session provider account.
	GetProviderAccount() provider.ProviderAccount

	// AccessStateAtomStore gets or creates a shared session state atom store.
	AccessStateAtomStore(ctx context.Context, storeID string) (resource_state.StateAtomStore, error)

	// SnapshotStateAtomStoreIDs returns the known session state atom store ids.
	SnapshotStateAtomStoreIDs(ctx context.Context) ([]string, error)

	// WatchStateAtomStoreIDs watches the known session state atom store ids.
	WatchStateAtomStoreIDs(ctx context.Context, cb func(storeIDs []string) error) error

	// GetLockState returns the current lock mode and whether the session is locked.
	GetLockState(ctx context.Context) (SessionLockMode, bool, error)

	// WatchLockState calls the callback with the current lock state and on changes.
	// Blocks until ctx is canceled or an error occurs.
	WatchLockState(ctx context.Context, cb func(mode SessionLockMode, locked bool)) error

	// UnlockSession unlocks a PIN-locked session with the given PIN.
	UnlockSession(ctx context.Context, pin []byte) error

	// SetLockMode changes the session lock mode.
	// Pin is required when mode is PIN_ENCRYPTED.
	SetLockMode(ctx context.Context, mode SessionLockMode, pin []byte) error

	// LockSession locks a running session, scrubbing the privkey and
	// requiring PIN re-entry. Only works when PIN mode is configured.
	LockSession(ctx context.Context) error
}

Session is a handle referring to an active session.

func ExMountSession

func ExMountSession(
	ctx context.Context,
	b bus.Bus,
	ref *SessionRef,
	returnIfIdle bool,
	valDisposeCb func(),
) (Session, directive.Reference, error)

ExMountSession executes a lookup for a single provider on the bus.

If returnIfIdle is set, returns when the directive becomes idle.

type SessionController

type SessionController interface {
	// GetSessionByIdx looks up the given session index.
	// Returns nil, nil if not found.
	GetSessionByIdx(ctx context.Context, idx uint32) (*SessionListEntry, error)
	// ListSessions lists the sessions in storage.
	ListSessions(ctx context.Context) ([]*SessionListEntry, error)
	// RegisterSession registers a session ref in storage or returns the existing matching entry.
	// If metadata is non-nil, it is written to the session controller ObjectStore.
	RegisterSession(ctx context.Context, ref *SessionRef, metadata *SessionMetadata) (*SessionListEntry, error)
	// TrackSession registers a mounted lifetime's stop function until the returned release is called.
	// DeleteSession calls stop and waits for it to release the Session's resources.
	// stop must tolerate concurrent calls from repeated deletions.
	// A lifetime may be tracked before registration while a provider completes login.
	TrackSession(ref *SessionRef, stop func(context.Context) error) func()
	// DeleteSession removes the registration and waits for tracked lifetimes to stop.
	// Returns nil if neither a registration nor a tracked lifetime exists.
	DeleteSession(ctx context.Context, ref *SessionRef) error
	// GetSessionMetadata returns the metadata for a session by index.
	// Returns nil, nil if not found.
	GetSessionMetadata(ctx context.Context, idx uint32) (*SessionMetadata, error)
	// UpdateSessionMetadata updates the metadata for a session by ref.
	// Creates the metadata entry if it does not exist.
	UpdateSessionMetadata(ctx context.Context, ref *SessionRef, metadata *SessionMetadata) error
	// GetSessionBroadcast returns the broadcast that fires when sessions change.
	GetSessionBroadcast() *broadcast.Broadcast
}

SessionController is the session list controller.

func ExLookupSessionController

func ExLookupSessionController(
	ctx context.Context,
	b bus.Bus,
	id string,
	returnIfIdle bool,
	valDisposeCb func(),
) (SessionController, directive.Reference, error)

ExLookupSessionController executes a lookup for a single session controller on the bus.

id should be set to filter to a specific session controller id If waitOne is set, waits for at least one value before returning. Returns when the directive becomes idle.

type SessionListEntry

type SessionListEntry struct {

	// SessionIndex is the index of the session.
	// The session is accessible at /u/{session-index}/...
	SessionIndex uint32 `protobuf:"varint,1,opt,name=session_index,json=sessionIndex,proto3" json:"sessionIndex,omitempty"`
	// SessionRef is the reference to the session.
	SessionRef *SessionRef `protobuf:"bytes,2,opt,name=session_ref,json=sessionRef,proto3" json:"sessionRef,omitempty"`
	// contains filtered or unexported fields
}

SessionListEntry is an entry in the local session list.

func (*SessionListEntry) CloneMessageVT

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

func (*SessionListEntry) CloneVT

func (m *SessionListEntry) CloneVT() *SessionListEntry

func (*SessionListEntry) EqualMessageVT

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

func (*SessionListEntry) EqualVT

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

func (*SessionListEntry) GetSessionIndex

func (x *SessionListEntry) GetSessionIndex() uint32

func (*SessionListEntry) GetSessionRef

func (x *SessionListEntry) GetSessionRef() *SessionRef

func (*SessionListEntry) MarshalJSON

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

MarshalJSON marshals the SessionListEntry to JSON.

func (*SessionListEntry) MarshalProtoJSON

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

MarshalProtoJSON marshals the SessionListEntry message to JSON.

func (*SessionListEntry) MarshalProtoText

func (x *SessionListEntry) MarshalProtoText() string

func (*SessionListEntry) MarshalToSizedBufferVT

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

func (*SessionListEntry) MarshalToVT

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

func (*SessionListEntry) MarshalVT

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

func (*SessionListEntry) ProtoMessage

func (*SessionListEntry) ProtoMessage()

func (*SessionListEntry) Reset

func (x *SessionListEntry) Reset()

func (*SessionListEntry) SizeVT

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

func (*SessionListEntry) String

func (x *SessionListEntry) String() string

func (*SessionListEntry) UnmarshalJSON

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

UnmarshalJSON unmarshals the SessionListEntry from JSON.

func (*SessionListEntry) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the SessionListEntry message from JSON.

func (*SessionListEntry) UnmarshalVT

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

type SessionLockMode

type SessionLockMode int32

SessionLockMode identifies how a session private key is protected at rest.

const (
	// SESSION_LOCK_MODE_AUTO_UNLOCK is encrypted with volume-derived key.
	SessionLockMode_SESSION_LOCK_MODE_AUTO_UNLOCK SessionLockMode = 0
	// SESSION_LOCK_MODE_PIN_ENCRYPTED is encrypted with PIN-derived key.
	SessionLockMode_SESSION_LOCK_MODE_PIN_ENCRYPTED SessionLockMode = 1
)

func (SessionLockMode) Enum

func (x SessionLockMode) Enum() *SessionLockMode

func (SessionLockMode) MarshalJSON

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

MarshalJSON marshals the SessionLockMode to JSON.

func (SessionLockMode) MarshalProtoJSON

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

MarshalProtoJSON marshals the SessionLockMode to JSON.

func (SessionLockMode) MarshalProtoText

func (x SessionLockMode) MarshalProtoText() string

func (SessionLockMode) MarshalText

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

MarshalText marshals the SessionLockMode to text.

func (SessionLockMode) String

func (x SessionLockMode) String() string

func (*SessionLockMode) UnmarshalJSON

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

UnmarshalJSON unmarshals the SessionLockMode from JSON.

func (*SessionLockMode) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the SessionLockMode from JSON.

func (*SessionLockMode) UnmarshalText

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

UnmarshalText unmarshals the SessionLockMode from text.

type SessionMetadata

type SessionMetadata struct {

	// DisplayName is the display name for the session (username/entity_id).
	DisplayName string `protobuf:"bytes,1,opt,name=display_name,json=displayName,proto3" json:"displayName,omitempty"`
	// ProviderDisplayName is the display name of the provider.
	ProviderDisplayName string `protobuf:"bytes,2,opt,name=provider_display_name,json=providerDisplayName,proto3" json:"providerDisplayName,omitempty"`
	// ProviderAccountId is the provider account identifier.
	ProviderAccountId string `protobuf:"bytes,3,opt,name=provider_account_id,json=providerAccountId,proto3" json:"providerAccountId,omitempty"`
	// LockMode is set at registration and updated by SetLockMode.
	// Used as a pre-mount hint to show the PIN overlay before the session mounts.
	// The authoritative lock state comes from WatchLockState on the mounted session.
	LockMode SessionLockMode `protobuf:"varint,4,opt,name=lock_mode,json=lockMode,proto3" json:"lockMode,omitempty"`
	// CreatedAt is the creation timestamp in milliseconds since epoch.
	CreatedAt int64 `protobuf:"varint,5,opt,name=created_at,json=createdAt,proto3" json:"createdAt,omitempty"`
	// CloudAccountId is the cloud account ULID for free local sessions.
	// Set when a local session is created with a cloud identity.
	CloudAccountId string `protobuf:"bytes,7,opt,name=cloud_account_id,json=cloudAccountId,proto3" json:"cloudAccountId,omitempty"`
	// CloudEntityId is the cloud username for free local sessions.
	CloudEntityId string `protobuf:"bytes,8,opt,name=cloud_entity_id,json=cloudEntityId,proto3" json:"cloudEntityId,omitempty"`
	// ProviderId is the provider type identifier (e.g. "spacewave", "local").
	ProviderId string `protobuf:"bytes,10,opt,name=provider_id,json=providerId,proto3" json:"providerId,omitempty"`
	// RecoveryState reports whether the PIN reset path can recover this session.
	RecoveryState SessionRecoveryState `protobuf:"varint,11,opt,name=recovery_state,json=recoveryState,proto3" json:"recoveryState,omitempty"`
	// DirectP2PDisabled opts this Session out of direct peer transport.
	// The zero value preserves direct P2P for existing Session metadata.
	DirectP2PDisabled bool `protobuf:"varint,12,opt,name=direct_p2p_disabled,json=directP2pDisabled,proto3" json:"directP2pDisabled,omitempty"`
	// BackgroundPlugins lists the plugins the user confirmed to run in the
	// background, sorted by Space and plugin ID. The Session keeps each listed
	// Space's plugins running while the Session runs.
	BackgroundPlugins []*BackgroundPlugin `protobuf:"bytes,13,rep,name=background_plugins,json=backgroundPlugins,proto3" json:"backgroundPlugins,omitempty"`
	// contains filtered or unexported fields
}

SessionMetadata contains display and pre-mount lock information for a session. Stored in the session controller ObjectStore at sessions/meta/{sessionID}.

func LookupSessionMetadata

func LookupSessionMetadata(
	ctx context.Context,
	ctrl SessionController,
	ref *SessionRef,
) (*SessionMetadata, error)

LookupSessionMetadata returns the metadata of the Session registered under ref, or nil if no registered Session matches.

func (*SessionMetadata) CloneMessageVT

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

func (*SessionMetadata) CloneVT

func (m *SessionMetadata) CloneVT() *SessionMetadata

func (*SessionMetadata) EqualMessageVT

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

func (*SessionMetadata) EqualVT

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

func (*SessionMetadata) GetBackgroundPlugins

func (x *SessionMetadata) GetBackgroundPlugins() []*BackgroundPlugin

func (*SessionMetadata) GetCloudAccountId

func (x *SessionMetadata) GetCloudAccountId() string

func (*SessionMetadata) GetCloudEntityId

func (x *SessionMetadata) GetCloudEntityId() string

func (*SessionMetadata) GetCreatedAt

func (x *SessionMetadata) GetCreatedAt() int64

func (*SessionMetadata) GetDirectP2PDisabled added in v0.56.1

func (x *SessionMetadata) GetDirectP2PDisabled() bool

func (*SessionMetadata) GetDisplayName

func (x *SessionMetadata) GetDisplayName() string

func (*SessionMetadata) GetLockMode

func (x *SessionMetadata) GetLockMode() SessionLockMode

func (*SessionMetadata) GetProviderAccountId

func (x *SessionMetadata) GetProviderAccountId() string

func (*SessionMetadata) GetProviderDisplayName

func (x *SessionMetadata) GetProviderDisplayName() string

func (*SessionMetadata) GetProviderId

func (x *SessionMetadata) GetProviderId() string

func (*SessionMetadata) GetRecoveryState added in v0.54.0

func (x *SessionMetadata) GetRecoveryState() SessionRecoveryState

func (*SessionMetadata) MarshalJSON

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

MarshalJSON marshals the SessionMetadata to JSON.

func (*SessionMetadata) MarshalProtoJSON

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

MarshalProtoJSON marshals the SessionMetadata message to JSON.

func (*SessionMetadata) MarshalProtoText

func (x *SessionMetadata) MarshalProtoText() string

func (*SessionMetadata) MarshalToSizedBufferVT

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

func (*SessionMetadata) MarshalToVT

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

func (*SessionMetadata) MarshalVT

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

func (*SessionMetadata) ProtoMessage

func (*SessionMetadata) ProtoMessage()

func (*SessionMetadata) Reset

func (x *SessionMetadata) Reset()

func (*SessionMetadata) SetBackgroundPlugin

func (m *SessionMetadata) SetBackgroundPlugin(spaceID, pluginID string, bp *BackgroundPlugin)

SetBackgroundPlugin replaces the confirmation for one plugin of one Space, or removes it when bp is nil, keeping BackgroundPlugins sorted and free of duplicates.

func (*SessionMetadata) SizeVT

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

func (*SessionMetadata) String

func (x *SessionMetadata) String() string

func (*SessionMetadata) UnmarshalJSON

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

UnmarshalJSON unmarshals the SessionMetadata from JSON.

func (*SessionMetadata) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the SessionMetadata message from JSON.

func (*SessionMetadata) UnmarshalVT

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

type SessionProvider

type SessionProvider interface {
	provider.ProviderAccountFeature

	// MountSession attempts to mount a Session returning the handle and a release function.
	//
	// note: use the MountSession directive to call this.
	// usually called by the provider controller
	MountSession(ctx context.Context, ref *SessionRef, released func()) (Session, func(), error)

	// UnlockPINSession unlocks a PIN-locked session before it is mounted.
	// Reads the PIN lock files, decrypts the session key with the PIN,
	// and unblocks the session tracker so mounting can proceed.
	UnlockPINSession(ctx context.Context, ref *SessionRef, pin []byte) error

	// GetPINSessionRecoveryState reports whether ResetPINSession can recover
	// the session without the current PIN.
	GetPINSessionRecoveryState(ctx context.Context, ref *SessionRef) (SessionRecoveryState, error)

	// ResetPINSession resets a PIN-locked session according to the provider's
	// recovery model. Local providers require a credential and preserve the
	// session identity through envelope recovery; cloud providers may clear the
	// lock and allow a replacement key on the next mount.
	ResetPINSession(ctx context.Context, ref *SessionRef, cred *EntityCredential) error
}

SessionProvider implements ProviderFeature_SESSION.

func GetSessionProviderAccountFeature

func GetSessionProviderAccountFeature(ctx context.Context, provAcc provider.ProviderAccount) (SessionProvider, error)

GetSessionProviderAccountFeature returns the SessionProvider for a ProviderAccount.

type SessionRecoveryState added in v0.54.0

type SessionRecoveryState int32

SessionRecoveryState identifies whether a PIN-locked session has a reset path.

const (
	// SESSION_RECOVERY_STATE_UNKNOWN means the reset path has not been inspected.
	SessionRecoveryState_SESSION_RECOVERY_STATE_UNKNOWN SessionRecoveryState = 0
	// SESSION_RECOVERY_STATE_AVAILABLE means ResetSession can recover without the current PIN.
	SessionRecoveryState_SESSION_RECOVERY_STATE_AVAILABLE SessionRecoveryState = 1
	// SESSION_RECOVERY_STATE_UNAVAILABLE means the current PIN is the only unlock method.
	SessionRecoveryState_SESSION_RECOVERY_STATE_UNAVAILABLE SessionRecoveryState = 2
)

func (SessionRecoveryState) Enum added in v0.54.0

func (SessionRecoveryState) MarshalJSON added in v0.54.0

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

MarshalJSON marshals the SessionRecoveryState to JSON.

func (SessionRecoveryState) MarshalProtoJSON added in v0.54.0

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

MarshalProtoJSON marshals the SessionRecoveryState to JSON.

func (SessionRecoveryState) MarshalProtoText added in v0.54.0

func (x SessionRecoveryState) MarshalProtoText() string

func (SessionRecoveryState) MarshalText added in v0.54.0

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

MarshalText marshals the SessionRecoveryState to text.

func (SessionRecoveryState) String added in v0.54.0

func (x SessionRecoveryState) String() string

func (*SessionRecoveryState) UnmarshalJSON added in v0.54.0

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

UnmarshalJSON unmarshals the SessionRecoveryState from JSON.

func (*SessionRecoveryState) UnmarshalProtoJSON added in v0.54.0

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

UnmarshalProtoJSON unmarshals the SessionRecoveryState from JSON.

func (*SessionRecoveryState) UnmarshalText added in v0.54.0

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

UnmarshalText unmarshals the SessionRecoveryState from text.

type SessionRef

type SessionRef struct {

	// ProviderResourceRef is the reference to the resource on the provider.
	// Contains the session ID, provider ID and provider account ID.
	// The session ID is the ID for this particular session.
	// The provider account ID is the ID for this user account.
	ProviderResourceRef *provider.ProviderResourceRef `protobuf:"bytes,1,opt,name=provider_resource_ref,json=providerResourceRef,proto3" json:"providerResourceRef,omitempty"`
	// contains filtered or unexported fields
}

SessionRef is a reference to a session managed by a provider.

func UnmarshalSessionRef

func UnmarshalSessionRef(ctx context.Context, bcs *block.Cursor) (*SessionRef, error)

UnmarshalSessionRef unmarshals a SessionRef from a block cursor.

func (*SessionRef) CloneMessageVT

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

func (*SessionRef) CloneVT

func (m *SessionRef) CloneVT() *SessionRef

func (*SessionRef) EqualMessageVT

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

func (*SessionRef) EqualVT

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

func (*SessionRef) GetLogger

func (i *SessionRef) GetLogger(le *logrus.Entry) *logrus.Entry

GetLogger adds debug values to the logger.

func (*SessionRef) GetProviderResourceRef

func (x *SessionRef) GetProviderResourceRef() *provider.ProviderResourceRef

func (*SessionRef) MarshalBlock

func (i *SessionRef) MarshalBlock() ([]byte, error)

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

func (*SessionRef) MarshalJSON

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

MarshalJSON marshals the SessionRef to JSON.

func (*SessionRef) MarshalProtoJSON

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

MarshalProtoJSON marshals the SessionRef message to JSON.

func (*SessionRef) MarshalProtoText

func (x *SessionRef) MarshalProtoText() string

func (*SessionRef) MarshalToSizedBufferVT

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

func (*SessionRef) MarshalToVT

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

func (*SessionRef) MarshalVT

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

func (*SessionRef) ProtoMessage

func (*SessionRef) ProtoMessage()

func (*SessionRef) Reset

func (x *SessionRef) Reset()

func (*SessionRef) SizeVT

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

func (*SessionRef) String

func (x *SessionRef) String() string

func (*SessionRef) UnmarshalBlock

func (i *SessionRef) UnmarshalBlock(data []byte) error

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

func (*SessionRef) UnmarshalJSON

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

UnmarshalJSON unmarshals the SessionRef from JSON.

func (*SessionRef) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the SessionRef message from JSON.

func (*SessionRef) UnmarshalVT

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

func (*SessionRef) Validate

func (i *SessionRef) Validate() error

Validate validates the shared object ref.

type SessionTransitionController

type SessionTransitionController interface {
	// TransitionSession replaces a registered attachment with its accepted destination.
	TransitionSession(context.Context, *SessionRef, *SessionRef) error
}

SessionTransitionController atomically rebinds a registered client after provider migration has durably installed its independent credential.

type SessionType

type SessionType int32

SessionType identifies the type of session.

const (
	// SESSION_TYPE_UNKNOWN is the default unknown session type.
	SessionType_SESSION_TYPE_UNKNOWN SessionType = 0
	// SESSION_TYPE_USER is a human user session.
	SessionType_SESSION_TYPE_USER SessionType = 1
	// SESSION_TYPE_APP is a third-party application session.
	SessionType_SESSION_TYPE_APP SessionType = 2
	// SESSION_TYPE_DEVICE is a linked device session.
	SessionType_SESSION_TYPE_DEVICE SessionType = 3
	// SESSION_TYPE_SERVICE is an automated service session, such as a release
	// pipeline, on an account with no entity keypair.
	SessionType_SESSION_TYPE_SERVICE SessionType = 4
)

func (SessionType) Enum

func (x SessionType) Enum() *SessionType

func (SessionType) MarshalJSON

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

MarshalJSON marshals the SessionType to JSON.

func (SessionType) MarshalProtoJSON

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

MarshalProtoJSON marshals the SessionType to JSON.

func (SessionType) MarshalProtoText

func (x SessionType) MarshalProtoText() string

func (SessionType) MarshalText

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

MarshalText marshals the SessionType to text.

func (SessionType) String

func (x SessionType) String() string

func (*SessionType) UnmarshalJSON

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

UnmarshalJSON unmarshals the SessionType from JSON.

func (*SessionType) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the SessionType from JSON.

func (*SessionType) UnmarshalText

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

UnmarshalText unmarshals the SessionType from text.

type StateAtomStoreIndex

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

StateAtomStoreIndex tracks known state atom store ids for an object store.

func NewStateAtomStoreIndex

func NewStateAtomStoreIndex(objStore object.ObjectStore) *StateAtomStoreIndex

NewStateAtomStoreIndex creates a new StateAtomStoreIndex.

func (*StateAtomStoreIndex) SnapshotStoreIDs

func (s *StateAtomStoreIndex) SnapshotStoreIDs(ctx context.Context) ([]string, error)

SnapshotStoreIDs returns the known state atom store ids.

func (*StateAtomStoreIndex) TrackStoreID

func (s *StateAtomStoreIndex) TrackStoreID(storeID string)

TrackStoreID records a known state atom store id and broadcasts on additions.

func (*StateAtomStoreIndex) WatchStoreIDs

func (s *StateAtomStoreIndex) WatchStoreIDs(
	ctx context.Context,
	cb func(storeIDs []string) error,
) error

WatchStoreIDs watches the known state atom store ids for changes.

Directories

Path Synopsis
Package session_lock provides shared lock/unlock operations for session private keys.
Package session_lock provides shared lock/unlock operations for session private keys.

Jump to

Keyboard shortcuts

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