Importing a private key
Usewallets.waas.importPrivateKey to import an existing raw private key into a Dynamic WaaS (MPC) wallet. The key is forwarded to the WaaS connector, which generates the MPC key shares for the wallet’s chain. The connector is resolved from the supplied chain, so no wallet id is required, and the raw key never leaves the webview after the call returns.
Parameters
WaasChain
required
The WaaS connector to import into:
WaasChain.evm, WaasChain.svm, WaasChain.btc, WaasChain.sui, or WaasChain.ton.String
required
The raw private key to import.
ThresholdSignatureScheme
Optionally override the signature scheme:
twoOfTwo (default), twoOfThree, or threeOfFive.BtcAddressType
Bitcoin address type:
nativeSegwit or taproot. Required when chain is WaasChain.btc; ignored for other chains.String
Optionally assert the resulting public address. The import is rejected when the derived address does not match.
String
Optionally password-protect the newly created WaaS wallet. This does not unlock an existing wallet.
Return value
importPrivateKey resolves with an ImportPrivateKeyResult:
String?
The Dynamic wallet id of the wallet the imported key now backs, when the webview reported it.
String?
The public address derived from the imported key, when reported.
bool
true when the key already backed one of the user’s wallets. In that case the server answers 409 duplicate_wallet_import and the call resolves with the existing wallet’s id instead of throwing, so a resumed migration can safely re-fire imports.bool
true when walletId is present. A false value does not mean the import failed: older bundles resolve without a payload, which yields an unconfirmed result. In that case confirm the import through auth.refreshUser() and wallets.userWallets.Map<String, dynamic>
The resolve payload, verbatim. Empty when the webview resolved with no payload.
Importing a Bitcoin key
When importing intoWaasChain.btc, an addressType is required:
Exporting embedded wallet keys
Dynamic allows users to export their embedded wallet private keys for maximum control and portability. During export:- The key shares are temporarily recombined on the user’s device using secure MPC
- The private key is constructed client-side and provided to the user
When implementing Dynamic in a custom UI, ensure you surface this flow to your end-users so they always maintain control of their wallet.
Private key export settings
By default, users can export their private keys from embedded wallets. You can control this setting in the Embedded Wallets dashboard. Navigate to the Security section and toggle Private Key Exports to enable or disable private key exports.
Revealing the private key
To open the export wallet flow on behalf of your users, callrevealEmbeddedWalletPrivateKey() on the SDK’s UI module. This presents a secure flow where only the end-user can see their private key.