Skip to content

Commit

Permalink
[IRT-741] fix: Use hash of verifier and verifierId rather thn pub keys
Browse files Browse the repository at this point in the history
  • Loading branch information
huggingbot committed Oct 2, 2023
1 parent 1789692 commit b624844
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/helpers/nodeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,9 @@ export async function retrieveOrImportShare(params: {
}

if (isImportShareReq) {
const importedPubKey = ecCurve.keyFromPublic({ x: importedShares[0].pub_key_x, y: importedShares[0].pub_key_x }).getPublic();
const importedPubKeyStr = importedPubKey.encode("hex", false).slice(2);
const hashedImportedPubKey = keccak256(Buffer.from(importedPubKeyStr, "utf8"));
const proxyEndpointNum = parseInt(hashedImportedPubKey, 16) % endpoints.length;
const verifierIdStr = `${verifier}${verifierParams.verifier_id}`;
const hashedVerifierId = keccak256(Buffer.from(verifierIdStr, "utf8"));
const proxyEndpointNum = parseInt(hashedVerifierId, 16) % endpoints.length;
const sortedEndpoints = [endpoints[proxyEndpointNum], ...endpoints.slice(0, proxyEndpointNum), ...endpoints.slice(proxyEndpointNum + 1)];
const sortedImportedShares = [
importedShares[proxyEndpointNum],
Expand Down

0 comments on commit b624844

Please sign in to comment.