aboutsummaryrefslogtreecommitdiff
path: root/internal/types/state.go
blob: 31b937271824260fc2b085a2a9449d47d69f6842 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package types

import "time"

// StateV1 is versioned for KV compatibility.
type StateV1 struct {
	Version      uint8     `json:"v"`
	DID          string    `json:"did"`
	DIDDocument  []byte    `json:"did_document"`
	ChainTipHash string    `json:"chain_tip_hash"`
	RotationKeys []string  `json:"rotation_keys,omitempty"`
	LatestOpSeq  uint64    `json:"latest_op_seq"`
	UpdatedAt    time.Time `json:"updated_at"`
}

type BlockRefV1 struct {
	Version   uint8  `json:"v"`
	BlockID   uint64 `json:"block_id"`
	Offset    uint64 `json:"offset"`
	Length    uint64 `json:"length"`
	OpSeq     uint64 `json:"op_seq"`
	DID       string `json:"did"`
	CID       string `json:"cid"`
	PrevCID   string `json:"prev_cid"`
	OpHash    string `json:"op_hash"`
	Received  string `json:"received"`
	CreatedAt string `json:"created_at,omitempty"`
}

type CheckpointReference struct {
	Sequence       uint64 `json:"sequence"`
	CheckpointHash string `json:"checkpoint_hash"`
}

// CheckpointV1 is serialized deterministically for signing.
type CheckpointV1 struct {
	Version                uint8  `json:"v"`
	Sequence               uint64 `json:"sequence"`
	Timestamp              string `json:"timestamp"`
	DIDMerkleRoot          string `json:"did_merkle_root"`
	BlockMerkleRoot        string `json:"block_merkle_root"`
	PreviousCheckpointHash string `json:"previous_checkpoint_hash"`
	KeyID                  string `json:"key_id"`
	Signature              string `json:"signature"`
	CheckpointHash         string `json:"checkpoint_hash"`
}