Something went wrong. Try again.
A fork of the Cocoon PDS but being made more distributed. forked from willdot.net/cocoon
Something went wrong. Try again.
1.5 kB · 54 lines
Go
at test
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455package plc
import ( "encoding/json"
"github.com/bluesky-social/indigo/atproto/atdata" "github.com/haileyok/cocoon/identity" cbg "github.com/whyrusleeping/cbor-gen")
type DidCredentials struct { VerificationMethods map[string]string `json:"verificationMethods"` RotationKeys []string `json:"rotationKeys"` AlsoKnownAs []string `json:"alsoKnownAs"` Services map[string]identity.OperationService `json:"services"`}
type Operation struct { Type string `json:"type"` VerificationMethods map[string]string `json:"verificationMethods"` RotationKeys []string `json:"rotationKeys"` AlsoKnownAs []string `json:"alsoKnownAs"` Services map[string]identity.OperationService `json:"services"` Prev *string `json:"prev"` Sig string `json:"sig,omitempty"`}
type OperationService struct { Type string `json:"type"` Endpoint string `json:"endpoint"`}
func (po *Operation) MarshalCBOR() ([]byte, error) { if po == nil { return cbg.CborNull, nil }
b, err := json.Marshal(po) if err != nil { return nil, err }
var m map[string]any if err := json.Unmarshal(b, &m); err != nil { return nil, err }
b, err = atdata.MarshalCBOR(m) if err != nil { return nil, err }
return b, nil}