feat: implement patch expiration and encryption features

- Add offline expiration handling for patch artifacts in the database.
- Update CreatePatchArtifact and related functions to accept and return offline expiration timestamps.
- Enhance patch check responses to include offline expiration metadata.
- Introduce device-specific encryption for patches, allowing for secure delivery.
- Implement tests for patch check functionality, including scenarios for expired patches and encrypted delivery.
- Modify router and configuration to support new patch delivery settings.
- Update database schema and migrations to accommodate new fields for offline expiration.
This commit is contained in:
Tony
2026-06-24 03:02:09 +08:00
parent 3a62e35c5d
commit 774954fce7
16 changed files with 853 additions and 104 deletions
+5 -1
View File
@@ -78,7 +78,11 @@ func main() {
log.Printf("Storage: %s", store.BackendName())
// --- Router ---
router := handlers.NewRouter(authService, database, store, mailer, cfg.Server.BaseURL)
router := handlers.NewRouter(authService, database, store, mailer, cfg.Server.BaseURL, handlers.PatchDeliveryConfig{
EncryptionMode: cfg.PatchDelivery.EncryptionMode,
AESSecret: []byte(cfg.PatchDelivery.AESSecret),
CacheEncryptedPatches: cfg.PatchDelivery.CacheEncryptedPatches,
})
// --- HTTP Server ---
addr := fmt.Sprintf("%s:%s", cfg.Server.Host, cfg.Server.Port)