Last active
March 15, 2018 19:49
-
-
Save johngriffin/c0c0c4a180702f02e9625a7d1ef63239 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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