Export Key
Please refer to the Session creation section to learn how to create a new session.
Full Example
- ECDSA
- EdDSA
App.tsx
import { type EcdsaSession } from '@silencelaboratories/silent-shard-sdk';
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);
};
App.tsx
import { type EddsaSession } from '@silencelaboratories/silent-shard-sdk';
export const exportKey = async (session: EddsaSession) => {
// Creating a new keyshare. 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
exportmethod takes a EcdsaExportConfig object as an argument.keyshareis of type Keyshare and represents the client's share of the MPC wallet
privateKeyHex: The expored private key in hex format.