Debian Codegraph @

plugin/example_test.go

raw symbols SCIP
1 package plugin_test
2
3 import (
4 "log"
5 "os"
6
7 "filippo.io/age"
8 "filippo.io/age/plugin"
9 )
10
11 type Recipient struct{}
12
13 func (r *Recipient) Wrap(fileKey []byte) ([]*age.Stanza, error) {
14 panic("unimplemented")
15 }
16
17 func NewRecipient(data []byte) (*Recipient, error) {
18 return &Recipient{}, nil
19 }
20
21 type Identity struct{}
22
23 func (i *Identity) Unwrap(s []*age.Stanza) ([]byte, error) {
24 panic("unimplemented")
25 }
26
27 func NewIdentity(data []byte) (*Identity, error) {
28 return &Identity{}, nil
29 }
30
31 func ExamplePlugin_main() {
32 p, err := plugin.New("example")
33 if err != nil {
34 log.Fatal(err)
35 }
36 p.HandleRecipient(func(data []byte) (age.Recipient, error) {
37 return NewRecipient(data)
38 })
39 p.HandleIdentity(func(data []byte) (age.Identity, error) {
40 return NewIdentity(data)
41 })
42 os.Exit(p.Main())
43 }