---
name: keepass_get
kind: function
lang: bash
domain: infra
version: "1.0.0"
purity: impure
signature: "keepass_get(entry: string, attr?: string) -> string"
description: "Lee un atributo (Password por defecto) de una entry del KeePassXC database via keepassxc-cli. Resuelve master password desde pass (meta/keepassxc-master) o env KEEPASS_PASSWORD."
tags: [keepass, keepassxc, secret, credential, get]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: []
params:
  - name: entry
    desc: "path de la entry dentro del .kdbx (ej. 'Servers/prod-mysql')"
  - name: attr
    desc: "atributo a leer (Password, UserName, URL, Notes, Title); default Password"
output: "valor del atributo en texto plano (sin newline final)"
tested: false
tests: []
test_file_path: ""
file_path: "bash/functions/infra/keepass_get.sh"
---

## Ejemplo

```bash
export KEEPASS_DB="/mnt/d/Tr4Shhh_FOLDER/Sync/PssDtbs/PassDataBase.kdbx"
source keepass_get.sh

pwd=$(keepass_get "Servers/prod-mysql")
user=$(keepass_get "Servers/prod-mysql" UserName)
```

## Setup

Master password se guarda una vez en pass:

```bash
pass insert meta/keepassxc-master
```

## Notas

- Wrappea `keepassxc-cli show -s -a <attr>`.
- Cada call reabre la BD (CLI stateless). Para batch, usa `keepass_dump`.
- `KEEPASS_PASSWORD` env tiene prioridad sobre `pass`.
