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.

24 lines
828 B

  1. package Models
  2. import (
  3. "time"
  4. "github.com/gofrs/uuid"
  5. )
  6. // TODO: Add support for images
  7. type MessageData struct {
  8. Base
  9. Data string `gorm:"not null" json:"data"` // Stored encrypted
  10. SenderID string `gorm:"not null" json:"sender_id"` // Stored encrypted
  11. SymmetricKey string `gorm:"not null" json:"symmetric_key"` // Stored encrypted
  12. }
  13. type Message struct {
  14. Base
  15. MessageDataID uuid.UUID `json:"message_data_id"`
  16. MessageData MessageData `json:"message_data"`
  17. SymmetricKey string `json:"symmetric_key" gorm:"not null"` // Stored encrypted
  18. 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
  19. CreatedAt time.Time `json:"created_at" gorm:"not null"`
  20. }