···
+
// Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT.
+
cid "github.com/ipfs/go-cid"
+
cbg "github.com/whyrusleeping/cbor-gen"
+
xerrors "golang.org/x/xerrors"
+
func (t *PublicKey) MarshalCBOR(w io.Writer) error {
+
_, err := w.Write(cbg.CborNull)
+
cw := cbg.NewCborWriter(w)
+
if _, err := cw.Write([]byte{164}); err != nil {
+
// t.Key (string) (string)
+
if len("key") > 1000000 {
+
return xerrors.Errorf("Value in field \"key\" was too long")
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("key"))); err != nil {
+
if _, err := cw.WriteString(string("key")); err != nil {
+
if len(t.Key) > 1000000 {
+
return xerrors.Errorf("Value in field t.Key was too long")
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Key))); err != nil {
+
if _, err := cw.WriteString(string(t.Key)); err != nil {
+
// t.Name (string) (string)
+
if len("name") > 1000000 {
+
return xerrors.Errorf("Value in field \"name\" was too long")
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil {
+
if _, err := cw.WriteString(string("name")); err != nil {
+
if len(t.Name) > 1000000 {
+
return xerrors.Errorf("Value in field t.Name was too long")
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil {
+
if _, err := cw.WriteString(string(t.Name)); err != nil {
+
// t.LexiconTypeID (string) (string)
+
if len("$type") > 1000000 {
+
return xerrors.Errorf("Value in field \"$type\" was too long")
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil {
+
if _, err := cw.WriteString(string("$type")); err != nil {
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.bild.publicKey"))); err != nil {
+
if _, err := cw.WriteString(string("sh.bild.publicKey")); err != nil {
+
// t.Created (string) (string)
+
if len("created") > 1000000 {
+
return xerrors.Errorf("Value in field \"created\" was too long")
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("created"))); err != nil {
+
if _, err := cw.WriteString(string("created")); err != nil {
+
if len(t.Created) > 1000000 {
+
return xerrors.Errorf("Value in field t.Created was too long")
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Created))); err != nil {
+
if _, err := cw.WriteString(string(t.Created)); err != nil {
+
func (t *PublicKey) UnmarshalCBOR(r io.Reader) (err error) {
+
cr := cbg.NewCborReader(r)
+
maj, extra, err := cr.ReadHeader()
+
err = io.ErrUnexpectedEOF
+
return fmt.Errorf("cbor input should be of type map")
+
if extra > cbg.MaxLength {
+
return fmt.Errorf("PublicKey: map struct too large (%d)", extra)
+
nameBuf := make([]byte, 7)
+
for i := uint64(0); i < n; i++ {
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
+
// Field doesn't exist on this type, so ignore it
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
+
switch string(nameBuf[:nameLen]) {
+
// t.Key (string) (string)
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
+
// t.Name (string) (string)
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
+
// t.LexiconTypeID (string) (string)
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
+
t.LexiconTypeID = string(sval)
+
// t.Created (string) (string)
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
+
t.Created = string(sval)
+
// Field doesn't exist on this type, so ignore it
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {