an app.bsky.* indexer
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 CreatedAt: out.CreatedAt,
33 DisplayName: out.DisplayName,
34 Handle: out.Handle,
35 Subject: out.Subject,
36 }
37
38 return &verification
39}