Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Stabilise Passphrase e2e tests - Closes #725 #785

Merged
merged 3 commits into from
Sep 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/utils/passphrase.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ const leftPadd = (str, pad, length) => {
/**
* Resets previous settings and creates a step with a random length between 1.6% to 3.2%
*/
const init = (rand = Math.random()) => ({
step: (160 + Math.floor(rand * 160)) / 100,
percentage: 0,
seed: emptyByte('00'),
byte: emptyByte(0),
});
const init = (rand = Math.random()) => {
let step = Math.max((160 + Math.floor(rand * 160)));
step = step >= 0.01 ? step : step * 10;
return {
step,
percentage: 0,
seed: emptyByte('00'),
byte: emptyByte(0),
};
};

/**
* - From a zero byte:
Expand Down