feat: add DeviceService and OnboardingService for device onboarding #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat: add DeviceService and OnboardingService for device onboarding
Summary
Adds device identity key management and onboarding functionality to the Swift SDK, translating the
StartOnboardingEventHandlerbehavior from the open-signer TypeScript implementation.New Components:
DeviceService- Actor that generates P-256 ECDH identity keys, stores them in UserDefaults, computes device ID (SHA-256 hash of public key, hex encoded), and provides serialized public key (base64 encoded)OnboardingService- Actor that orchestrates the startOnboarding API call with device ID and encryption contextAuthData- Struct containing JWT and apiKey for authenticated requestsNote: The
getMasterSecretstep is intentionally skipped per request - this can be added in a follow-up PR.Review & Testing Checklist for Human
rawRepresentationfrom CryptoKit P-256 matches what the backend expects. The open-signer uses Web Crypto'sexportKey("raw", publicKey)- confirm these produce identical byte sequences./ncs/v1/signers/start-onboardingis the correct endpoint path for the backend.Test Plan
swift testto execute unit tests (CI will handle this)DeviceServiceinstance, callgetId()andgetSerializedIdentityPublicKey(), and verify the formats match expected valuesOnboardingServicewith a realCrossmintServiceandDeviceService, callstartOnboarding(authId:authData:)with valid credentials, and verify the API call succeedsNotes