How can I set the threshold count to 3?

The default threshold of the tKey is two (needs a minimum 2 for quorum).

Can I change this to 3 (or n in the general) ? How do I code this?

thanks

You can set the threshold using code below

    const newThreshold = 3;
    
    const pubPoly = tkey.metadata.getLatestPublicPolynomial();
    const polyID = pubPoly.getPolynomialID();
    const shareIndexes = tkey.metadata.getShareIndexesForPolynomial(polyID);
    const results = await tkey._refreshShares( newThreshold, shareIndexes, polyID );

Please be aware that if user have less that threshold key, they will not able to reconstruct their private key. Update threshold carefully.

1 Like

Thanks @cherngwoei
I will try this, but I do have questions to clarify:

  • when should I call this? after tKey.Init ?
  • how often do I have to do this? I suppose only once? or every tKey.Init ?

You can only called it after tkey.reconstruct()
as long as the private key is reconstructed, you can refresh as you wanted