Skip to content

Commit

Permalink
Merge pull request #12 from piouslove/piouslove
Browse files Browse the repository at this point in the history
sig `nonce` should use `identityOwner(identity)` instead of just `identity`
  • Loading branch information
mi-xu authored Sep 20, 2018
2 parents af09087 + 20e40f0 commit f4e17ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions contracts/EthereumDIDRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ contract EthereumDIDRegistry {
function checkSignature(address identity, uint8 sigV, bytes32 sigR, bytes32 sigS, bytes32 hash) internal returns(address) {
address signer = ecrecover(hash, sigV, sigR, sigS);
require(signer == identityOwner(identity));
nonce[identity]++;
nonce[signer]++;
return signer;
}

Expand Down Expand Up @@ -109,7 +109,7 @@ contract EthereumDIDRegistry {
}

function setAttributeSigned(address identity, uint8 sigV, bytes32 sigR, bytes32 sigS, bytes32 name, bytes value, uint validity) public {
bytes32 hash = keccak256(byte(0x19), byte(0), this, nonce[identity], identity, "setAttribute", name, value, validity);
bytes32 hash = keccak256(byte(0x19), byte(0), this, nonce[identityOwner(identity)], identity, "setAttribute", name, value, validity);
setAttribute(identity, checkSignature(identity, sigV, sigR, sigS, hash), name, value, validity);
}

Expand All @@ -123,7 +123,7 @@ contract EthereumDIDRegistry {
}

function revokeAttributeSigned(address identity, uint8 sigV, bytes32 sigR, bytes32 sigS, bytes32 name, bytes value) public {
bytes32 hash = keccak256(byte(0x19), byte(0), this, nonce[identity], identity, "revokeAttribute", name, value);
bytes32 hash = keccak256(byte(0x19), byte(0), this, nonce[identityOwner(identity)], identity, "revokeAttribute", name, value);
revokeAttribute(identity, checkSignature(identity, sigV, sigR, sigS, hash), name, value);
}

Expand Down

0 comments on commit f4e17ee

Please sign in to comment.