Skip to content

Commit

Permalink
/issue #6: Clean up GUID format
Browse files Browse the repository at this point in the history
Also removed unused classes
  • Loading branch information
veronikaslc committed Oct 16, 2020
1 parent bdb10ae commit 94d0154
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions guids-generator.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,10 @@
width: theme.spacing(70),
marginBottom: theme.spacing(0),
},
bbutton: {
},
labelRoot: {
width: theme.spacing(70),
color: theme.palette.text.primary,
},
selectInputLabel: {
},
selectInputIcon : {
marginTop: theme.spacing(4),
marginBottom: theme.spacing(-2),
Expand All @@ -83,6 +79,8 @@
},
}));

const salt = "$2a$10$biRUcRBR1wroz1r45ORKs.";

// Health card number processing utils

const provinces = ["AB", "BC", "MB", "NB", "NL", "NS", "NT", "NU", "ON", "PE", "QC", "SK", "YT"];
Expand Down Expand Up @@ -341,12 +339,19 @@
(Object.keys(hashes).length == validatedData.length) && setBhashes(hashes);
} else {
// Salt is hardcoded here for now
bcrypt.hash(item.value + projectId, "$2a$10$biRUcRBR1wroz1r45ORKs.", (err, hash) => {
bcrypt.hash(item.value + projectId, salt, (err, hash) => {
if (err) {
console.error(err);
return;
}

// Remove salt version, rounds number and actual salt from hash
// Encode the hash in HEX to ensure only alphanumeric characters are generated
hash = hash.replace(salt, '')
.split("")
.map(c => c.charCodeAt(0).toString(16).padStart(2, "0"))
.join("");

hashes[item.line] = {"value" : hash};
(Object.keys(hashes).length == validatedData.length) && setBhashes(hashes);
})
Expand Down Expand Up @@ -405,7 +410,7 @@
</Grid>
<Grid item>
<FormControl className={classes.formControl}>
<InputLabel shrink id="date-format" className={classes.selectInputLabel}>
<InputLabel shrink id="date-format">
Date format for the dates of birth
</InputLabel>
<InputAdornment position="start" className={classes.selectInputIcon}>
Expand All @@ -425,7 +430,7 @@
</FormControl>
</Grid>
<Grid item>
<Button onClick={() => onSubmit()} variant="contained" color="primary" disabled={binput?.trim().length == 0} className={classes.bbutton}>Generate GUIDs</Button>
<Button onClick={() => onSubmit()} variant="contained" color="primary" disabled={binput?.trim().length == 0}>Generate GUIDs</Button>
</Grid>
</Grid>
{ Object.keys(bhashes).length > 0 &&
Expand Down

0 comments on commit 94d0154

Please sign in to comment.