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.6 KiB

  1. package Models
  2. import (
  3. "github.com/gofrs/uuid"
  4. )
  5. type ConversationDetail struct {
  6. Base
  7. Name string `gorm:"not null" json:"name"` // Stored encrypted
  8. Users []ConversationDetailUser ` json:"users"`
  9. }
  10. type ConversationDetailUser struct {
  11. Base
  12. ConversationDetailID uuid.UUID `gorm:"not null" json:"conversation_detail_id"`
  13. ConversationDetail ConversationDetail `gorm:"not null" json:"conversation"`
  14. UserID string `gorm:"not null" json:"user_id"` // Stored encrypted
  15. Username string `gorm:"not null" json:"username"` // Stored encrypted
  16. Admin string `gorm:"not null" json:"admin"` // Stored encrypted
  17. AssociationKey string `gorm:"not null" json:"association_key"` // Stored encrypted
  18. PublicKey string `gorm:"not null" json:"public_key"` // Stored encrypted
  19. }
  20. // Used to link the current user to their conversations
  21. type UserConversation struct {
  22. Base
  23. UserID uuid.UUID `gorm:"type:uuid;column:user_id;not null;" json:"user_id"`
  24. User User ` json:"user"`
  25. ConversationDetailID string `gorm:"not null" json:"conversation_detail_id"` // Stored encrypted
  26. Admin string `gorm:"not null" json:"admin"` // Bool if user is admin of thread, stored encrypted
  27. SymmetricKey string `gorm:"not null" json:"symmetric_key"` // Stored encrypted
  28. // TODO: Add association_key here
  29. }