Harden CVC authentication and preserve APDU errors - #74
Draft
praveenperera wants to merge 8 commits into
Draft
Conversation
praveenperera
marked this pull request as draft
August 18, 2026 15:30
praveenperera
force-pushed
the
cvc-error-hardening
branch
from
August 18, 2026 18:50
25490f6 to
4d63e3c
Compare
Represent CVCs as zeroizing, redacted ASCII values and validate foreign and CLI inputs before card commands. Reject unsuccessful wait responses so authentication failures cannot appear as completed delays.
Keep unknown status codes and callback error variants intact so callers can classify protocol failures without parsing transport strings.
Regenerate the Swift bindings for the updated error model and handle UniFFI's module-based artifact names in the XCFramework build.
Return local CVC validation details through each operation instead of reporting them as card BadArguments errors. Name unknown CBOR error codes as card error codes, and document that the numeric CVC model targets public firmware 1.0.1 and later.
Trim surrounding whitespace from prompted CVC values and preserve internal whitespace for validation. Return xpub input and command failures instead of panicking.
Expose the new CVC and card error variants to Swift consumers. UniFFI 0.32 emits nonisolated(unsafe), which requires Swift 5.10. Raise the package minimum instead of patching generated source so the checked-in bindings remain direct generator output.
UniFFI 0.32 derives Swift artifact names from the configured CKTap module. Keep those names in the package and build script so generation no longer needs a version-dependent rename branch.
Deduplicate optional CVC parsing and ChangeError wrapping so card entry points map validation failures consistently.
praveenperera
force-pushed
the
cvc-error-hardening
branch
from
August 18, 2026 19:03
4d63e3c to
3d74272
Compare
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.
Summary
Cvctype for Rust callersBadArgumentschangeBadAuthwhen awaitresponse reports failurexpubfailures instead of panickingCompatibility
Cvcinstead of passing a raw stringUnknownStatusWordis renamed toUnknownErrorCodebecause the value comes from a CBOR card responsenonisolated(unsafe)Validation
cargo fmt --all --checkcargo test --workspacecargo clippy --all-features --all-targets -- -D warningsswift build