An atproto PDS written in Go
103
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 5a6fbfab88f0c811b708c08b334cd56716081963 55 lines 1.5 kB view raw
1package plc 2 3import ( 4 "encoding/json" 5 6 "github.com/bluesky-social/indigo/atproto/atdata" 7 "github.com/haileyok/cocoon/identity" 8 cbg "github.com/whyrusleeping/cbor-gen" 9) 10 11 12type DidCredentials struct { 13 VerificationMethods map[string]string `json:"verificationMethods"` 14 RotationKeys []string `json:"rotationKeys"` 15 AlsoKnownAs []string `json:"alsoKnownAs"` 16 Services map[string]identity.OperationService `json:"services"` 17} 18 19type Operation struct { 20 Type string `json:"type"` 21 VerificationMethods map[string]string `json:"verificationMethods"` 22 RotationKeys []string `json:"rotationKeys"` 23 AlsoKnownAs []string `json:"alsoKnownAs"` 24 Services map[string]identity.OperationService `json:"services"` 25 Prev *string `json:"prev"` 26 Sig string `json:"sig,omitempty"` 27} 28 29type OperationService struct { 30 Type string `json:"type"` 31 Endpoint string `json:"endpoint"` 32} 33 34func (po *Operation) MarshalCBOR() ([]byte, error) { 35 if po == nil { 36 return cbg.CborNull, nil 37 } 38 39 b, err := json.Marshal(po) 40 if err != nil { 41 return nil, err 42 } 43 44 var m map[string]any 45 if err := json.Unmarshal(b, &m); err != nil { 46 return nil, err 47 } 48 49 b, err = atdata.MarshalCBOR(m) 50 if err != nil { 51 return nil, err 52 } 53 54 return b, nil 55}