Documentation
¶
Index ¶
- type FileService
- type Note
- type NoteService
- type Service
- func (s *Service) DecryptData(encryptedData []byte, phrase string) ([]byte, error)
- func (s *Service) DecryptString(encryptedText string, phrase string) (string, error)
- func (s *Service) DeriveKey(phrase string, salt []byte) []byte
- func (s *Service) EncryptData(data []byte, phrase string) ([]byte, error)
- func (s *Service) EncryptString(text string, phrase string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileService ¶
type FileService struct {
App *pocketbase.PocketBase
Encryption *Service
}
FileService handles encrypted file operations
func NewFileService ¶
func NewFileService(app *pocketbase.PocketBase, encryption *Service) *FileService
NewFileService creates a new file service
func (*FileService) DeleteEncryptedFile ¶
func (f *FileService) DeleteEncryptedFile(phrase string) error
DeleteEncryptedFile deletes an encrypted file record (file bytes are removed by PocketBase)
func (*FileService) RetrieveDecryptedFile ¶
RetrieveDecryptedFile retrieves and decrypts a file from the file_data field
func (*FileService) StoreEncryptedFile ¶
func (f *FileService) StoreEncryptedFile(phrase string, file multipart.File, filename, contentType string) (string, error)
StoreEncryptedFile stores an encrypted file (encrypted bytes go into the file_data field)
type Note ¶
type Note struct {
ID string `json:"id"`
Phrase string `json:"phrase"` // Encrypted identifier
Message string `json:"message"` // Encrypted note content
ImageHash string `json:"image_hash"` // Hash for encrypted image lookup
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
}
Note represents a secret note
type NoteService ¶
type NoteService struct {
App *pocketbase.PocketBase
Encryption *Service
}
NoteService handles note operations
func NewNoteService ¶
func NewNoteService(app *pocketbase.PocketBase, encryption *Service) *NoteService
NewNoteService creates a new note service
func (*NoteService) DeleteNote ¶
func (n *NoteService) DeleteNote(phrase string) error
DeleteNote deletes a note
func (*NoteService) GetOrCreateNote ¶
func (n *NoteService) GetOrCreateNote(phrase string) (*Note, error)
GetOrCreateNote retrieves an existing note or creates a new one
func (*NoteService) UpdateNote ¶
func (n *NoteService) UpdateNote(phrase, message string) (*Note, error)
UpdateNote updates an existing note
func (*NoteService) UpdateNoteImageHash ¶
func (n *NoteService) UpdateNoteImageHash(phrase, imageHash string) error
UpdateNoteImageHash updates the image hash for a note
type Service ¶
Service provides encryption and decryption functionality
func NewEncryptionService ¶
func NewEncryptionService() *Service
NewEncryptionService creates a new encryption service
func (*Service) DecryptData ¶
DecryptData decrypts data using AES-256-GCM
func (*Service) DecryptString ¶
DecryptString decrypts a base64 encoded string and returns the original string
func (*Service) EncryptData ¶
EncryptData encrypts data using AES-256-GCM