auth

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package auth provides authorization management for Dirvana projects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

Auth manages project directory authorization and shell command approval

func New

func New(path string) (*Auth, error)

New creates or loads an Auth instance

func (*Auth) Allow

func (a *Auth) Allow(path string) error

Allow adds a directory to the authorized list

func (*Auth) ApproveShellCommands added in v0.1.0

func (a *Auth) ApproveShellCommands(dir string, shellCmds map[string]string) error

ApproveShellCommands saves shell command approval for a directory

func (*Auth) Clear

func (a *Auth) Clear() error

Clear removes all authorized directories

func (*Auth) GetAuth added in v0.1.0

func (a *Auth) GetAuth(path string) *DirAuth

GetAuth returns the DirAuth structure for a given directory path

func (*Auth) IsAllowed

func (a *Auth) IsAllowed(path string) (bool, error)

IsAllowed checks if a directory is authorized

func (*Auth) List

func (a *Auth) List() []string

List returns all authorized directories

func (*Auth) RequiresShellApproval added in v0.1.0

func (a *Auth) RequiresShellApproval(dir string, shellCmds map[string]string) bool

RequiresShellApproval returns true if shell command approval is needed for the directory

func (*Auth) Revoke

func (a *Auth) Revoke(path string) error

Revoke removes a directory from the authorized list

type DirAuth added in v0.1.0

type DirAuth struct {
	Allowed           bool      `json:"allowed"`
	AllowedAt         time.Time `json:"allowed_at,omitempty"`
	ShellCommandsHash string    `json:"shell_commands_hash,omitempty"`
	ShellApprovedAt   time.Time `json:"shell_approved_at,omitempty"`
}

DirAuth stores the authorization state of a directory, including dynamic shell command approval

type File added in v0.1.0

type File struct {
	Version     int                 `json:"_version"`
	Directories map[string]*DirAuth `json:"directories"`
}

File represents the v2 auth file structure with version metadata

Jump to

Keyboard shortcuts

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