|
package Models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/gofrs/uuid"
|
|
)
|
|
|
|
// TODO: Add support for images
|
|
type MessageData struct {
|
|
Base
|
|
Data string `gorm:"not null" json:"data"` // Stored encrypted
|
|
SenderID string `gorm:"not null" json:"sender_id"` // Stored encrypted
|
|
SymmetricKey string `gorm:"not null" json:"symmetric_key"` // Stored encrypted
|
|
}
|
|
|
|
type Message struct {
|
|
Base
|
|
MessageDataID uuid.UUID `json:"message_data_id"`
|
|
MessageData MessageData `json:"message_data"`
|
|
SymmetricKey string `json:"symmetric_key" gorm:"not null"` // Stored encrypted
|
|
AssociationKey string `json:"association_key" gorm:"not null"` // TODO: This links all encrypted messages for a user in a thread together. Find a way to fix this
|
|
CreatedAt time.Time `json:"created_at" gorm:"not null"`
|
|
}
|