this repo has no description

use TID for rkeys

Akshay 15b75864 add4ad7b

Changed files
+11 -3
appview
state
+11 -3
appview/state/state.go
··· 12 12 "time" 13 13 14 14 comatproto "github.com/bluesky-social/indigo/api/atproto" 15 + "github.com/bluesky-social/indigo/atproto/syntax" 15 16 lexutil "github.com/bluesky-social/indigo/lex/util" 16 17 "github.com/gliderlabs/ssh" 17 18 "github.com/go-chi/chi/v5" ··· 28 29 db *db.DB 29 30 auth *auth.Auth 30 31 enforcer *rbac.Enforcer 32 + tidClock *syntax.TIDClock 31 33 } 32 34 33 35 func Make() (*State, error) { ··· 47 49 return nil, err 48 50 } 49 51 50 - return &State{db, auth, enforcer}, nil 52 + clock := syntax.NewTIDClock(0) 53 + 54 + return &State{db, auth, enforcer, clock}, nil 55 + } 56 + 57 + func (s *State) TID() string { 58 + return s.tidClock.Next().String() 51 59 } 52 60 53 61 func (s *State) Login(w http.ResponseWriter, r *http.Request) { ··· 202 210 resp, err := comatproto.RepoPutRecord(r.Context(), client, &comatproto.RepoPutRecord_Input{ 203 211 Collection: tangled.PublicKeyNSID, 204 212 Repo: did, 205 - Rkey: uuid.New().String(), 213 + Rkey: s.TID(), 206 214 Record: &lexutil.LexiconTypeDecoder{ 207 215 Val: &tangled.PublicKey{ 208 216 Created: time.Now().Format(time.RFC3339), ··· 411 419 resp, err := comatproto.RepoPutRecord(r.Context(), client, &comatproto.RepoPutRecord_Input{ 412 420 Collection: tangled.KnotMemberNSID, 413 421 Repo: currentUser.Did, 414 - Rkey: uuid.New().String(), 422 + Rkey: s.TID(), 415 423 Record: &lexutil.LexiconTypeDecoder{ 416 424 Val: &tangled.KnotMember{ 417 425 Member: memberIdent.DID.String(),