Documentation
¶
Overview ¶
Package plugin implements the age plugin protocol.
Index ¶
- func EncodeIdentity(name string, data []byte) string
- func EncodeRecipient(name string, data []byte) string
- func EncodeX25519Recipient(pk *ecdh.PublicKey) (string, error)
- func ParseIdentity(s string) (name string, data []byte, err error)
- func ParseRecipient(s string) (name string, data []byte, err error)
- type ClientUI
- type Identity
- type Recipient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeIdentity ¶
EncodeIdentity encodes a plugin identity string for a plugin with the given name. If the name is invalid, it returns an empty string.
func EncodeRecipient ¶
EncodeRecipient encodes a plugin recipient string for a plugin with the given name. If the name is invalid, it returns an empty string.
func EncodeX25519Recipient ¶
EncodeX25519Recipient encodes a native X25519 recipient from a crypto/ecdh.X25519 public key. It's meant for plugins that implement identities that are compatible with native recipients.
func ParseIdentity ¶
ParseIdentity decodes a plugin identity string. It returns the plugin name in lowercase and the encoded data.
Types ¶
type ClientUI ¶
type ClientUI struct { // DisplayMessage displays the message, which is expected to have lowercase // initials and no final period. DisplayMessage func(name, message string) error // RequestValue requests a secret or public input, with the provided prompt. RequestValue func(name, prompt string, secret bool) (string, error) // Confirm requests a confirmation with the provided prompt. The yes and no // value are the choices provided to the user. no may be empty. The return // value indicates whether the user selected the yes or no option. Confirm func(name, prompt, yes, no string) (choseYes bool, err error) // WaitTimer is invoked once (Un)Wrap has been waiting for 5 seconds on the // plugin, for example because the plugin is waiting for an external event // (e.g. a hardware token touch). Unlike the other callbacks, WaitTimer runs // in a separate goroutine, and if missing it's simply ignored. WaitTimer func(name string) }
ClientUI holds callbacks that will be invoked by (Un)Wrap if the plugin wishes to interact with the user. If any of them is nil or returns an error, failure will be reported to the plugin, but note that the error is otherwise discarded. Implementations are encouraged to display errors to the user before returning them.
type Identity ¶
type Identity struct {
// contains filtered or unexported fields
}
func NewIdentityWithoutData ¶
func (*Identity) Name ¶
Name returns the plugin name, which is used in the recipient ("age1name1...") and identity ("AGE-PLUGIN-NAME-1...") encodings, as well as in the plugin binary name ("age-plugin-name").
type Recipient ¶
type Recipient struct {
// contains filtered or unexported fields
}
func (*Recipient) Name ¶
Name returns the plugin name, which is used in the recipient ("age1name1...") and identity ("AGE-PLUGIN-NAME-1...") encodings, as well as in the plugin binary name ("age-plugin-name").