kubo/plugin/plugins/dagjose/dagjose.go
Mohsin Zaidi ecd2628a16
Integrate go-dag-jose plugin (#8569)
* feat(dag-jose): integrate `go-dag-jose` plugin
* test(dag-jose): sharness test for dag-jose plugin

Co-authored-by: Eric Myhre <hash@exultant.us>
2021-11-30 10:58:15 -08:00

37 lines
786 B
Go

package dagjose
import (
"github.com/ipfs/go-ipfs/plugin"
"github.com/ceramicnetwork/go-dag-jose/dagjose"
"github.com/ipld/go-ipld-prime/multicodec"
mc "github.com/multiformats/go-multicodec"
)
// Plugins is exported list of plugins that will be loaded
var Plugins = []plugin.Plugin{
&dagjosePlugin{},
}
type dagjosePlugin struct{}
var _ plugin.PluginIPLD = (*dagjosePlugin)(nil)
func (*dagjosePlugin) Name() string {
return "ipld-codec-dagjose"
}
func (*dagjosePlugin) Version() string {
return "0.0.1"
}
func (*dagjosePlugin) Init(_ *plugin.Environment) error {
return nil
}
func (*dagjosePlugin) Register(reg multicodec.Registry) error {
reg.RegisterEncoder(uint64(mc.DagJose), dagjose.Encode)
reg.RegisterDecoder(uint64(mc.DagJose), dagjose.Decode)
return nil
}