feat(identity): added --add-recipient and --remove-recipient flags for multi-recipient keys

This commit is contained in:
Lewis Wynne 2026-02-13 15:12:22 +00:00
parent f9ff2c0d62
commit 579e6a1eee
12 changed files with 575 additions and 51 deletions

View file

@ -33,7 +33,6 @@ import (
"strings"
"unicode/utf8"
"filippo.io/age"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/jedib0t/go-pretty/v6/text"
"github.com/spf13/cobra"
@ -218,9 +217,9 @@ func list(cmd *cobra.Command, args []string) error {
}
identity, _ := loadIdentity()
var recipient *age.X25519Recipient
if identity != nil {
recipient = identity.Recipient()
recipients, err := allRecipients(identity)
if err != nil {
return fmt.Errorf("cannot ls '%s': %v", targetDB, err)
}
var entries []Entry
@ -297,7 +296,7 @@ func list(cmd *cobra.Command, args []string) error {
// NDJSON format: emit JSON lines directly (encrypted form for secrets)
if listFormat.String() == "ndjson" {
for _, e := range filtered {
je, err := encodeJsonEntry(e, recipient)
je, err := encodeJsonEntry(e, recipients)
if err != nil {
return fmt.Errorf("cannot ls '%s': %v", targetDB, err)
}
@ -315,7 +314,7 @@ func list(cmd *cobra.Command, args []string) error {
if listFormat.String() == "json" {
var jsonEntries []jsonEntry
for _, e := range filtered {
je, err := encodeJsonEntry(e, recipient)
je, err := encodeJsonEntry(e, recipients)
if err != nil {
return fmt.Errorf("cannot ls '%s': %v", targetDB, err)
}