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

Set threshold to 2

parent 8fa14308
Branches
Tags
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"; ...@@ -3,6 +3,8 @@ import { encryptMessage } from "./signingUtilities";
import { encodeResponse } from "./appUtility"; import { encodeResponse } from "./appUtility";
import { getSliceRange } from "./numberUtilities"; import { getSliceRange } from "./numberUtilities";
const THRESHOLD = 2;
/** Initialize /** Initialize
*/ */
export const initSecrets = (bits, rngType) => secrets.init(bits, rngType); export const initSecrets = (bits, rngType) => secrets.init(bits, rngType);
...@@ -47,17 +49,13 @@ export const encryptShare = async (share, publicKey) => ...@@ -47,17 +49,13 @@ export const encryptShare = async (share, publicKey) =>
/** Account Recovery key management */ /** Account Recovery key management */
export const getSecretThreshold = sharesNumber =>
sharesNumber === 3 ? 2 : parseInt(sharesNumber / 2);
export const generateRecoveryKey = () => { export const generateRecoveryKey = () => {
const recoveryKey = generateSecret(512); const recoveryKey = generateSecret(512);
return recoveryKey; return recoveryKey;
}; };
export const getRecoveryKeyShares = (recoveryKey, sharesNumber) => { export const getRecoveryKeyShares = (recoveryKey, sharesNumber) => {
const threshold = getSecretThreshold(sharesNumber); return divideSecretToShares(recoveryKey, sharesNumber, THRESHOLD);
return divideSecretToShares(recoveryKey, sharesNumber, threshold);
}; };
export const checkRecoveryKeyCombine = (recoveryKey, recoveryKeyShares) => { 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