Documentation
¶
Index ¶
- Variables
- func Authenticate(accountKey, rootPath, apiAddr string) error
- func ClientContextWithAuth(token string) context.Context
- func ClientContextWithAuthTimeout(token string, timeout time.Duration) (context.Context, context.CancelFunc)
- func CloseEventReceiver()
- func CloseGRPCConnection()
- func CreateAPIKey(name string) (*pb.RpcAccountLocalLinkCreateAppResponse, error)
- func CreateWallet(name, rootPath, apiAddr string) (string, string, bool, error)
- func DeleteStoredAccountKey() error
- func DeleteStoredSessionToken() error
- func GRPCCall(fn func(ctx context.Context, client service.ClientCommandsClient) error) error
- func GRPCCallNoAuth(fn func(ctx context.Context, client service.ClientCommandsClient) error) error
- func GetGRPCClient() (service.ClientCommandsClient, error)
- func GetHeartVersion() string
- func GetReleaseURL() string
- func GetStoredAccountKey() (string, bool, error)
- func GetStoredSessionToken() (string, bool, error)
- func GetVersion() string
- func GetVersionBrief() string
- func GetVersionVerbose() string
- func JoinSpace(networkId, spaceId, inviteCId, inviteFileKey string) error
- func LeaveSpace(spaceId string) error
- func ListAPIKeys() (*pb.RpcAccountLocalLinkListAppsResponse, error)
- func Login(accountKey, rootPath, apiAddr string) error
- func Logout() error
- func RevokeAPIKey(appId string) error
- func SaveAccountKey(accountKey string) (bool, error)
- func SaveSessionToken(token string) (bool, error)
- func ValidateAccountKey(accountKey string) error
- func ViewSpaceInvite(inviteCId, inviteFileKey string) (*pb.RpcSpaceInviteViewResponse, error)
- func WaitForAccountId(er *EventReceiver) (string, error)
- type EventReceiver
- type SpaceListItem
Constants ¶
This section is empty.
Variables ¶
var ( Version = "" Commit = "" BuildTime = "" GitState = "" )
Set via ldflags during build
var (
ErrNotFound = errors.New("credentials not found")
)
Functions ¶
func Authenticate ¶ added in v0.1.0
Authenticate performs the full authentication flow for a bot account using an account key. This includes wallet recovery, session creation, account recovery, account selection, and config persistence.
func ClientContextWithAuth ¶
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 ¶
CreateWallet creates a new wallet and account, establishes a session, saves credentials, and returns the account key, account ID, and whether credentials were saved to keyring.
func DeleteStoredAccountKey ¶ added in v0.1.0
func DeleteStoredAccountKey() error
func DeleteStoredSessionToken ¶ added in v0.1.0
func DeleteStoredSessionToken() error
func GRPCCall ¶
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 ¶
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 GetHeartVersion ¶ added in v0.1.0
func GetHeartVersion() string
func GetReleaseURL ¶
func GetReleaseURL() string
func GetStoredAccountKey ¶ added in v0.1.0
GetStoredAccountKey retrieves the account key from keyring if available, otherwise from config file. Returns the account key, true if retrieved from keyring (false if from config file), and any error.
func GetStoredSessionToken ¶ added in v0.1.0
GetStoredSessionToken retrieves the session token from keyring if available, otherwise from config file. Returns the token, true if retrieved from keyring (false if from config file), and any error.
func GetVersion ¶
func GetVersion() string
func GetVersionBrief ¶
func GetVersionBrief() string
func GetVersionVerbose ¶
func GetVersionVerbose() string
func LeaveSpace ¶
func ListAPIKeys ¶
func ListAPIKeys() (*pb.RpcAccountLocalLinkListAppsResponse, error)
ListAPIKeys lists all API keys
func Login ¶
Login handles user interaction for login by prompting for account key if not provided, validating it, performing authentication, and saving the key to keychain.
func Logout ¶
func Logout() error
Logout logs out the current user by deleting stored credentials, clearing the config, and attempting to stop the account and close the wallet session on the server.
func SaveAccountKey ¶ added in v0.1.0
SaveAccountKey saves the account key to the keyring if available, otherwise to the config file. Returns true if saved to keyring, false if saved to config file.
func SaveSessionToken ¶ added in v0.1.0
SaveSessionToken saves the session token to the keyring if available, otherwise to the config file. Returns true if saved to keyring, false if saved to config file.
func ValidateAccountKey ¶ added in v0.1.0
ValidateAccountKey checks if the provided account key is valid.
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
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) 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