auth

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package auth stores one API key per provider in ~/.kaku/auth.json so a user can log in once instead of exporting an environment variable each session. The file is written 0600 and keys leave it only through Get.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store is a credential store over a JSON file mapping provider name to key.

func New

func New() (*Store, error)

New opens the store at the default path (~/.kaku/auth.json).

func NewAt

func NewAt(path string) *Store

NewAt opens a store at an explicit path. It exists mainly for tests.

func (*Store) Delete

func (s *Store) Delete(provider string) error

Delete removes a provider's key. Removing an absent key is a no-op, not an error, so logout is idempotent.

func (*Store) Get

func (s *Store) Get(provider string) (string, bool)

Get returns the stored key for a provider and whether a non-empty one exists.

func (*Store) List

func (s *Store) List() []string

List returns the provider names that have a stored key, sorted. Values are never returned so a listing cannot leak a key.

func (*Store) Set

func (s *Store) Set(provider, key string) error

Set stores a key for a provider, creating the file 0600 if it is missing.

Jump to

Keyboard shortcuts

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