core

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   = ""
	Commit    = ""
	BuildTime = ""
	GitState  = ""
)

Set via ldflags during build

Functions

func ApproveJoinRequest

func ApproveJoinRequest(spaceId, identity string, permissions model.ParticipantPermissions) error

func ClientContextWithAuth

func ClientContextWithAuth(token string) context.Context

func ClientContextWithAuthTimeout

func ClientContextWithAuthTimeout(token string, timeout time.Duration) (context.Context, context.CancelFunc)

ClientContextWithAuthTimeout creates a context with both authentication and timeout

func CloseEventReceiver

func CloseEventReceiver()

CloseEventReceiver closes the global event receiver instance if it exists

func CloseGRPCConnection

func CloseGRPCConnection()

CloseGRPCConnection ensures the connection is properly closed

func CreateAPIKey

func CreateAPIKey(name string) (*pb.RpcAccountLocalLinkCreateAppResponse, error)

CreateAPIKey creates a new API key for local app access

func CreateWallet

func CreateWallet(name, rootPath, apiAddr string) (string, string, error)

CreateWallet creates a new wallet with the given root path and returns the mnemonic and account Id

func DeleteStoredMnemonic

func DeleteStoredMnemonic() error

func DeleteStoredToken

func DeleteStoredToken() error

func GRPCCall

func GRPCCall(fn func(ctx context.Context, client service.ClientCommandsClient) error) error

GRPCCall is a helper that reduces boilerplate for gRPC calls It gets the client, token, creates context with timeout, and executes the function

func GRPCCallNoAuth

func GRPCCallNoAuth(fn func(ctx context.Context, client service.ClientCommandsClient) error) error

GRPCCallNoAuth is like GRPCCall but without authentication

func GetGRPCClient

func GetGRPCClient() (service.ClientCommandsClient, error)

GetGRPCClient initializes (if needed) and returns the shared gRPC client

func GetReleaseURL

func GetReleaseURL() string

func GetStoredAccountId

func GetStoredAccountId() (string, error)

GetStoredAccountId retrieves the stored account Id from config

func GetStoredMnemonic

func GetStoredMnemonic() (string, error)

func GetStoredTechSpaceId

func GetStoredTechSpaceId() (string, error)

GetStoredTechSpaceId retrieves the stored tech space Id from config

func GetStoredToken

func GetStoredToken() (string, error)

func GetVersion

func GetVersion() string

func GetVersionBrief

func GetVersionBrief() string

func GetVersionVerbose

func GetVersionVerbose() string

func JoinSpace

func JoinSpace(networkId, spaceId, inviteCId, inviteFileKey string) error

func LeaveSpace

func LeaveSpace(spaceId string) error

func ListAPIKeys

ListAPIKeys lists all API keys

func LoadStoredConfig

func LoadStoredConfig() (*config.Config, error)

LoadStoredConfig loads and returns the entire config

func Login

func Login(mnemonic, rootPath, apiAddr string) error

func LoginAccount

func LoginAccount(mnemonic, rootPath, apiAddr string) error

LoginAccount performs the common steps for logging in with a given mnemonic and root path.

func Logout

func Logout() error

func RevokeAPIKey

func RevokeAPIKey(appId string) error

RevokeAPIKey revokes an API key by appId

func SaveMnemonic

func SaveMnemonic(mnemonic string) error

func SaveToken

func SaveToken(token string) error

func ValidateMnemonic

func ValidateMnemonic(mnemonic string) error

func ViewSpaceInvite

func ViewSpaceInvite(inviteCId, inviteFileKey string) (*pb.RpcSpaceInviteViewResponse, error)

func WaitForAccountId

func WaitForAccountId(er *EventReceiver) (string, error)

WaitForAccountId waits for an accountShow event and returns the account Id

func WaitForJoinRequestEvent

func WaitForJoinRequestEvent(er *EventReceiver, spaceId string) (*model.NotificationRequestToJoin, error)

WaitForJoinRequestEvent waits for a join request for the specified space

Types

type EventReceiver

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

func ListenForEvents

func ListenForEvents(token string) (*EventReceiver, error)

ListenForEvents ensures a single EventReceiver instance is used.

func (*EventReceiver) Close

func (er *EventReceiver) Close()

Close stops the event receiver

func (*EventReceiver) WaitForEvent

func (er *EventReceiver) WaitForEvent(ctx context.Context, predicate func(*pb.EventMessage) bool) (*pb.EventMessage, error)

WaitForEvent waits for an event matching the predicate

func (*EventReceiver) WaitOne

func (er *EventReceiver) WaitOne(ctx context.Context) (*pb.EventMessage, error)

WaitOne waits for any single event with optional timeout

type SpaceListItem

type SpaceListItem struct {
	SpaceId string
	Name    string
	Status  model.SpaceStatus
}

func ListSpaces

func ListSpaces() ([]SpaceListItem, error)

ListSpaces returns a list of all available spaces

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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