diff options
| author | Fuwn <[email protected]> | 2026-02-26 14:46:02 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-26 14:48:52 -0800 |
| commit | 0099d621e97b6048971fadb5c71918cc9f2b5a09 (patch) | |
| tree | a38ba31585200bacd61f453ef7158de7f0aaf7a3 /internal/types/state.go | |
| parent | Initial commit (diff) | |
| download | plutia-test-0099d621e97b6048971fadb5c71918cc9f2b5a09.tar.xz plutia-test-0099d621e97b6048971fadb5c71918cc9f2b5a09.zip | |
feat: initial Plutia release — verifiable high-performance PLC mirror (mirror + resolver modes)
Diffstat (limited to 'internal/types/state.go')
| -rw-r--r-- | internal/types/state.go | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/internal/types/state.go b/internal/types/state.go new file mode 100644 index 0000000..cba1235 --- /dev/null +++ b/internal/types/state.go @@ -0,0 +1,45 @@ +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"` +} + +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"` +} |