Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #14: Generate eGUIDs from GUIDs - use raw bytes - code cleanup #19

Open
wants to merge 4 commits into
base: issues-13-14
Choose a base branch
from

Conversation

IntegralProgrammer
Copy link
Member

This PR fixes several issues associated with the previously merged PR #17 namely:

  • The Personal Health Information (PHI) hashing function (currently we are using bcrypt) has been wrapped by the phiHashFunction function so that the hashing algorithm can easily be switched to a different one if needed and the phiHashFunction can be shared between both client and server Javascript programs. This phiHashFunction function removes all non-hash information (eg. salt, version number, etc...) and returns the hash as a Uint8Array of bytes.
  • The base64 decoding of the hash output from bcrypt has been fixed. window.atob() does not work as bcrypt uses non-standardized base64 encoding and window.atob() cannot handle the . and / characters.

To test:

  • Setting enableObfuscation in project-config.json to false will cause the application to generate GUIDs.

  • Generated GUIDs should be deterministic - the same <Health card,Province code,Date of birth> should always generate the same GUID.

  • Changing even just one of the Health card, Province code, or Date of birth values should result in a different GUID.

  • Setting enableObfuscation in project-config.json to true will cause the application to generate eGUIDs.

  • Generated eGUIDs should be non-deterministic - the same <Health card,Province code,Date of birth> should generate different eGUIDs.

  • Test with the issues-13-14_code-cleanup_test branch and open the browser's web console. The value associated with theWorking with: ... message should deterministic with respect to the Health card, Province code, and Date of birth values, while the output displayed in the eGUID table column should be non-deterministic. The value associated with the Round-trip, base64 re-encoded to: ... message should always be the same as the value associated with the previous Working with: ... message.

veronikaslc and others added 4 commits September 29, 2021 13:37
Work with data as raw bytes (not hex, not base64) when adding noise and encrypting

Instead of calling bcrypt.hash() directly, wrap it in a method called phiHashFunction (which returns a hash in Uint8Array format) so that we can easily switch to another hashing function if necessary
Work with data as raw bytes (not hex, not base64) when adding noise and encrypting

Fix bcrypt hash base64 decoding as bcrypt uses non-standardized base64 encoding
Fix bug that occurred when converting hash buffer to hex string representation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant