Skip to main content
Platform

Export Key

Reconstruct and export the full private key of the MPC wallet by combining the shares. Use this to move a wallet out of MPC, for example into another wallet ecosystem. Gate this behind strong user authentication.

Once the private key is exported, the MPC security guarantees are lost.

Please refer to the Session creation section to learn how to create a new session.

Full Example

App.tsx
import { type EcdsaSession } from '@silencelaboratories/silent-shard-sdk/ecdsa';

export const exportKey = async (session: EcdsaSession) => {
// Creating a new keyshare for demo purpose. In real application, you can use an existing keyshare.
const keyshare = await session.keygen();
console.log('Keyshare: ', keyshare.keyIdHex);

const privateKeyHex = await session.export({
keyshare,
});
console.log('Exported private key: ', privateKeyHex);
};
  • The export method takes a EcdsaExportConfig object as an argument.
    • keyshare is of type Keyshare and represents the client's share of the MPC wallet
  • privateKeyHex: The exported private key in hex format.