Key Recovery
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 recovery = 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 recoveredKeyshare = await session.recovery(keyshare.publicKeyHex);
console.log('Recovered keyshare: ', recoveredKeyshare.keyIdHex);
};
App.tsx
import { type EddsaSession } from '@silencelaboratories/silent-shard-sdk';
export const recovery = async (session: EddsaSession) => {
// 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 recoveredKeyshare = await session.recovery(keyshare.publicKeyHex);
console.log('Recovered keyshare: ', recoveredKeyshare.keyIdHex);
};
- When
session.recovery(keyshare)is called, the app and the server exchange message to "recover" the MPC wallet. Refer to Key Recovery for more details. publicKeyHexis the public key of the client's share of the MPC wallet to be recovered.- This process enhances the long-term security of the MPC wallet by proactively updating the client's and server's secret shares.
- The wallet's public address or key remains unchanged during this process.
recoveredKeyshareis of type Keyshare and represents the client's new share of the MPC wallet.