All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.quorum.tessera.partyinfo.PartyInfoServiceUtil Maven / Gradle / Ivy

Go to download

Tessera is a stateless Java system that is used to enable the encryption, decryption, and distribution of private transactions for Quorum.

There is a newer version: 24.4.2
Show newest version
package com.quorum.tessera.partyinfo;

import com.quorum.tessera.encryption.PublicKey;
import com.quorum.tessera.partyinfo.node.NodeInfo;
import com.quorum.tessera.partyinfo.node.Recipient;

import java.util.Map;
import java.util.stream.Collectors;

public interface PartyInfoServiceUtil {

    static boolean validateKeysToUrls(final NodeInfo existingPartyInfo, final NodeInfo newPartyInfo) {

        final Map existingRecipientKeyUrlMap =
                existingPartyInfo.getRecipients().stream()
                        .collect(Collectors.toMap(Recipient::getKey, Recipient::getUrl));

        final Map newRecipientKeyUrlMap =
                newPartyInfo.getRecipients().stream().collect(Collectors.toMap(Recipient::getKey, Recipient::getUrl));

        for (final Map.Entry entry : newRecipientKeyUrlMap.entrySet()) {
            final PublicKey key = entry.getKey();

            if (existingRecipientKeyUrlMap.containsKey(key)) {
                String existingUrl = existingRecipientKeyUrlMap.get(key);
                String newUrl = entry.getValue();
                if (!existingUrl.equalsIgnoreCase(newUrl)) {
                    return false;
                }
            }
        }

        return true;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy