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.

28 lines
1018 B

  1. package Models
  2. import (
  3. "database/sql"
  4. "time"
  5. "github.com/gofrs/uuid"
  6. )
  7. // MessageData holds the content of the message
  8. // encrypted through the Message.SymmetricKey
  9. type MessageData struct {
  10. Base
  11. Data string `gorm:"not null" json:"data"` // Stored encrypted
  12. SenderID string `gorm:"not null" json:"sender_id"` // Stored encrypted
  13. SymmetricKey string `gorm:"not null" json:"symmetric_key"` // Stored encrypted
  14. }
  15. // Message holds data pertaining to each users' message
  16. type Message struct {
  17. Base
  18. MessageDataID uuid.UUID ` json:"message_data_id"`
  19. MessageData MessageData ` json:"message_data"`
  20. SymmetricKey string `gorm:"not null" json:"symmetric_key"` // Stored encrypted
  21. AssociationKey string `gorm:"not null" json:"association_key"` // Stored encrypted
  22. Expiry sql.NullTime ` json:"expiry"`
  23. CreatedAt time.Time `gorm:"not null" json:"created_at"`
  24. }