Skip to content

Commit

Permalink
Updated comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Manan committed Aug 14, 2024
1 parent 2b2377b commit f2f84c7
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions modules/symitriDapRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,15 +527,32 @@ export function createRtdProvider(moduleName, moduleCode, headerPrefix) {

addIdentifier: function(identity, apiParams) {
if (typeof (identity.value) != typeof (undefined) && identity.value.trim() !== '') {
let hid = this.generateHash(identity.value); //Hash the identifier passed by Publisher through config
let hid = this.generateHash(identity.value); // Hash the identifier passed by Publisher through config
apiParams.identity = hid;
}
return apiParams;
},

//Using custom SHA256 algorithm to synchronously generate hash for the identifier as we can't use asynchronous crypto.subtle.digest.
//Copyright 2022 Andrea Griffini
//https://github.com/6502/sha256/
/**
* SYNOPSIS
*
* generateHash(message);
*
* DESCRIPTION
*
* SHA256 algorithm to synchronously generate hash for the passed in value.
* Asynchronous implementation provided by crypto.subtle.digest can only be triggered from async function.
* This synchronous alternative is useful while generating hash from synchronous code.
*
* Copyright 2022 Andrea Griffini
* https://github.com/6502/sha256/
*
* PARAMETERS
*
* message: any string that needs tobe hashed. In this case it will be user identifier
*
*/

generateHash: function(message) {
const data = new TextEncoder().encode(message);
let h0 = 0x6a09e667; let h1 = 0xbb67ae85; let h2 = 0x3c6ef372; let h3 = 0xa54ff53a;
Expand Down

0 comments on commit f2f84c7

Please sign in to comment.