auth

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package auth provides authentication utilities for the AhaSend CLI.

This package handles client authentication through multiple methods:

  • Global API key flags (--api-key and --account-id)
  • Profile-based authentication from configuration files
  • Profile switching and validation

The main function GetAuthenticatedClient creates authenticated clients for use by CLI commands, handling the authentication precedence and validation automatically.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuthenticatedClient

func GetAuthenticatedClient(cmd *cobra.Command) (client.AhaSendClient, error)

GetAuthenticatedClient returns an authenticated AhaSend client It checks for global flags first, then falls back to profiles

func RequireAuth

func RequireAuth(cmd *cobra.Command) error

RequireAuth validates that authentication is available

func SetAuthenticatedClientResolverForTesting

func SetAuthenticatedClientResolverForTesting(resolver ClientResolver) func()

SetAuthenticatedClientResolverForTesting overrides authenticated client resolution for tests.

Types

type ClientResolver

type ClientResolver func(*cobra.Command) (client.AhaSendClient, error)

ClientResolver resolves an authenticated AhaSend client for a command.

Jump to

Keyboard shortcuts

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