Repository navigation
feat: add the DIP-13 rotation level to application encryption keys - #42
Merged
HashEngineering merged 2 commits intoOct 29, 2026
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
HashEngineering
self-requested a review
October 29, 2026 16:32
HashEngineering
approved these changes
Oct 29, 2026
PastaPastaPasta
force-pushed
the
feat/app-encryption-rotation
branch
from
October 29, 2026 16:36
b3ff215 to
f010eec
Compare
The application encryption path ends with a hardened 31-bit rotation level (dashpay/dips#191, used by the App Connect DIP, dashpay/dips#181): m/9'/coin'/5'/7'/0'/identityId'/contractId'/purpose'/rotation' with rotation 0' first. Without it the path becomes permanent with the first mainnet key and a compromised or retired key could never be replaced. platform-mobile: application_encryption_private_key_from_seed takes a rotation (below 2^31, an error otherwise) and appends it as a hardened level. The 8-level path without rotation stays available as application_encryption_legacy_private_key_from_seed, only to recognise keys that wallets registered on testnet/devnet before the rotation level existed. Tests pin the DIP vectors for both paths (abandon x11 about, mainnet). Bindings: Ferment output for dash-sdk-bindings and dash-sdk-android now has the new signature and the legacy function (regenerated with cargo build of dash-sdk-bindings; the Android copy carries the same two functions), plus a SWIG rename for applicationEncryptionLegacyPrivateKeyFromSeed. Kotlin: ApplicationKeyDerivation.encryption gains a required rotation parameter, so callers must choose it; new keys use 0. The pre-rotation path is the explicitly named legacyEncryptionWithoutRotation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PastaPastaPasta
force-pushed
the
feat/app-encryption-rotation
branch
from
October 29, 2026 17:00
f010eec to
ca1082e
Compare
HashEngineering
added a commit
that referenced
this pull request
Nov 9, 2026
…on (#41) * feat: support 4.2-dev * feat: upgrade to v4.2-dev.8 * feat: expose the network's Platform protocol version Add get_protocol_version_with_sdk and refresh_protocol_version_with_sdk exports (fermented bindings regenerated) and DapiClient.getProtocolVersion() / refreshProtocolVersion() wrappers. refresh issues a proven getEpochsInfo query and ratchets dash-sdk up to the version the network runs, so wallets can pick fees that depend on the activated protocol version (e.g. the contested username prefunded voting balance, 0.2 -> 0.1 DASH in v14). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ci: skip retired Android SDK tools package * feat: upgrade to Platform 5.0 and support App Connect Expose bounded V1 identity keys, DIP-13 application key derivation, remaining budgets, and explicit devnet configuration across Rust, JNI, and Kotlin. Fix V1 native enum widths and index-only response confirmation using the submitted PV14 nonce-derived document ID. Add regression coverage and build against HashEngineering/platform ferment-5.0. * feat: expose safe wallet token-purchase requests Decode one exact unsigned direct-purchase batch, verify token identity and denomination, and rebuild approved values with a fresh nonce and an unbound CRITICAL wallet key. Reject unsupported operations and hidden fee or group changes. Add native decoder and JNI boundary regression tests. Treat purchase proof results as affected-state snapshots rather than execution confirmation. * fix: provision wallet signing keys and prove current application key index * fix: propagate data contract query and conversion failures * fix: require opt-in critical key migration and use DashJ 24 * fix: guard identity updates and wallet signing with caller authorization * Expose complete proof-verified contract group scope for Android Replace the owner-only bridge limitation that forced the wallet to block Yappr's group-bound CRITICAL grants. Verify all member pages at one block, expose admins and each member kind, and retain explicit errors instead of partial scope. Order Android native builds after SWIG generation to prevent stale JNI wrappers. Document the rationale and verified test coverage. * Pin DashJ 24 to the published timestamped build Use 24.0.0-20261024.220449-1 instead of the moving SNAPSHOT alias. Record the publicly resolved JAR checksum and snapshot retention caveat; native SDK code is unchanged. * Preserve purchase operation nonces and expose canonical replay IDs * Upgrade Platform SDK integration to 5.0.1 * Regenerate Android Ferment bindings for Platform 5.0.1 * Use unsigned local publication in SDK CI * chore: set dash-sdk-bindings to 5.0.1 * feat: add the DIP-13 rotation level to application encryption keys (#42) The application encryption path ends with a hardened 31-bit rotation level (dashpay/dips#191, used by the App Connect DIP, dashpay/dips#181): m/9'/coin'/5'/7'/0'/identityId'/contractId'/purpose'/rotation' with rotation 0' first. Without it the path becomes permanent with the first mainnet key and a compromised or retired key could never be replaced. platform-mobile: application_encryption_private_key_from_seed takes a rotation (below 2^31, an error otherwise) and appends it as a hardened level. The 8-level path without rotation stays available as application_encryption_legacy_private_key_from_seed, only to recognise keys that wallets registered on testnet/devnet before the rotation level existed. Tests pin the DIP vectors for both paths (abandon x11 about, mainnet). Bindings: Ferment output for dash-sdk-bindings and dash-sdk-android now has the new signature and the legacy function (regenerated with cargo build of dash-sdk-bindings; the Android copy carries the same two functions), plus a SWIG rename for applicationEncryptionLegacyPrivateKeyFromSeed. Kotlin: ApplicationKeyDerivation.encryption gains a required rotation parameter, so callers must choose it; new keys use 0. The pre-rotation path is the explicitly named legacyEncryptionWithoutRotation. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: HashEngineering <hashengineeringsolutions@gmail.com> * fix: sync bindings lockfile with 5.0.1 * Forward declare ValueMap independently of generated header order Declare platform_value_value_map_ValueMap before including Ferment's generated header. This fixes the CI compile failure when Value is emitted before ValueMap without changing ABI or Platform versions. Add a native header-order regression. Verified the original and reordered generated headers, a clean C++ rebuild, and seven JNI ValueTest tests. * chore: prepare 5.0.1 Maven Central release --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
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.
Problem
The DIP-13 application encryption path ends at
purpose', so the key for a given identity, app contract and purpose is fixed forever. Once the first mainnet key is registered at that path it can never be replaced, even if it is compromised or retired. DIP-13 (dashpay/dips#191, used by the App Connect DIP, dashpay/dips#181) now ends the path with a hardened 31-bitrotation'level, with0'first:kotlin-platform still derives the 8-level path with no rotation, and that is what dash-wallet (Android) uses through this library.
Fix
platform-mobile/src/key_wallet.rs:application_encryption_private_key_from_seedtakesrotation: u32and appendsChildNumber::Hardened { index: rotation }. A rotation of 2^31 or more returns an error (sameResult<_, String>style as the purpose check).application_encryption_legacy_private_key_from_seedderives the 8-level path without rotation. It exists only to recognise keys that wallets registered on testnet/devnet before the rotation level existed; its docs say not to use it for new keys.dash-sdk-bindingsanddash-sdk-androidhas the new signature and the legacy function;key_wallet.igains the SWIG rename and%newobjectforapplicationEncryptionLegacyPrivateKeyFromSeed.Stacked on #41
This branch is based on
codex/upgrade-platform-4.2(head 8e1c91b, PR #41, Platform SDK 5.0.1), which is what dash-wallet uses. Merge commit 7a9fe9d brings this branch up to that head without changing the rotation feature files. The base is that branch, notmaster, so the diff shows only this change. Retarget tomasteronce #41 merges.Kotlin migration
ApplicationKeyDerivation.encryption(seed, identityId, contractId, purpose, rotation, isMainnet):rotationis a requiredLong(0 until 2^31, checked before the native call). It is required on purpose so callers choose it; new keys use0. This is source-breaking for existing callers.ApplicationKeyDerivation.legacyEncryptionWithoutRotation(seed, identityId, contractId, purpose, isMainnet)is the explicit pre-rotation path. Use it only to match keys already registered on testnet/devnet.Tested
Run here:
cargo test --lib key_walletinplatform-mobile: 5 tests pass. They pin the DIP vectors (BIP-39abandonx11about, empty passphrase, mainnet) for 5 rotation-level keys and 3 legacy keys, check that the rotation path is the legacy path plus a hardened level, that rotation2^31 - 1works and2^31/u32::MAXfail, and that network, purpose, contract, rotation and legacy/session paths give distinct keys.cargo buildindash-sdk-bindings(withcbindgen0.29.0 installed, as CI does) regenerated the Ferment bindings andtarget/include/dash_sdk_bindings.hwith both functions. Ferment reorders modules on every run, so the committedfermented.rsfiles carry only the two changed functions spliced into the existing ordering; the regenerated file and the committed one have the same token multiset.rustfmt --checkonkey_wallet.rs.This repo's CI runs only for PRs into
main/master/develop, so it doesn't build this stacked PR. The same workflow (build-and-verify-alignment) ran on an earlier feature head (b3ff215) in a fork: https://github.com/PastaPastaPasta/kotlin-platform/actions/runs/40779341353. cbindgen, SWIG generation, CMake,./gradlew build -x test, the 16 KB alignment check and the AAR check passed there. After merging the final 5.0.1 base,cargo test --locked --offline --manifest-path platform-mobile/Cargo.toml --lib key_walletpassed all five tests, and./gradlew :dash-sdk-java:cmakeBuild :dpp:test --tests '*AppConnectKeyTest' -PskipSigningpassed locally. Thedash-sdk-androidcrate was not regenerated on its own; itsfermented.rsgot the same two functions as thedash-sdk-bindingsone.🤖 Generated with Claude Code