mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-23 00:34:27 +01:00
Add comments for shared data structures
This commit is contained in:
parent
824fffc14f
commit
c08c9d68ff
@ -7,6 +7,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Represents an encrypted history entry
|
||||||
type EncHistoryEntry struct {
|
type EncHistoryEntry struct {
|
||||||
EncryptedData []byte `json:"enc_data"`
|
EncryptedData []byte `json:"enc_data"`
|
||||||
Nonce []byte `json:"nonce"`
|
Nonce []byte `json:"nonce"`
|
||||||
@ -35,12 +36,15 @@ type Device struct {
|
|||||||
RegistrationDate time.Time `json:"registration_date"`
|
RegistrationDate time.Time `json:"registration_date"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Represents a request to get all history entries from a given device. Used as part of bootstrapping
|
||||||
|
// a new device.
|
||||||
type DumpRequest struct {
|
type DumpRequest struct {
|
||||||
UserId string `json:"user_id"`
|
UserId string `json:"user_id"`
|
||||||
RequestingDeviceId string `json:"requesting_device_id"`
|
RequestingDeviceId string `json:"requesting_device_id"`
|
||||||
RequestTime time.Time `json:"request_time"`
|
RequestTime time.Time `json:"request_time"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Identifies where updates can be downloaded from
|
||||||
type UpdateInfo struct {
|
type UpdateInfo struct {
|
||||||
LinuxAmd64Url string `json:"linux_amd_64_url"`
|
LinuxAmd64Url string `json:"linux_amd_64_url"`
|
||||||
LinuxAmd64AttestationUrl string `json:"linux_amd_64_attestation_url"`
|
LinuxAmd64AttestationUrl string `json:"linux_amd_64_attestation_url"`
|
||||||
@ -57,21 +61,34 @@ type UpdateInfo struct {
|
|||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Represents a request to delete history entries
|
||||||
type DeletionRequest struct {
|
type DeletionRequest struct {
|
||||||
UserId string `json:"user_id"`
|
// The UserID that we're deleting entries for
|
||||||
DestinationDeviceId string `json:"destination_device_id"`
|
UserId string `json:"user_id"`
|
||||||
SendTime time.Time `json:"send_time"`
|
// The DeviceID that is handling this deletion request. This struct is duplicated and put into the queue
|
||||||
Messages MessageIdentifiers `json:"messages"`
|
// for each of a user's devices.
|
||||||
ReadCount int `json:"read_count"`
|
DestinationDeviceId string `json:"destination_device_id"`
|
||||||
|
// When this deletion request was sent
|
||||||
|
SendTime time.Time `json:"send_time"`
|
||||||
|
// The history entries to delete
|
||||||
|
Messages MessageIdentifiers `json:"messages"`
|
||||||
|
// How many times this request has been processed
|
||||||
|
ReadCount int `json:"read_count"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Identifies a list of history entries that should be deleted
|
||||||
type MessageIdentifiers struct {
|
type MessageIdentifiers struct {
|
||||||
Ids []MessageIdentifier `json:"message_ids"`
|
Ids []MessageIdentifier `json:"message_ids"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Identifies a single history entry based on the device that recorded the entry, and the end time. Note that
|
||||||
|
// this does not include the command itself since that would risk including the sensitive data that is meant
|
||||||
|
// to be deleted
|
||||||
type MessageIdentifier struct {
|
type MessageIdentifier struct {
|
||||||
DeviceId string `json:"device_id"`
|
// The device that the entry was recorded on (NOT the device where it is stored/requesting deletion)
|
||||||
Date time.Time `json:"date"`
|
DeviceId string `json:"device_id"`
|
||||||
|
// The timestamp when the message finished running
|
||||||
|
Date time.Time `json:"date"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MessageIdentifiers) Scan(value interface{}) error {
|
func (m *MessageIdentifiers) Scan(value interface{}) error {
|
||||||
@ -90,6 +107,7 @@ func (m MessageIdentifiers) Value() (driver.Value, error) {
|
|||||||
return json.Marshal(m)
|
return json.Marshal(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Represents a piece of user feedback, submitted upon uninstall
|
||||||
type Feedback struct {
|
type Feedback struct {
|
||||||
UserId string `json:"user_id" gorm:"not null"`
|
UserId string `json:"user_id" gorm:"not null"`
|
||||||
Date time.Time `json:"date" gorm:"not null"`
|
Date time.Time `json:"date" gorm:"not null"`
|
||||||
|
Loading…
Reference in New Issue
Block a user