master
go 36 lines 784 Bytes
Raw
1 package dagjose
2
3 import (
4 "github.com/ipfs/kubo/plugin"
5
6 "github.com/ceramicnetwork/go-dag-jose/dagjose"
7 "github.com/ipld/go-ipld-prime/multicodec"
8 mc "github.com/multiformats/go-multicodec"
9 )
10
11 // Plugins is exported list of plugins that will be loaded.
12 var Plugins = []plugin.Plugin{
13 &dagjosePlugin{},
14 }
15
16 type dagjosePlugin struct{}
17
18 var _ plugin.PluginIPLD = (*dagjosePlugin)(nil)
19
20 func (*dagjosePlugin) Name() string {
21 return "ipld-codec-dagjose"
22 }
23
24 func (*dagjosePlugin) Version() string {
25 return "0.0.1"
26 }
27
28 func (*dagjosePlugin) Init(_ *plugin.Environment) error {
29 return nil
30 }
31
32 func (*dagjosePlugin) Register(reg multicodec.Registry) error {
33 reg.RegisterEncoder(uint64(mc.DagJose), dagjose.Encode)
34 reg.RegisterDecoder(uint64(mc.DagJose), dagjose.Decode)
35 return nil
36 }