Skip to content

Commit

Permalink
feat: PR comments resolved.
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Goel <[email protected]>
  • Loading branch information
grvgoel81 authored and Gaurav Goel committed Sep 12, 2024
1 parent 7a9b427 commit b261754
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
package org.torusresearch.torusutils.helpers;

import org.jetbrains.annotations.NotNull;

public class IsNewKeyResponse {

public boolean isNewKey;
public String publicKeyX;

public IsNewKeyResponse(boolean isNewKey, String publicKeyX) {
public IsNewKeyResponse(@NotNull boolean isNewKey, @NotNull String publicKeyX) {
this.isNewKey = isNewKey;
this.publicKeyX = publicKeyX;
}

public boolean isNewKey() {
return isNewKey;
}

public String getPublicKeyX() {
return publicKeyX;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,9 @@ public static TorusKey retrieveOrImportShare(@NotNull String legacyMetadataHost,
ArrayList<IsNewKeyResponse> isNewKeys = new ArrayList<>();

for (ShareRequestResult item : shareResponses) {
isNewKeys.add(new IsNewKeyResponse(item.is_new_key, item.keys[0].public_key.getX()));
if (item.keys.length > 0 && item.keys[0] != null) {
isNewKeys.add(new IsNewKeyResponse(item.is_new_key, item.keys[0].public_key.getX()));
}

if (item.session_token_sigs != null && item.session_token_sigs.length > 0) {
if (item.session_token_sig_metadata != null && item.session_token_sig_metadata.length > 0) {
Expand Down Expand Up @@ -445,7 +447,7 @@ public static TorusKey retrieveOrImportShare(@NotNull String legacyMetadataHost,

boolean isNewKey = false;
for (IsNewKeyResponse item : isNewKeys) {
if (item.isNewKey() && item.getPublicKeyX().equalsIgnoreCase(thresholdPublicKey.getX())) {
if (item.isNewKey && item.publicKeyX.equalsIgnoreCase(thresholdPublicKey.getX())) {
isNewKey = true;
}
}
Expand Down

0 comments on commit b261754

Please sign in to comment.