feat(swift-sdk): public RawKeySigner one-shot raw-key signing#4097
Conversation
Extract the dash_sdk_signer_create_from_private_key → sign → destroy FFI round-trip from KeychainSigner.ffiSign into a public RawKeySigner enum, so callers that already hold 32-byte key material (e.g. a derivation-path lookup) can sign without constructing a KeychainSigner/KeyManager stack. KeychainSigner.ffiSign delegates to it, keeping a single implementation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 39 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds ChangesRaw key signing
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🔍 Review in progress — actively reviewing now (commit d7aee13) |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/swift-sdk/Sources/SwiftDashSDK/FFI/KeychainSigner.swift`:
- Around line 716-732: Update ffiSign’s KeyManagerError.invalidKeyFormat catch
branch to return the error category intended for invalid signing input rather
than .ffiSignerCreationFailed, while preserving the original message and leaving
signerCreationFailed and signingFailed mappings unchanged.
In `@packages/swift-sdk/Sources/SwiftDashSDK/KeyWallet/KeyManager.swift`:
- Line 12: Remove the new public KeyManagerError.signingFailed case and update
the affected KeyManager error path to reuse an existing error case. Do not
expand the public enum API or introduce another case.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 67d3ea1c-bd23-4fb0-909d-2e39b6b7b67a
📒 Files selected for processing (2)
packages/swift-sdk/Sources/SwiftDashSDK/FFI/KeychainSigner.swiftpackages/swift-sdk/Sources/SwiftDashSDK/KeyWallet/KeyManager.swift
Review fix for #4097: KeyManagerError.invalidKeyFormat surfaced as a bare "Failed to construct FFI signer" message, pointing debugging at the FFI layer for what is pre-FFI input validation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Issue being fixed or feature implemented
Callers that already hold 32-byte key material (e.g. from a derivation-path lookup) had no way to sign without constructing a full
KeychainSigner/KeyManagerstack — the create-signer → sign → destroy FFI round-trip was private toKeychainSigner.ffiSign.dashwallet-ios needs this entry point and has been carrying it on its platform pin branch; upstreaming it shrinks the pin (see DASHSYNC_MIGRATION.md there).
What was done?
dash_sdk_signer_create_from_private_key→dash_sdk_signer_sign→dash_sdk_signer_destroyround-trip into a publicRawKeySignerenum (inKeyWallet/KeyManager.swift), with a typedKeyManagerErrorsurface. The key copy is zeroed before returning.KeychainSigner.ffiSignnow delegates to it, keeping a single implementation of the round-trip.OpaquePointer, matching the current header import.How Has This Been Tested?
KeychainSigner).Breaking Changes
None.
KeychainSigner's public API is unchanged;RawKeySigneris additive.Checklist:
For repository code-owners and collaborators only
🤖 Generated with Claude Code
Summary by CodeRabbit