Skip to content
Snippets Groups Projects
Commit 60eeda59 authored by Sasha Ilieva's avatar Sasha Ilieva
Browse files

Set threshold to 2

parent 8fa14308
No related branches found
No related tags found
1 merge request!88908 account recovery ability to add contacts to trusted contacts list for account recovery
......@@ -3,6 +3,8 @@ import { encryptMessage } from "./signingUtilities";
import { encodeResponse } from "./appUtility";
import { getSliceRange } from "./numberUtilities";
const THRESHOLD = 2;
/** Initialize
*/
export const initSecrets = (bits, rngType) => secrets.init(bits, rngType);
......@@ -47,17 +49,13 @@ export const encryptShare = async (share, publicKey) =>
/** Account Recovery key management */
export const getSecretThreshold = sharesNumber =>
sharesNumber === 3 ? 2 : parseInt(sharesNumber / 2);
export const generateRecoveryKey = () => {
const recoveryKey = generateSecret(512);
return recoveryKey;
};
export const getRecoveryKeyShares = (recoveryKey, sharesNumber) => {
const threshold = getSecretThreshold(sharesNumber);
return divideSecretToShares(recoveryKey, sharesNumber, threshold);
return divideSecretToShares(recoveryKey, sharesNumber, THRESHOLD);
};
export const checkRecoveryKeyCombine = (recoveryKey, recoveryKeyShares) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment