diff --git a/plugin/client.go b/plugin/client.go index 6e19016..28ccbf1 100644 --- a/plugin/client.go +++ b/plugin/client.go @@ -52,6 +52,15 @@ func (r *Recipient) Name() string { return r.name } +// String returns the recipient encoding string ("age1name1...") or +// "" if r was created by [Identity.Recipient]. +func (r *Recipient) String() string { + if r.identity { + return "" + } + return r.encoding +} + func (r *Recipient) Wrap(fileKey []byte) (stanzas []*age.Stanza, err error) { stanzas, _, err = r.WrapWithLabels(fileKey) return @@ -193,6 +202,11 @@ func (i *Identity) Name() string { return i.name } +// String returns the identity encoding string ("AGE-PLUGIN-NAME-1..."). +func (i *Identity) String() string { + return i.encoding +} + // Recipient returns a Recipient wrapping this identity. When that Recipient is // used to encrypt a file key, the identity encoding is provided as-is to the // plugin, which is expected to support encrypting to identities.