Skip to content

Commit

Permalink
[IRT-741] fix: Remove sorting shares as we will map data on backend t…
Browse files Browse the repository at this point in the history
…o corresponding nodes using node indexes
  • Loading branch information
huggingbot committed Oct 3, 2023
1 parent b624844 commit 7d2fc60
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/helpers/nodeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,20 +237,14 @@ export async function retrieveOrImportShare(params: {
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],
...importedShares.slice(0, proxyEndpointNum),
...importedShares.slice(proxyEndpointNum + 1),
];

const items: Record<string, unknown>[] = [];
for (let i = 0; i < endpoints.length; i += 1) {
const x = responses[i];
if (!x || typeof x !== "object" || x.error) {
continue;
}
const importedShare = sortedImportedShares[i];
const importedShare = importedShares[i];
items.push({
...verifierParams,
idtoken: idToken,
Expand All @@ -264,13 +258,13 @@ export async function retrieveOrImportShare(params: {
key_type: importedShare.key_type,
nonce_data: importedShare.nonce_data,
nonce_signature: importedShare.nonce_signature,
sss_endpoint: sortedEndpoints[i],
sss_endpoint: endpoints[i],
...extraParams,
});
}

const p = post<JRPCResponse<ImportShareRequestResult[]>>(
sortedEndpoints[0],
endpoints[proxyEndpointNum],
generateJsonRPCObject(JRPC_METHODS.IMPORT_SHARES, {
encrypted: "yes",
use_temp: true,
Expand Down

0 comments on commit 7d2fc60

Please sign in to comment.