Skip to content

Instantly share code, notes, and snippets.

@johngriffin
Last active March 15, 2018 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johngriffin/c0c0c4a180702f02e9625a7d1ef63239 to your computer and use it in GitHub Desktop.
Save johngriffin/c0c0c4a180702f02e9625a7d1ef63239 to your computer and use it in GitHub Desktop.
pragma solidity ^0.4.17;
contract OpenSign{
struct Document {
uint timestamp;
bytes ipfs_hash;
address[] signatures;
}
mapping(address => bytes[]) public users;
mapping(bytes32 => Document) public documents;
function addDocument(bytes id, bytes ipfs) public {
users[msg.sender].push(ipfs);
address[] memory sender = new address[](1);
sender[0] = msg.sender;
documents[keccak256(id)] = Document(block.timestamp, ipfs, sender);
}
function signDocument(bytes id) public {
users[msg.sender].push(id);
documents[keccak256(id)].signatures.push(msg.sender);
}
function getSignatures(bytes id) public view returns (address[]) {
return documents[keccak256(id)].signatures;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment