A very experimental PLC implementation which uses BFT consensus for decentralization
1package types
2
3import (
4 "time"
5
6 "github.com/did-method-plc/go-didplc"
7 "github.com/ipfs/go-cid"
8)
9
10type SequencedLogEntry struct {
11 Seq uint64
12 DID string
13 Operation didplc.OpEnum
14 CID cid.Cid
15 Nullified bool
16 CreatedAt time.Time
17}
18
19func (l SequencedLogEntry) ToDIDPLCLogEntry() didplc.LogEntry {
20 return didplc.LogEntry{
21 DID: l.DID,
22 Operation: l.Operation,
23 CID: l.CID.String(),
24 Nullified: l.Nullified,
25 CreatedAt: l.CreatedAt.Format(ActualAtprotoDatetimeLayout),
26 }
27}
28
29// ActualAtprotoDatetimeLayout is the format for CreatedAt timestamps
30// AtprotoDatetimeLayout as defined by github.com/bluesky-social/indigo/atproto/syntax omits trailing zeros in the milliseconds
31// This doesn't match how the official plc.directory implementation formats them, so we define that format here with trailing zeros included
32const ActualAtprotoDatetimeLayout = "2006-01-02T15:04:05.000Z"