Encrypted messaging app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB

package Models
import "github.com/gofrs/uuid"
type MessageData struct {
Base
Data []byte `gorm:"not null" json:"data"` // Stored encrypted
SenderID []byte `gorm:"not null" json:"sender_id"`
}
type Message struct {
Base
MessageDataID uuid.UUID `json:"-"`
MessageData MessageData `json:"message_data"`
SymmetricKey []byte `gorm:"not null" json:"symmetric_key"` // Stored encrypted
MessageThreadKey string `gorm:"not null" json:"message_thread_key"`
}
type MessageThread struct {
Base
Name []byte `gorm:"not null" json:"name"`
Users []byte `json:"users"`
}
type MessageThreadUser struct {
Base
UserID uuid.UUID `gorm:"type:uuid;column:user_id;not null;" json:"user_id"`
User User `json:"user"`
MessageThreadID []byte `gorm:"not null" json:"message_thread_link_id"`
MessageThreadKey []byte `gorm:"not null" json:"message_thread_key"`
Admin []byte `gorm:"not null" json:"admin"` // Bool if user is admin of thread, stored encrypted
SymmetricKey []byte `gorm:"not null" json:"symmetric_key"` // Stored encrypted
}