Skip to content

feat: import existing Platform identities - #68

Open
infraclaw-dash wants to merge 4 commits into
pshenmic:masterfrom
infraclaw-dash:feat/import-platform-identity
Open

feat: import existing Platform identities#68
infraclaw-dash wants to merge 4 commits into
pshenmic:masterfrom
infraclaw-dash:feat/import-platform-identity

Conversation

@infraclaw-dash

@infraclaw-dash infraclaw-dash commented Jul 24, 2026

Copy link
Copy Markdown

Summary

Adds a password-gated import flow for existing Dash Platform identities on the Identities page.

Users can identify the identity using any of:

  • its Base58 identity identifier
  • a full DPNS name such as alice.dash
  • a bare DPNS username such as alice

DPNS searches require an exact normalized name match before resolving the owning identity. Users then provide one or more private keys in 64-character hex (optionally 0x-prefixed) or WIF format. The wallet:

  • fetches the identity and its public keys from the selected Platform network
  • derives each imported public-key hash locally and rejects keys that do not belong to the identity
  • rejects duplicate identities and duplicate key entries
  • encrypts private keys before writing them to SQLite
  • records the matched on-chain key IDs and whether a transfer key is available
  • uses an imported transfer key for identity-to-address transfers, identity-to-identity transfers, and identity credit withdrawals
  • preserves the existing HD seed-derived identity path as the fallback

Imported identities are marked in the identity list. The UI warns that the wallet recovery phrase does not recreate externally imported keys.

Identity discovery hardening

  • identifier parsing uses the SDK's 32-byte IdentifierWASM validation instead of assuming the common 42–44 character encoding
  • a Base58-looking bare DPNS label falls back to exact-name resolution when no identity exists with that identifier
  • temporary DPNS alias lookup failures no longer hide an already imported identity or its balance
  • connectivity/proof failures are reported as lookup failures rather than incorrectly claiming the identity or name does not exist

Sending from imported identities

Identity credits and Platform-address credits remain distinct source types, but the Send UI now makes that distinction actionable:

  • the source is labelled Identity balance
  • only funded identities are offered, highest balance first
  • a funded identity card has a Send action that opens Send with that identity selected
  • an empty Platform-address source offers a one-click switch to the funded identity balance

Key storage

0013_imported_identity_keys adds:

  • an is_imported marker on identities
  • a separate identity_keys table keyed by wallet, identity, and Platform key ID

Only encrypted private-key material is stored. The encryption wrapper uses the wallet's normalized mnemonic as its secret, which remains protected by the wallet password and avoids stranding imported keys when the wallet password is reset.

Wallet deletion removes imported identity keys before deleting identity and wallet rows.

Validation

  • yarn typecheck
  • Electron production build ✅
  • full test suite: 264 tests across 31 files ✅
  • live mainnet resolution verified for an identity ID, full DPNS name, and bare DPNS username ✅

The test cleanup also updates stale SdkProvider import paths, supplies the current shielded-service fixture to the wallet API tests, and keeps both testnet and mainnet wallet creation offline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant