Live video on the AT Protocol

spid: move cid and tid handlers into dedicated package

+22 -2
+1 -1
pkg/atproto/get_cid.go pkg/spid/cid.go
··· 1 - package atproto 1 + package spid 2 2 3 3 import ( 4 4 "bytes"
+2 -1
pkg/atproto/lexicon_repo.go
··· 29 29 "stream.place/streamplace/pkg/config" 30 30 "stream.place/streamplace/pkg/log" 31 31 "stream.place/streamplace/pkg/model" 32 + "stream.place/streamplace/pkg/spid" 32 33 "stream.place/streamplace/pkg/statedb" 33 34 ) 34 35 ··· 247 248 } 248 249 sfw := &SchemaFileWrapper{SchemaFile: lexFile} 249 250 rpath := fmt.Sprintf("com.atproto.lexicon.schema/%s", lexFile.ID) 250 - newCid, err := GetCID(sfw) 251 + newCid, err := spid.GetCID(sfw) 251 252 if err != nil { 252 253 return nil, err 253 254 }
+19
pkg/spid/tid.go
··· 1 + package spid 2 + 3 + import ( 4 + "crypto/rand" 5 + "math/big" 6 + 7 + "github.com/bluesky-social/indigo/atproto/syntax" 8 + ) 9 + 10 + var TIDClock *syntax.TIDClock 11 + 12 + func init() { 13 + id, err := rand.Int(rand.Reader, big.NewInt(1024)) 14 + if err != nil { 15 + panic(err) 16 + } 17 + clock := syntax.NewTIDClock(uint(id.Uint64())) 18 + TIDClock = &clock 19 + }