Last active
May 26, 2018 04:05
-
-
Save vasa-develop/885583d0852110587a1e311665980a0f 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.19; | |
contract Account{ | |
/* struct account{ | |
string pubKey; | |
string priKey; | |
} */ | |
struct account_user{ | |
string pubKey; | |
string userHash; | |
} | |
struct user{ | |
string userHash; | |
string metadataHash; | |
string userClass; | |
bool isOrg; | |
} | |
mapping (string => string) userHashtoPubkey; | |
mapping (string => user) userHashToUser; | |
//you can add a modifier to it to prevent other users to add/link accounts. | |
function createAccount(string pubKey, string userHash, string metadataHash, string userClass, bool isOrg) public { | |
//adding to account | |
//linking the pubKey to a userHash. | |
//linkAccount() | |
userHashtoPubkey[userHash] = pubKey; | |
userHashToUser[userHash] = user(userHash, metadataHash, userClass, isOrg); | |
} | |
function getAccount(string userHash) public view returns(string metadataHash, string userClass, bool isOrg){ | |
return (userHashToUser[userHash].metadataHash, userHashToUser[userHash].userClass, userHashToUser[userHash].isOrg); | |
} | |
//figure out the account change flow. | |
function changeAccount(string newUserHash, string pubKey) public { | |
userHashtoPubkey[newUserHash] = pubKey; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment