mirror of
https://github.com/FiloSottile/age.git
synced 2026-03-11 08:55:41 +00:00
plugin: improve package and method docs
This commit is contained in:
parent
bf1252650a
commit
2a671dca00
2 changed files with 10 additions and 1 deletions
|
|
@ -4,7 +4,6 @@
|
|||
// license that can be found in the LICENSE file or at
|
||||
// https://developers.google.com/open-source/licenses/bsd
|
||||
|
||||
// Package plugin implements the age plugin protocol.
|
||||
package plugin
|
||||
|
||||
import (
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
// Package plugin implements the age plugin protocol.
|
||||
//
|
||||
// [Recipient] and [Indentity] are plugin clients, that execute plugin binaries to
|
||||
// perform encryption and decryption operations.
|
||||
//
|
||||
// [Plugin] is a framework for writing age plugins, that exposes an [age.Recipient]
|
||||
// and/or [age.Identity] implementation as a plugin binary.
|
||||
package plugin
|
||||
|
||||
import (
|
||||
|
|
@ -71,6 +78,7 @@ func (p *Plugin) RegisterFlags(fs *flag.FlagSet) {
|
|||
// If the client supports labels, they will be passed through the protocol.
|
||||
//
|
||||
// It must be called before [Plugin.Main], and can be called at most once.
|
||||
// Otherwise, it panics.
|
||||
func (p *Plugin) HandleRecipient(f func(data []byte) (age.Recipient, error)) {
|
||||
if p.recipient != nil {
|
||||
panic("HandleRecipient called twice")
|
||||
|
|
@ -87,6 +95,7 @@ func (p *Plugin) HandleRecipient(f func(data []byte) (age.Recipient, error)) {
|
|||
// If the client supports labels, they will be passed through the protocol.
|
||||
//
|
||||
// It must be called before [Plugin.Main], and can be called at most once.
|
||||
// Otherwise, it panics.
|
||||
func (p *Plugin) HandleIdentityAsRecipient(f func(data []byte) (age.Recipient, error)) {
|
||||
if p.idAsRecipient != nil {
|
||||
panic("HandleIdentityAsRecipient called twice")
|
||||
|
|
@ -99,6 +108,7 @@ func (p *Plugin) HandleIdentityAsRecipient(f func(data []byte) (age.Recipient, e
|
|||
// payload.
|
||||
//
|
||||
// It must be called before [Plugin.Main], and can be called at most once.
|
||||
// Otherwise, it panics.
|
||||
func (p *Plugin) HandleIdentity(f func(data []byte) (age.Identity, error)) {
|
||||
if p.identity != nil {
|
||||
panic("HandleIdentity called twice")
|
||||
|
|
|
|||
Loading…
Reference in a new issue