an app.bsky.* indexer
at master 883 B view raw
1package models 2 3import ( 4 "bytes" 5 "log/slog" 6 "time" 7 8 appbsky "github.com/bluesky-social/indigo/api/bsky" 9 "github.com/bluesky-social/indigo/atproto/syntax" 10) 11 12type GraphVerification struct { 13 ID string `gorm:"primaryKey"` 14 15 CreatedAt string 16 DisplayName string 17 Handle string 18 Subject string 19 20 AutoCreatedAt time.Time `gorm:"autoCreateTime"` 21 AutoUpdatedAt time.Time `gorm:"autoUpdateTime"` 22} 23 24func NewGraphVerification(uri syntax.ATURI, rec []byte) *GraphVerification { 25 var out appbsky.GraphVerification 26 if err := out.UnmarshalCBOR(bytes.NewReader(rec)); err != nil { 27 slog.Error("could not unmarshal graph verification CBOR", "err", err) 28 return nil 29 } 30 31 verification := GraphVerification{ 32 ID: string(uri), 33 CreatedAt: out.CreatedAt, 34 DisplayName: out.DisplayName, 35 Handle: out.Handle, 36 Subject: out.Subject, 37 } 38 39 return &verification 40}