alastria / alastriaID-truffle-contracts

Alastria ID truffle Smart Contracts
MIT License
2 stars 5 forks source link

GetPublicKeyStatus function modification proposal #58

Closed MisiakGeo closed 1 year ago

MisiakGeo commented 1 year ago

Hello all, In AlastriaPublicKeyRegistry.sol (located here), I have a question regarding the line 88 (here), the function getPublicKeyStatus accepts type bytes32 data of publicKey and makes the assumption that you already know the keccak256 of the input. As in every position within the contract the publicKey is passed as string and the keccak256 is computed within the function, wouldn't it more appropriate if we transform it accordingly, as presented in the code block below or there is a reason behind that?

function getPublicKeyStatus(address subject, string memory publicKey) view public validAddress(subject) returns (bool exists, uint status, uint startDate, uint endDate)
 PublicKey storage value = publicKeyRegistry[subject][getKeyHash(publicKey)];
 return (value.exists, value.status, value.startDate, value.endDate);
}

Thank you.

rober12 commented 1 year ago

Hello George,

In the 2.2.0 version being worked on, all functions and data structures of AlastriaPublicKeyRegistry.sol will be reimplemented to work with the hashes (keccak256) of the public keys instead of the public key in clear (bytes32), for obvious reasons. So the change you propose will be made in this next version coming soon.

Thank you very much for your contribution.

MisiakGeo commented 1 year ago

Thank you very much.

MisiakGeo commented 1 year ago

Closing this issue, due to the fact that it is going to be rectified in the upcoming version 2.2.0.