resource_session

package
v0.51.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSyncStatusSnapshot added in v0.51.2

func BuildSyncStatusSnapshot(
	sess session.Session,
	now time.Time,
) (*s4wave_session.WatchSyncStatusResponse, []<-chan struct{})

BuildSyncStatusSnapshot returns the session sync snapshot and change channels.

Types

type LocalSessionResource

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

LocalSessionResource implements LocalSessionResourceService.

func NewLocalSessionResource

func NewLocalSessionResource(b bus.Bus, sess session.Session) *LocalSessionResource

NewLocalSessionResource creates a new LocalSessionResource.

func (*LocalSessionResource) AddEntityKeypair

AddEntityKeypair derives an entity key from an EntityCredential and adds it to the AccountSettings SharedObject.

func (*LocalSessionResource) ExportBackupKey

ExportBackupKey generates a backup Ed25519 keypair, adds both the password-derived entity keypair and the backup keypair to the AccountSettings SharedObject, and returns the backup private key as PEM. The envelope watcher will automatically rewrap with the new keypairs.

func (*LocalSessionResource) RemoveEntityKeypair

RemoveEntityKeypair removes an entity keypair from the AccountSettings SharedObject.

func (*LocalSessionResource) SetDisplayName

SetDisplayName updates the local provider account display name.

func (*LocalSessionResource) WatchDisplayName

WatchDisplayName streams the local provider account display name.

func (*LocalSessionResource) WatchEntityKeypairs

WatchEntityKeypairs streams entity keypairs from the AccountSettings SO.

type SessionResource

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

SessionResource wraps a core session for resource access.

The lifecycle context ctx scopes any background work owned by this resource. It is canceled by Close when the mount is released.

func NewSessionResource

func NewSessionResource(le *logrus.Entry, b bus.Bus, sess session.Session) *SessionResource

NewSessionResource creates a new SessionResource.

func NewSessionResourceWithHostPluginID added in v0.51.3

func NewSessionResourceWithHostPluginID(
	le *logrus.Entry,
	b bus.Bus,
	sess session.Session,
	hostPluginID string,
) *SessionResource

NewSessionResourceWithHostPluginID creates a new SessionResource with the plugin id that owns the resource root.

func (*SessionResource) AcceptLocalPairingAnswer

AcceptLocalPairingAnswer accepts a remote SDP answer to complete the connection.

func (*SessionResource) AcceptLocalPairingOffer

AcceptLocalPairingOffer accepts a remote SDP offer and returns an answer.

func (*SessionResource) AccessStateAtom

AccessStateAtom accesses a session-scoped state atom resource.

func (*SessionResource) CancelTransfer

CancelTransfer stops an in-progress transfer.

func (*SessionResource) Close

func (r *SessionResource) Close()

Close releases resources owned by this SessionResource. Callers that wrap a SessionResource via resource_server.AddResource should invoke Close from the release callback so the lifecycle context is canceled and any provider-level subscriptions are released.

func (*SessionResource) CompletePairing

CompletePairing resolves a pairing code to link a remote session.

func (*SessionResource) ConfirmPairing

ConfirmPairing confirms a verified pairing, adds the remote peer as OWNER on all SharedObjects, persists the device, and starts P2P sync.

func (*SessionResource) ConfirmSASMatch

ConfirmSASMatch sends the user's SAS emoji verification decision to the bilateral confirmation exchange running over the bifrost link.

func (*SessionResource) CreateLocalPairingOffer

CreateLocalPairingOffer generates a WebRTC SDP offer for no-cloud pairing.

func (*SessionResource) CreateSpace

CreateSpace creates a new space within the ProviderAccount with the Session.

func (*SessionResource) CreateSpaceInvite

CreateSpaceInvite creates an invite for a space shared object.

func (*SessionResource) DeleteAccount

DeleteAccount deletes the entire account associated with this session. Cleans all session keys, removes GC edges, runs volume GC, deletes the volume backing store, and removes all sessions from the list.

func (*SessionResource) DeleteSpace

DeleteSpace deletes a space within the ProviderAccount.

func (*SessionResource) GeneratePairingCode

GeneratePairingCode creates an 8-char pairing code for P2P device linking.

func (*SessionResource) GetActiveTransfer

func (r *SessionResource) GetActiveTransfer() *provider_transfer.Transfer

GetActiveTransfer returns the currently active transfer, or nil if none.

func (*SessionResource) GetMux

func (r *SessionResource) GetMux() srpc.Invoker

GetMux returns the rpc mux.

func (*SessionResource) GetSASEmoji

GetSASEmoji derives SAS emoji for verifying a P2P link with a remote peer.

func (*SessionResource) GetSessionInfo

GetSessionInfo returns information about this session.

func (*SessionResource) GetTransferInventory

GetTransferInventory returns the list of spaces on a session for transfer planning.

func (*SessionResource) GetTransferStatus

GetTransferStatus returns whether a transfer is active or a checkpoint exists.

func (*SessionResource) JoinSpaceViaInvite

JoinSpaceViaInvite joins a space using an out-of-band invite message.

func (*SessionResource) ListSpaceInvites

ListSpaceInvites lists invites on a space shared object.

func (*SessionResource) ListSpaceParticipants

ListSpaceParticipants lists participants on a space shared object.

func (*SessionResource) LockSession

LockSession locks a running session.

func (*SessionResource) MountSharedObject

MountSharedObject mounts a shared object within the session by ID.

func (*SessionResource) RemoveSpaceParticipant

RemoveSpaceParticipant removes a participant from a space shared object by peer ID.

func (*SessionResource) RenameSpace

RenameSpace updates the display name metadata for a space.

func (*SessionResource) RevokeSpaceInvite

RevokeSpaceInvite revokes an invite on a space shared object.

func (*SessionResource) SetCdnLookup

func (r *SessionResource) SetCdnLookup(
	lookup func(sharedObjectID string) (sobject.SharedObject, *sobject.SharedObjectMeta),
)

SetCdnLookup wires a lookup from shared object id to the process-scoped CDN-backed SharedObject and its synthesized metadata. Consulted by MountSharedObject before falling back to the per-session SO list so CDN Spaces (which are filtered out of that list) remain mountable by ULID.

The lookup must return (nil, nil) for ids that are not CDN Spaces. Safe to call once per SessionResource; subsequent calls replace the previous lookup.

func (*SessionResource) SetCdnRootChangedHook

func (r *SessionResource) SetCdnRootChangedHook(hook func(spaceID string))

SetCdnRootChangedHook wires a callback that fires when the session's provider account delivers a cdn-root-changed WS frame. Wired by the enclosing mount path to the root CdnInstance.Refresh() so pushes on the upstream CDN root wake up the process-scoped singleton.

No-op when the session's provider is not spacewave (local-only never receives cdn-root-changed). Safe to call once per SessionResource; a second call releases the second subscription to preserve single ownership.

func (*SessionResource) SetLockMode

SetLockMode changes the session lock mode.

func (*SessionResource) StartTransfer

StartTransfer starts a transfer operation between two sessions.

func (*SessionResource) UnlinkDevice

UnlinkDevice removes a paired device from the account settings SO and revokes its SO participant access.

func (*SessionResource) UnlockSession

UnlockSession unlocks a PIN-locked session.

func (*SessionResource) WatchLockState

WatchLockState streams the current lock state and updates on changes.

func (*SessionResource) WatchPairedDevices

WatchPairedDevices streams the list of paired devices from the account settings SharedObject.

func (*SessionResource) WatchPairingStatus

WatchPairingStatus streams pairing state changes during a device linking flow.

func (*SessionResource) WatchResourcesList

WatchResourcesList returns the list of resources the session has access to.

func (*SessionResource) WatchSharedObjectHealth

WatchSharedObjectHealth streams SharedObject health by SharedObject ID.

func (*SessionResource) WatchStateAtoms

WatchStateAtoms streams the known session state atom store ids on change.

func (*SessionResource) WatchSyncStatus

WatchSyncStatus streams the session sync and network activity snapshot.

func (*SessionResource) WatchTransferProgress

WatchTransferProgress streams transfer state updates for an active transfer.

type SharedObjectSelfEnrollmentResource

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

SharedObjectSelfEnrollmentResource wraps post-sign-in self-enrollment state.

func NewSharedObjectSelfEnrollmentResource

func NewSharedObjectSelfEnrollmentResource(
	swAcc *provider_spacewave.ProviderAccount,
) *SharedObjectSelfEnrollmentResource

NewSharedObjectSelfEnrollmentResource creates a new SharedObjectSelfEnrollmentResource.

func (*SharedObjectSelfEnrollmentResource) GetMux

GetMux returns the rpc mux.

func (*SharedObjectSelfEnrollmentResource) Skip

Skip records the user's skip choice for the current generation.

func (*SharedObjectSelfEnrollmentResource) Start

Start runs self-enrollment for the current pending set.

func (*SharedObjectSelfEnrollmentResource) WatchState

WatchState streams self-enrollment state changes.

type SpacewaveSessionResource

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

SpacewaveSessionResource implements SpacewaveSessionResourceService. It wraps a session-scoped spacewave ProviderAccount, resolving it directly from the session without scanning.

func NewSpacewaveSessionResource

func NewSpacewaveSessionResource(
	sr *SessionResource,
	le *logrus.Entry,
	b bus.Bus,
	sess session.Session,
	swAcc *provider_spacewave.ProviderAccount,
) *SpacewaveSessionResource

NewSpacewaveSessionResource creates a new SpacewaveSessionResource.

func (*SpacewaveSessionResource) AcceptOrganizationTargetedInvitation added in v0.51.2

AcceptOrganizationTargetedInvitation accepts a pending organization targeted invitation and mirrors the membership into local org state.

func (*SpacewaveSessionResource) AcceptSpaceTargetedInvitation added in v0.51.2

AcceptSpaceTargetedInvitation accepts a pending Space targeted invitation through the existing mailbox-backed join path.

func (*SpacewaveSessionResource) AddEmail

AddEmail adds an email address and sends verification.

ApproveSpaceLink approves a SpaceLink ticket for a target Space.

func (*SpacewaveSessionResource) AssignBillingAccount

AssignBillingAccount binds a billing account to a principal.

func (*SpacewaveSessionResource) CancelCheckoutSession

CancelCheckoutSession cancels pending checkout attempts.

func (*SpacewaveSessionResource) CancelSubscription

CancelSubscription cancels the active subscription.

func (*SpacewaveSessionResource) ConfirmDeleteNowCode

ConfirmDeleteNowCode finalizes delete-now using the 6-digit code from email.

func (*SpacewaveSessionResource) CreateBillingAccount

CreateBillingAccount creates a new unassigned billing account managed by the caller.

func (*SpacewaveSessionResource) CreateBillingPortal

CreateBillingPortal creates a Stripe billing portal session URL.

func (*SpacewaveSessionResource) CreateCheckoutSession

CreateCheckoutSession creates or resumes a Stripe Checkout Session.

func (*SpacewaveSessionResource) CreateLinkedLocalSession

CreateLinkedLocalSession creates a local provider session with cloud identity metadata.

func (*SpacewaveSessionResource) CreateOrgInvite

CreateOrgInvite creates an invite for an organization.

func (*SpacewaveSessionResource) CreateOrganization

CreateOrganization creates a new organization.

func (*SpacewaveSessionResource) CreateOrganizationTargetedInvitationByUsername added in v0.51.2

CreateOrganizationTargetedInvitationByUsername creates an organization targeted invitation by exact username and stores it in the recipient inbox.

func (*SpacewaveSessionResource) CreateSpaceTargetedInvitationByUsername added in v0.51.2

CreateSpaceTargetedInvitationByUsername creates a Space targeted invitation by exact username and stores it in the recipient inbox.

func (*SpacewaveSessionResource) CreateTargetedInvitation added in v0.51.2

CreateTargetedInvitation creates a signed pending targeted invitation.

func (*SpacewaveSessionResource) CreateTargetedInviteDraftByUsername added in v0.51.2

CreateTargetedInviteDraftByUsername creates an opaque targeted invite draft.

func (*SpacewaveSessionResource) DeleteBillingAccount

DeleteBillingAccount permanently removes a managed billing account.

func (*SpacewaveSessionResource) DeleteOrganization

DeleteOrganization deletes an organization.

func (*SpacewaveSessionResource) DetachBillingAccount

DetachBillingAccount clears a principal's billing account assignment.

func (*SpacewaveSessionResource) EncryptForHandoff

EncryptForHandoff encrypts the active session privkey to a device pubkey.

func (*SpacewaveSessionResource) EnrollSpaceMember

EnrollSpaceMember enrolls an org member into a space by adding them as a participant.

func (*SpacewaveSessionResource) GetLinkedLocalSession

GetLinkedLocalSession returns the session index of the linked local session.

func (*SpacewaveSessionResource) GetTargetedInvitation added in v0.51.2

GetTargetedInvitation reads one targeted invitation.

func (*SpacewaveSessionResource) JoinOrganization

JoinOrganization joins an organization via invite token.

func (*SpacewaveSessionResource) LeaveOrganization

LeaveOrganization leaves an organization.

func (*SpacewaveSessionResource) ListManagedBillingAccounts

ListManagedBillingAccounts lists billing accounts the caller manages.

func (*SpacewaveSessionResource) ListTargetedInvitations added in v0.51.2

ListTargetedInvitations lists the caller's targeted invitation inbox.

func (*SpacewaveSessionResource) LookupInviteCode

LookupInviteCode resolves a short invite code to the full SOInviteMessage.

func (*SpacewaveSessionResource) MountSharedObjectSelfEnrollment

MountSharedObjectSelfEnrollment mounts the self-enrollment resource.

PreviewSpaceLink verifies a SpaceLink ticket for trusted UI display.

func (*SpacewaveSessionResource) ProcessMailboxEntry

ProcessMailboxEntry accepts or rejects a mailbox entry.

func (*SpacewaveSessionResource) ProcessTargetedInvitation added in v0.51.2

ProcessTargetedInvitation applies a recipient lifecycle action.

func (*SpacewaveSessionResource) ReactivateSubscription

ReactivateSubscription reactivates a canceled subscription.

func (*SpacewaveSessionResource) RefreshBillingState

RefreshBillingState invalidates the cached billing snapshot so watches reload.

func (*SpacewaveSessionResource) ReinitializeSharedObject

ReinitializeSharedObject destructively rewrites a broken shared object in place.

func (*SpacewaveSessionResource) RemoveEmail

RemoveEmail removes an email address from the account.

func (*SpacewaveSessionResource) RemoveOrgMember

RemoveOrgMember removes a member from an organization.

func (*SpacewaveSessionResource) RemoveSpaceMember

RemoveSpaceMember removes an org member from a space by removing them as a participant.

func (*SpacewaveSessionResource) RenameBillingAccount

RenameBillingAccount updates the display name on a BA the caller manages.

func (*SpacewaveSessionResource) RepairSharedObject

RepairSharedObject retries owner-side repair for a broken shared object.

func (*SpacewaveSessionResource) RequestDeleteNowEmail

RequestDeleteNowEmail sends a delete-now confirmation email with a code and link.

func (*SpacewaveSessionResource) ResetSession

ResetSession resets a PIN-locked session.

func (*SpacewaveSessionResource) ResolveUsername added in v0.51.2

ResolveUsername resolves an exact username for an allowed invite context.

func (*SpacewaveSessionResource) RevokeOrgInvite

RevokeOrgInvite revokes an invite by ID.

func (*SpacewaveSessionResource) RevokeTargetedInvitation added in v0.51.2

RevokeTargetedInvitation revokes one pending targeted invitation.

func (*SpacewaveSessionResource) SendVerificationEmail

SendVerificationEmail sends a verification email to the given address.

func (*SpacewaveSessionResource) SetPrimaryEmail

SetPrimaryEmail promotes a verified email to primary.

func (*SpacewaveSessionResource) StartDesktopPasskeyReauth

StartDesktopPasskeyReauth runs the native-owned desktop passkey reauth flow for one specific entity keypair. The handler calls the authenticated cloud start endpoint, opens the system browser to the account-hosted ceremony, waits for the browser-authenticated result on the auth-session WebSocket, and returns the unwrap artifacts for the existing unlock path.

StartDesktopSSOLink runs the native-owned desktop SessionDetails SSO-link flow. The handler calls the authenticated cloud start endpoint for the waiting auth-session relay material, opens the system browser to the provider authorize URL, waits for the OAuth result on the auth-session WebSocket, and returns the { provider, code } pair so the UI can complete account linking through the existing Account.LinkSSO mutation.

func (*SpacewaveSessionResource) SwitchBillingInterval

SwitchBillingInterval switches between monthly and annual billing.

func (*SpacewaveSessionResource) TransferResource

TransferResource transfers a resource to a typed principal owner.

func (*SpacewaveSessionResource) UndoDeleteNow

UndoDeleteNow cancels a pending delete-now countdown.

func (*SpacewaveSessionResource) UnlinkLocalSession

UnlinkLocalSession removes the linked-local session cross-reference.

func (*SpacewaveSessionResource) UpdateOrganization

UpdateOrganization updates an organization's display name.

func (*SpacewaveSessionResource) VerifyEmailCode

VerifyEmailCode verifies a 6-digit code for in-app email verification.

func (*SpacewaveSessionResource) WatchBillingState

WatchBillingState streams combined billing account state and usage.

func (*SpacewaveSessionResource) WatchCheckoutStatus

WatchCheckoutStatus streams checkout status changes via the checkout WS.

func (*SpacewaveSessionResource) WatchEmails

WatchEmails streams the account's email list, emitting on changes.

func (*SpacewaveSessionResource) WatchOnboardingStatus

WatchOnboardingStatus streams Onboarding Status, the Spacewave cloud session route-status projection used by root, plan, billing, and lifecycle routers.

func (*SpacewaveSessionResource) WatchOrganizationState

WatchOrganizationState streams one organization's combined mutable state.

func (*SpacewaveSessionResource) WatchOrganizations

WatchOrganizations streams the user's org list, emitting on membership changes.

func (*SpacewaveSessionResource) WatchSubscriptionStatus

WatchSubscriptionStatus streams billing account state changes.

func (*SpacewaveSessionResource) WatchTargetedInvitations added in v0.51.2

WatchTargetedInvitations streams recipient targeted invitation inbox snapshots.

type StatusResource

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

StatusResource implements the SystemStatusService for a session.

func NewStatusResource

func NewStatusResource(b bus.Bus) *StatusResource

NewStatusResource creates a new StatusResource.

func (*StatusResource) WatchControllers

WatchControllers streams the list of active controllers on change.

func (*StatusResource) WatchDirectives

WatchDirectives streams the list of active directives on change.

func (*StatusResource) WatchPlugins added in v0.51.0

WatchPlugins streams the plugin host scheduler's live plugin instances.

Jump to

Keyboard shortcuts

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