Skip to content

Conversation

@cameronaaron
Copy link
Contributor

Summary

  • Migrate from archived encrypt package to actively maintained cryptography package
  • Upgrade objectbox from 4.0.3 to ^5.0.3

Changes

  • encrypt: ^5.0.3cryptography: ^2.7.0
  • objectbox: 4.0.3objectbox: ^5.0.3
  • Updated crypto functions to async (cryptography package doesn't support sync operations)
  • Added ServerPayload.fromJsonAsync() static factory for encrypted payloads
  • Updated all call sites in action_handler.dart and method_channel_service.dart

Why

The encrypt package is archived and no longer maintained. The cryptography package is actively maintained and provides modern encryption APIs.

Testing

  • flutter analyze: 0 errors (451 pre-existing warnings/infos)
  • flutter pub get: Dependencies resolve cleanly

## Breaking Changes
- Replace `encrypt` package (archived June 2025) with `cryptography` ^2.7.0
- Upgrade `objectbox` from 4.0.3 to ^5.0.3

## Migration Details

### Encryption Migration
- `cryptography` package requires async encryption/decryption operations
- Added `ServerPayload.fromJsonAsync()` for encrypted payload handling
- Updated all payload consumers (action_handler, method_channel_service) to await async factory
- Maintained `ServerPayload.fromJson()` for backward compatibility with non-encrypted payloads
- Socket service callback updated to handle async decryption

### ObjectBox Upgrade
- Regenerated objectbox model and generated files for v5.0.3 compatibility
- No schema changes required

## Validation
✅ flutter pub get - dependencies resolve cleanly
✅ flutter analyze - 0 errors (only pre-existing warnings)
✅ build_runner build - successful (10 outputs)

Fixes encrypted payload handling for users with guidAuthKey configured.
Copilot AI review requested due to automatic review settings December 6, 2025 20:24
@jjoelj
Copy link
Member

jjoelj commented Dec 6, 2025

#2959 switches to encrypter_plus and upgrades objectbox

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request migrates the project from the archived encrypt package to the actively maintained cryptography package, and upgrades objectbox from version 4.0.3 to ^5.0.3. The migration requires making encryption/decryption operations async, which cascades to multiple call sites throughout the codebase.

  • Package Migration: Replaces encrypt: ^5.0.3 with cryptography: ^2.7.0 due to the original package being archived
  • ObjectBox Upgrade: Updates from pinned version 4.0.3 to ^5.0.3, removing the Windows compatibility restriction
  • Async Refactoring: Converts encryptAESCryptoJS and decryptAESCryptoJS functions to async, updating all dependent code paths

Reviewed changes

Copilot reviewed 11 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pubspec.yaml Updated encrypt to cryptography and objectbox to ^5.0.3
pubspec.lock Updated dependency versions including major upgrades to analyzer, build, and related packages
lib/utils/crypto_utils.dart Refactored encryption/decryption functions to use cryptography package APIs with async operations
lib/database/global/server_payload.dart Added fromJsonAsync static factory method to handle encrypted payloads asynchronously
lib/services/network/socket_service.dart Updated to use async decryption in socket message handler
lib/services/backend/java_dart_interop/method_channel_service.dart Migrated all payload parsing to use fromJsonAsync for consistency
lib/services/backend/action_handler.dart Updated event handlers to use async payload processing
lib/objectbox.g.dart Regenerated ObjectBox bindings for version 5.0.3 with improved formatting
iOS/macOS Flutter config files Added CocoaPods configuration includes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cameronaaron
Copy link
Contributor Author

#2959 switches to encrypter_plus and upgrades objectbox

Oh let me know when this is done there is other modernization I was working on that was blocked by the older encryption lib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants