Skip to content

Comments

Add SPM support, add base64 challenge support, implement generateAssertion on iOS#3

Open
slawomir-krol-s3 wants to merge 2 commits intoErluan:mainfrom
slawomir-krol-s3:main
Open

Add SPM support, add base64 challenge support, implement generateAssertion on iOS#3
slawomir-krol-s3 wants to merge 2 commits intoErluan:mainfrom
slawomir-krol-s3:main

Conversation

@slawomir-krol-s3
Copy link

@slawomir-krol-s3 slawomir-krol-s3 commented Dec 10, 2025

iOS SPM Support and Assertion Generation

Summary

Added Swift Package Manager support, enhanced Base64 challenge handling, and implemented assertion generation functionality for iOS App Attest.

Changes Made

iOS Platform Enhancements

Swift Package Manager (SPM) Support

  • Removed CocoaPods dependency from example project
  • Deleted Podfile and Podfile.lock
  • Migrated to SPM for better dependency management and future compatibility
  • Updated Xcode project configuration to support SPM

Base64URL Challenge Support

  • Added automatic detection and decoding of Base64URL encoded challenges
  • Supports both plain text and Base64URL encoded challenge strings
  • Ensures proper challenge handling in both generateKeyAndAttest and generateAssertion methods

Assertion Generation API

  • Implemented generateAssertion method for iOS platform
  • Allows generating assertions for existing attested keys
  • Supports validation of previously attested devices
  • Properly handles client data hashing with SHA256
  • Returns base64-encoded assertion objects for server verification

Code Quality Improvements

Swift Code Refactoring

  • Enhanced error handling with detailed error messages
  • Improved completion handler implementations
  • Added validation for minimum client data size (16 bytes as per Apple docs)
  • Better separation of concerns in AppDeviceIntegrity class

Dart API Updates

  • Added generateAssertion method to public API
  • Platform-specific assertion method with iOS-only support
  • Comprehensive documentation for new API methods
  • Proper platform validation with PlatformException

Example App Updates

  • Updated integration tests to use getAttestationServiceSupport
  • Added proper error handling for simulator/unsupported devices
  • Improved test coverage with meaningful assertions
  • Updated AppDelegate.swift to use modern @main annotation

Technical Details

Files Modified:

  • lib/app_device_integrity.dart - Added generateAssertion API
  • lib/app_device_integrity_platform_interface.dart - Added interface method
  • lib/app_device_integrity_method_channel.dart - Implemented method channel
  • ios/.../AppDeviceIntegrity.swift - Added assertion generation logic
  • ios/.../AppDeviceIntegrityPlugin.swift - Added method handler
  • example/integration_test/plugin_integration_test.dart - Updated tests
  • example/ios/Podfile - Removed (migrated to SPM)
  • example/ios/Runner/AppDelegate.swift - Updated to modern Swift syntax

Breaking Changes:

  • None - All changes are additive and backward compatible

New Features:

  • Base64URL challenge support
  • Assertion generation for existing keys
  • SPM support for easier iOS integration

Testing

  • Integration tests updated and passing
  • Tested on iOS physical devices and simulator
  • Proper error handling for unsupported devices verified

Migration Guide

For projects using this plugin:

  1. No code changes required for existing functionality
  2. Optional: Use generateAssertion for validating previously attested devices
  3. iOS projects can now use SPM instead of CocoaPods

Version

Updated to version 1.2.0 in pubspec.yaml

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.

1 participant