Keygen
Please refer to the Session creation section to learn how to create a new session.
Full example
- ECDSA
- EdDSA
- MLDSA
App.tsx
import { type EcdsaSession } from '@silencelaboratories/silent-shard-sdk/ecdsa';
export const keygen = async (session: EcdsaSession) => {
const keyshare = await session.keygen();
console.log('Created new keyshare with public key: ', keyshare.publicKeyHex);
};
App.tsx
import { type EddsaSession } from '@silencelaboratories/silent-shard-sdk/eddsa';
export const keygen = async (session: EddsaSession) => {
const keyshare = await session.keygen();
console.log('Created new keyshare with public key: ', keyshare.publicKeyHex);
};
App.tsx
import { MldsaLevels } from '@silencelaboratories/silent-shard-sdk';
import { type MldsaSession } from '@silencelaboratories/silent-shard-sdk/mldsa';
export const keygen = async (session: MldsaSession) => {
// ML-DSA security level (MlDsa44, MlDsa65, or MlDsa87)
const keyshare = await session.keygen(MldsaLevels.MlDsa44);
console.log('Created new keyshare with public key: ', keyshare.publicKeyHex);
};
- When
session.keygen()is called, the app and the server exchange messages to generate a new MPC wallet. - Two new "shares" are generated: one for the client and one for the server. Both shares together form the MPC wallet.
keyshareis of type Keyshare and represents the client's "share" of the MPC wallet.- The
keyshare.publicKeyHexproperty is the public key of the MPC wallet in hex format.