✨ (device-management-kit) [NO-ISSUE]: Detect onboarded device from GetOsVersion#1521
Draft
pdeville-ledger wants to merge 1 commit into
Draft
✨ (device-management-kit) [NO-ISSUE]: Detect onboarded device from GetOsVersion#1521pdeville-ledger wants to merge 1 commit into
pdeville-ledger wants to merge 1 commit into
Conversation
…tOsVersion Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
Contributor
Comment on lines
+135
to
+137
| if (state.sessionStateType === DeviceSessionStateType.Connected) { | ||
| return undefined; | ||
| } |
Contributor
There was a problem hiding this comment.
I believe that two other DeviceSessionType have the metadata, i don't know if we actually use them, but in case we're in those states, you'll miss the data.
Maybe replace by if "firmwareVersion" in state.
Comment on lines
+122
to
+124
| if (currentState.sessionStateType === DeviceSessionStateType.Connected) { | ||
| return; | ||
| } |
Contributor
There was a problem hiding this comment.
this might be unnecessary and not optimal (for instance when in state Connected, you're not updating firmwareVersion even though it could be undefined.
IMO you can always override as your data here is the most up to date.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



📝 Description
GetDeviceStatusDeviceActionwas returningisDeviceOnboarded: () => true, soDeviceNotOnboardedErrorcould never trigger and UIs (e.g. Ledger Button) had no way to detect an unseeded device.This PR replaces the stub by reading
secureElementFlags.isOnboardedfromGetOsVersionCommand(no secure channel required), following the existing pattern inListInstalledAppsDeviceAction.GetDeviceStatusDeviceAction:OnboardingCheckreads cachedfirmwareVersion.metadatafirst; otherwise runsGetOsVersionCommandand branches onisOnboarded.firmwareVersion(incl.metadata) andisSecureConnectionAllowed, so consumers readinggetDeviceSessionState()get onboarding info without an extra command.isDeviceOnboardedmachine dependency / sync guard.OpenAppDeviceAction:OnboardingCheck; relies on the fixedGetDeviceStatuschild machine.GetOsVersionCommandinstead of injectingisDeviceOnboarded; cover both the cached-metadata fast path and the live fetch path.❓ Context
✅ Checklist
GetDeviceStatusDeviceActionmay now returnLeft(DeviceNotOnboardedError)for unseeded devices.OpenAppDeviceActionno longer emits its own pre-GetDeviceStatusonboarding step; consumers asserting on the state sequence may need updates.MachineDependenciesof both actions changed (isDeviceOnboardedremoved;getOsVersionadded onGetDeviceStatus).firmwareVersion.metadataandisSecureConnectionAllowedafterGetDeviceStatussucceeds in a ready state.Made with Cursor