feat(vault-tui): implement KV client and service for managing secrets
- Added internal/vault/client.go for creating a Vault client with configuration settings. - Introduced internal/vault/errors.go to classify Vault API errors for better UI handling. - Created internal/vault/kv.go to manage KV secrets, including listing, reading, writing, and deleting operations. - Implemented internal/vault/mounts.go to list and describe secret engine mounts. - Developed internal/vault/service.go to provide a unified entry point for Vault operations. - Added internal/vault/kv_test.go for comprehensive testing of KV operations. - Introduced internal/ui/toast.go for transient notifications in the UI. - Added renovate.json for dependency management and updates.
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.morlana.online/f.weber/vault-tui/internal/auth"
|
||||
"git.morlana.online/f.weber/vault-tui/internal/token"
|
||||
"git.morlana.online/f.weber/vault-tui/internal/vault"
|
||||
)
|
||||
|
||||
// Every Vault/auth call the TUI makes is issued as a tea.Cmd and reported
|
||||
// back as one of these typed messages — Update never blocks on I/O itself.
|
||||
|
||||
type mountsMsg struct {
|
||||
mounts []vault.Mount
|
||||
err error
|
||||
}
|
||||
|
||||
type listMsg struct {
|
||||
listing vault.Listing
|
||||
mount vault.Mount
|
||||
path string
|
||||
err error
|
||||
}
|
||||
|
||||
type secretMsg struct {
|
||||
secret *vault.Secret
|
||||
mount vault.Mount
|
||||
path string
|
||||
err error
|
||||
}
|
||||
|
||||
type versionsMsg struct {
|
||||
versions []vault.VersionMeta
|
||||
err error
|
||||
}
|
||||
|
||||
type writeAckMsg struct {
|
||||
ack *vault.WriteAck
|
||||
err error
|
||||
}
|
||||
|
||||
type deleteAckMsg struct {
|
||||
ack *vault.DeleteAck
|
||||
err error
|
||||
}
|
||||
|
||||
type rollbackAckMsg struct {
|
||||
ack *vault.WriteAck
|
||||
err error
|
||||
}
|
||||
|
||||
type undeleteAckMsg struct {
|
||||
ack *vault.DeleteAck
|
||||
err error
|
||||
}
|
||||
|
||||
type profileSwitchMsg struct {
|
||||
profile string
|
||||
err error
|
||||
}
|
||||
|
||||
type logoutDoneMsg struct{ err error }
|
||||
|
||||
// clipboardClearMsg fires Settings.ClipboardClear after a copy, so a
|
||||
// secret value doesn't linger in the system clipboard indefinitely.
|
||||
type clipboardClearMsg struct{ seq int }
|
||||
|
||||
type tokenInfoMsg struct {
|
||||
info *token.Info
|
||||
err error
|
||||
}
|
||||
|
||||
// loginEventMsg/loginDoneMsg drive the OIDC/Okta progress pump: Login runs
|
||||
// in a goroutine and reports each auth.Event plus a final result, exactly
|
||||
// mirroring the channel-pump pattern used by internal/cli's drainEvents.
|
||||
type loginEventMsg auth.Event
|
||||
|
||||
type loginDoneMsg struct {
|
||||
result *auth.Result
|
||||
err error
|
||||
storeWarn string // non-empty if login succeeded but token persistence failed
|
||||
}
|
||||
|
||||
type errMsg struct{ err error }
|
||||
|
||||
type statusMsg struct{ text string }
|
||||
|
||||
// tickMsg drives the token-TTL countdown in the status bar.
|
||||
type tickMsg time.Time
|
||||
Reference in New Issue
Block a user