I want to implement deactivating/deleting an identity. In the ethr-did spec it says:
Delete (Revoke)
[...]
In case ERC1056 was utilized, the owner of the smart contract needs to be set to 0x0. Although, 0x0 is a valid Ethereum address, this will indicate the identity has no owner which is a common approach for invalidation, e.g., tokens. [...]
While setting the owner to 0x0 works, it's not possible to see that when resolving a did document. As it seems, one major problem here is that identityOwner(address identity) doesn't return the correct owner if it was set to 0x0.
I understand that this is because of the mapping implementation of Solidity.
While it might be possible to resolve a DID in another way (i.e. checking for DIDOwnerChanged event), the method identityOwner(address identity) is not behaving as the standard defines.
A workaround could be to change the mapping mapping(address => address) public owners; to store an additional bit/byte which indicates whether a value is set (i.e. like mapping(address => bytes21) public ownersMapping;). This mapping could be updated and read by two methods (e.g. setOwner and owners) to conceal this workaround from users.
I want to implement deactivating/deleting an identity. In the ethr-did spec it says:
While setting the owner to
0x0
works, it's not possible to see that when resolving a did document. As it seems, one major problem here is thatidentityOwner(address identity)
doesn't return the correct owner if it was set to0x0
.https://github.com/uport-project/ethr-did-registry/blob/44712d3327e47d697a887b759b5a9357a3db69cc/contracts/EthereumDIDRegistry.sol#L37-L43
I understand that this is because of the mapping implementation of Solidity.
While it might be possible to resolve a DID in another way (i.e. checking for
DIDOwnerChanged
event), the methodidentityOwner(address identity)
is not behaving as the standard defines.A workaround could be to change the mapping
mapping(address => address) public owners;
to store an additional bit/byte which indicates whether a value is set (i.e. likemapping(address => bytes21) public ownersMapping;
). This mapping could be updated and read by two methods (e.g.setOwner
andowners
) to conceal this workaround from users.Whats your opinion on that?