secrets
ak secrets rotate
Luân chuyển giá trị bí mật được chỉ định.
Luân chuyển giá trị bí mật được chỉ định.
Dùng ak secrets rotate với đối số và tùy chọn dưới đây. Phần help nguyên bản giữ nguyên thuật ngữ, cú pháp, tác động và điều kiện thực thi của CLI để đối chiếu chính xác.
Khi bật đồng bộ vault, lần ghi cục bộ thành công sẽ khởi động push nền cho vault dùng backend hệ điều hành. Lệnh trả kết quả ngay. Dùng --no-push cho lần ghi này hoặc đặt AGENTKIT_SECRETS_AUTO_PUSH=0 để tắt push nền. Backend file đồng bộ khi bạn chạy ak secrets sync now.
Contract và help của lệnh
Replace an existing secret's value
Synopsis
Replace <ref>'s stored value with a new one, read the same way as ak secrets set: --value=- (stdin), --value-file=<path>, or an interactive, non-echoing prompt — never --value=<literal>. Unlike set, rotate requires ref to already exist: it always overwrites (like set --force), so confirming existence first catches a typo'd ref instead of silently creating a new secret under the wrong name. Use it when a credential's value changed, expired, or is being rotated as a precaution.
Effects:
Overwrites the value in the active backend and updates the ref's metadata (rotatedAt, and the value hint, recomputed from the new value) in ~/.agentkit/secrets/index.json. --no-hint turns the hint off for this ref. With sync on, it then starts a background ak secrets sync now that pushes the change without waiting for it; --no-push or AGENTKIT_SECRETS_AUTO_PUSH=0 turns that off, and the file backend is never pushed in the background.
Exit status: 0 success 2 invalid flags or arguments, or profile text that would hold the value 3 ref has no stored value (rotate never creates one) 5 backend or index failure
ak secrets rotate <ref> [flags]Examples
ak secrets rotate ${REF} # interactive prompt
echo -n "${VALUE}" | ak secrets rotate ${REF} --value=- # pipe from stdin
ak secrets rotate ${REF} --value-file ${PATH} # read from a fileOptions
--backend string Storage backend: keychain (default), file (age-encrypted vault), or memory (dev/test; values and its index are throwaway)
-h, --help help for rotate
--json Emit machine-readable JSON (implies --no-interactive)
--no-hint Record no value hint for this secret; it stays off across rotations until --no-hint=false
--no-interactive Disable interactive prompts (CI-safe)
--no-push ak secrets sync now Do not push this change to the sync vault in the background (it syncs at the next ak secrets sync now)
-q, --quiet Suppress non-error output on stderr
--unlock-with-recovery Open the file backend's vault with a recovery private key and set a new passphrase
--value string Secret value source: '-' reads from stdin. A literal value is rejected — use --value=- or --value-file
--value-file string Path to a file containing the secret value
-V, --verbose Extra diagnostic output on stderr (loses to --quiet)
-y, --yes Assume yes for all promptsSEE ALSO
- ak secrets - Manage named secret values (API keys, tokens)