{"action":"created","comment":{"url":"https://api.github.com/repos/iden3/go-iden3/pulls/comments/240199121","pull_request_review_id":183171469,"id":240199121,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MDE5OTEyMQ==","diff_hunk":"@@ -0,0 +1,139 @@\n+package commands\n+\n+import (\n+\t\"bufio\"\n+\t\"encoding/csv\"\n+\t\"fmt\"\n+\t\"io\"\n+\t\"os\"\n+\n+\tcfg \"github.com/iden3/go-iden3/cmd/relay/config\"\n+\tcommon3 \"github.com/iden3/go-iden3/common\"\n+\t\"github.com/iden3/go-iden3/core\"\n+\tlog \"github.com/sirupsen/logrus\"\n+\t\"github.com/urfave/cli\"\n+)\n+\n+var ClaimCommands = []cli.Command{\n+\t{\n+\t\tName:  \"claim\",\n+\t\tUsage: \"claim add\",\n+\t\tSubcommands: []cli.Command{{\n+\t\t\tName:   \"add\",\n+\t\t\tUsage:  \"claim add\",\n+\t\t\tAction: cmdAddClaim,\n+\t\t}},\n+\t},\n+\t{\n+\t\tName:  \"claims\",\n+\t\tUsage: \"claims import from file\",\n+\t\tSubcommands: []cli.Command{{\n+\t\t\tName:   \"fromfile\",\n+\t\t\tUsage:  \"import claims from file\",\n+\t\t\tAction: cmdAddClaimsFromFile,\n+\t\t}},\n+\t},\n+}\n+\n+func cmdAddClaim(c *cli.Context) error {\n+\tif err := cfg.MustRead(c); err != nil {\n+\t\treturn err\n+\t}\n+\n+\tks, acc := cfg.LoadKeyStore()\n+\tclient := cfg.LoadWeb3(ks, &acc)\n+\tstorage := cfg.LoadStorage()\n+\tmt := cfg.LoadMerkele(storage)\n+\n+\trootservice := cfg.LoadRootsService(client)\n+\tclaimservice := cfg.LoadClaimService(mt, rootservice, ks, acc)\n+\n+\tindexData := c.Args().Get(0)\n+\toutData := c.Args().Get(0)\n+\n+\tclaim := core.NewGenericClaim(\"iden3.io\", \"generic\", []byte(indexData), []byte(outData))\n+\tfmt.Println(\"clam: \" + common3.BytesToHex(claim.Bytes()))\n+\n+\terr := claimservice.AddDirectClaim(claim)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\tfmt.Print(\"root updated: \" + mt.Root().Hex())\n+\n+\tmp, err := mt.GenerateProof(claim.Hi())\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\tfmt.Print(\"merkleproof: \" + common3.BytesToHex(mp))\n+\n+\treturn nil\n+}\n+\n+func cmdAddClaimsFromFile(c *cli.Context) error {\n+\tif err := cfg.MustRead(c); err != nil {\n+\t\treturn err\n+\t}\n+\t// read config\n+\tfilepath := c.Args().Get(0)\n+\n+\tks, acc := cfg.LoadKeyStore()\n+\tclient := cfg.LoadWeb3(ks, &acc)\n+\tstorage := cfg.LoadStorage()\n+\tmt := cfg.LoadMerkele(storage)\n+\n+\trootservice := cfg.LoadRootsService(client)\n+\n+\tfmt.Print(\"\\n---\\nimporting claims\\n---\\n\\n\")\n+\t// csv file will have the following structure: indexData, noindexData\n+\tcsvFile, _ := os.Open(filepath)\n+\treader := csv.NewReader(bufio.NewReader(csvFile))\n+\tvar err error\n+\tfor {\n+\t\tline, error := reader.Read()\n+\t\tif error == io.EOF {\n+\t\t\tbreak\n+\t\t} else if error != nil {\n+\t\t\tlog.Fatal(error)\n+\t\t}\n+\n+\t\tfmt.Println(\"importing claim with index: \" + line[0] + \", outside index: \" + line[1])\n+\n+\t\tclaim := core.NewGenericClaim(\"iden3.io\", \"generic\", []byte(line[0]), []byte(line[1]))\n+\t\tfmt.Println(\"clam: \" + common3.BytesToHex(claim.Bytes()) + \"\\n\")\n+\n+\t\t// add claim to merkletree, without updating the root, that will be done on the end of the loop (csv file)\n+\t\terr = mt.Add(claim)\n+\t\tif err != nil {\n+\t\t\treturn err\n+\t\t}\n+\t}\n+\tfmt.Print(\"\\n---\\ngenerating proofs\\n---\\n\\n\")\n+\t// new, let's generate the proofs","path":"cmd/relay/commands/claim.go","position":null,"original_position":111,"commit_id":"411549b49306fa98c06f4071b5436145c8f1b2eb","original_commit_id":"137e6469561f9b341b06c699c36751572d2f0ed7","user":{"login":"arnaucube","id":17317030,"node_id":"MDQ6VXNlcjE3MzE3MDMw","avatar_url":"https://avatars3.githubusercontent.com/u/17317030?v=4","gravatar_id":"","url":"https://api.github.com/users/arnaucube","html_url":"https://github.com/arnaucube","followers_url":"https://api.github.com/users/arnaucube/followers","following_url":"https://api.github.com/users/arnaucube/following{/other_user}","gists_url":"https://api.github.com/users/arnaucube/gists{/gist_id}","starred_url":"https://api.github.com/users/arnaucube/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arnaucube/subscriptions","organizations_url":"https://api.github.com/users/arnaucube/orgs","repos_url":"https://api.github.com/users/arnaucube/repos","events_url":"https://api.github.com/users/arnaucube/events{/privacy}","received_events_url":"https://api.github.com/users/arnaucube/received_events","type":"User","site_admin":false},"body":"done :cat2: ","created_at":"2018-12-10T12:57:25Z","updated_at":"2018-12-10T12:57:25Z","html_url":"https://github.com/iden3/go-iden3/pull/34#discussion_r240199121","pull_request_url":"https://api.github.com/repos/iden3/go-iden3/pulls/34","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/iden3/go-iden3/pulls/comments/240199121"},"html":{"href":"https://github.com/iden3/go-iden3/pull/34#discussion_r240199121"},"pull_request":{"href":"https://api.github.com/repos/iden3/go-iden3/pulls/34"}},"in_reply_to_id":240194585},"pull_request":{"url":"https://api.github.com/repos/iden3/go-iden3/pulls/34","id":237248388,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM3MjQ4Mzg4","html_url":"https://github.com/iden3/go-iden3/pull/34","diff_url":"https://github.com/iden3/go-iden3/pull/34.diff","patch_url":"https://github.com/iden3/go-iden3/pull/34.patch","issue_url":"https://api.github.com/repos/iden3/go-iden3/issues/34","number":34,"state":"open","locked":false,"title":"Adds relay cli to add Generic claims manually and import multiple Gen…","user":{"login":"arnaucube","id":17317030,"node_id":"MDQ6VXNlcjE3MzE3MDMw","avatar_url":"https://avatars3.githubusercontent.com/u/17317030?v=4","gravatar_id":"","url":"https://api.github.com/users/arnaucube","html_url":"https://github.com/arnaucube","followers_url":"https://api.github.com/users/arnaucube/followers","following_url":"https://api.github.com/users/arnaucube/following{/other_user}","gists_url":"https://api.github.com/users/arnaucube/gists{/gist_id}","starred_url":"https://api.github.com/users/arnaucube/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arnaucube/subscriptions","organizations_url":"https://api.github.com/users/arnaucube/orgs","repos_url":"https://api.github.com/users/arnaucube/repos","events_url":"https://api.github.com/users/arnaucube/events{/privacy}","received_events_url":"https://api.github.com/users/arnaucube/received_events","type":"User","site_admin":false},"body":"…eric claims from a csv file\r\n\r\nrelay cli to add claims manually (cmdAddClaim)\r\n\r\ncli add claim, print claim, root, merkleproof\r\n\r\ncmdAddClaimsFromFile WIP\r\n\r\nrelay cli, import generic claims from csv file","created_at":"2018-12-10T09:23:19Z","updated_at":"2018-12-10T12:57:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5326006711cb65ff9bff10cbe757e0be3d694251","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1063888947,"node_id":"MDU6TGFiZWwxMDYzODg4OTQ3","url":"https://api.github.com/repos/iden3/go-iden3/labels/buidl","name":"buidl","color":"64eab0","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/iden3/go-iden3/pulls/34/commits","review_comments_url":"https://api.github.com/repos/iden3/go-iden3/pulls/34/comments","review_comment_url":"https://api.github.com/repos/iden3/go-iden3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/iden3/go-iden3/issues/34/comments","statuses_url":"https://api.github.com/repos/iden3/go-iden3/statuses/411549b49306fa98c06f4071b5436145c8f1b2eb","head":{"label":"iden3:feature/cli-addclaims","ref":"feature/cli-addclaims","sha":"411549b49306fa98c06f4071b5436145c8f1b2eb","user":{"login":"iden3","id":39371167,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzcxMTY3","avatar_url":"https://avatars0.githubusercontent.com/u/39371167?v=4","gravatar_id":"","url":"https://api.github.com/users/iden3","html_url":"https://github.com/iden3","followers_url":"https://api.github.com/users/iden3/followers","following_url":"https://api.github.com/users/iden3/following{/other_user}","gists_url":"https://api.github.com/users/iden3/gists{/gist_id}","starred_url":"https://api.github.com/users/iden3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iden3/subscriptions","organizations_url":"https://api.github.com/users/iden3/orgs","repos_url":"https://api.github.com/users/iden3/repos","events_url":"https://api.github.com/users/iden3/events{/privacy}","received_events_url":"https://api.github.com/users/iden3/received_events","type":"Organization","site_admin":false},"repo":{"id":148202884,"node_id":"MDEwOlJlcG9zaXRvcnkxNDgyMDI4ODQ=","name":"go-iden3","full_name":"iden3/go-iden3","private":false,"owner":{"login":"iden3","id":39371167,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzcxMTY3","avatar_url":"https://avatars0.githubusercontent.com/u/39371167?v=4","gravatar_id":"","url":"https://api.github.com/users/iden3","html_url":"https://github.com/iden3","followers_url":"https://api.github.com/users/iden3/followers","following_url":"https://api.github.com/users/iden3/following{/other_user}","gists_url":"https://api.github.com/users/iden3/gists{/gist_id}","starred_url":"https://api.github.com/users/iden3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iden3/subscriptions","organizations_url":"https://api.github.com/users/iden3/orgs","repos_url":"https://api.github.com/users/iden3/repos","events_url":"https://api.github.com/users/iden3/events{/privacy}","received_events_url":"https://api.github.com/users/iden3/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/iden3/go-iden3","description":"Go implementation of the iden3 system","fork":false,"url":"https://api.github.com/repos/iden3/go-iden3","forks_url":"https://api.github.com/repos/iden3/go-iden3/forks","keys_url":"https://api.github.com/repos/iden3/go-iden3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iden3/go-iden3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iden3/go-iden3/teams","hooks_url":"https://api.github.com/repos/iden3/go-iden3/hooks","issue_events_url":"https://api.github.com/repos/iden3/go-iden3/issues/events{/number}","events_url":"https://api.github.com/repos/iden3/go-iden3/events","assignees_url":"https://api.github.com/repos/iden3/go-iden3/assignees{/user}","branches_url":"https://api.github.com/repos/iden3/go-iden3/branches{/branch}","tags_url":"https://api.github.com/repos/iden3/go-iden3/tags","blobs_url":"https://api.github.com/repos/iden3/go-iden3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iden3/go-iden3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iden3/go-iden3/git/refs{/sha}","trees_url":"https://api.github.com/repos/iden3/go-iden3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iden3/go-iden3/statuses/{sha}","languages_url":"https://api.github.com/repos/iden3/go-iden3/languages","stargazers_url":"https://api.github.com/repos/iden3/go-iden3/stargazers","contributors_url":"https://api.github.com/repos/iden3/go-iden3/contributors","subscribers_url":"https://api.github.com/repos/iden3/go-iden3/subscribers","subscription_url":"https://api.github.com/repos/iden3/go-iden3/subscription","commits_url":"https://api.github.com/repos/iden3/go-iden3/commits{/sha}","git_commits_url":"https://api.github.com/repos/iden3/go-iden3/git/commits{/sha}","comments_url":"https://api.github.com/repos/iden3/go-iden3/comments{/number}","issue_comment_url":"https://api.github.com/repos/iden3/go-iden3/issues/comments{/number}","contents_url":"https://api.github.com/repos/iden3/go-iden3/contents/{+path}","compare_url":"https://api.github.com/repos/iden3/go-iden3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iden3/go-iden3/merges","archive_url":"https://api.github.com/repos/iden3/go-iden3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iden3/go-iden3/downloads","issues_url":"https://api.github.com/repos/iden3/go-iden3/issues{/number}","pulls_url":"https://api.github.com/repos/iden3/go-iden3/pulls{/number}","milestones_url":"https://api.github.com/repos/iden3/go-iden3/milestones{/number}","notifications_url":"https://api.github.com/repos/iden3/go-iden3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iden3/go-iden3/labels{/name}","releases_url":"https://api.github.com/repos/iden3/go-iden3/releases{/id}","deployments_url":"https://api.github.com/repos/iden3/go-iden3/deployments","created_at":"2018-09-10T18:45:41Z","updated_at":"2018-12-05T15:29:48Z","pushed_at":"2018-12-10T12:55:35Z","git_url":"git://github.com/iden3/go-iden3.git","ssh_url":"git@github.com:iden3/go-iden3.git","clone_url":"https://github.com/iden3/go-iden3.git","svn_url":"https://github.com/iden3/go-iden3","homepage":null,"size":233,"stargazers_count":3,"watchers_count":3,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":2,"open_issues":3,"watchers":3,"default_branch":"master"}},"base":{"label":"iden3:master","ref":"master","sha":"aef9ce3e9e3323a5e8c52aca1c2b06276cff554d","user":{"login":"iden3","id":39371167,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzcxMTY3","avatar_url":"https://avatars0.githubusercontent.com/u/39371167?v=4","gravatar_id":"","url":"https://api.github.com/users/iden3","html_url":"https://github.com/iden3","followers_url":"https://api.github.com/users/iden3/followers","following_url":"https://api.github.com/users/iden3/following{/other_user}","gists_url":"https://api.github.com/users/iden3/gists{/gist_id}","starred_url":"https://api.github.com/users/iden3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iden3/subscriptions","organizations_url":"https://api.github.com/users/iden3/orgs","repos_url":"https://api.github.com/users/iden3/repos","events_url":"https://api.github.com/users/iden3/events{/privacy}","received_events_url":"https://api.github.com/users/iden3/received_events","type":"Organization","site_admin":false},"repo":{"id":148202884,"node_id":"MDEwOlJlcG9zaXRvcnkxNDgyMDI4ODQ=","name":"go-iden3","full_name":"iden3/go-iden3","private":false,"owner":{"login":"iden3","id":39371167,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzcxMTY3","avatar_url":"https://avatars0.githubusercontent.com/u/39371167?v=4","gravatar_id":"","url":"https://api.github.com/users/iden3","html_url":"https://github.com/iden3","followers_url":"https://api.github.com/users/iden3/followers","following_url":"https://api.github.com/users/iden3/following{/other_user}","gists_url":"https://api.github.com/users/iden3/gists{/gist_id}","starred_url":"https://api.github.com/users/iden3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iden3/subscriptions","organizations_url":"https://api.github.com/users/iden3/orgs","repos_url":"https://api.github.com/users/iden3/repos","events_url":"https://api.github.com/users/iden3/events{/privacy}","received_events_url":"https://api.github.com/users/iden3/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/iden3/go-iden3","description":"Go implementation of the iden3 system","fork":false,"url":"https://api.github.com/repos/iden3/go-iden3","forks_url":"https://api.github.com/repos/iden3/go-iden3/forks","keys_url":"https://api.github.com/repos/iden3/go-iden3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iden3/go-iden3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iden3/go-iden3/teams","hooks_url":"https://api.github.com/repos/iden3/go-iden3/hooks","issue_events_url":"https://api.github.com/repos/iden3/go-iden3/issues/events{/number}","events_url":"https://api.github.com/repos/iden3/go-iden3/events","assignees_url":"https://api.github.com/repos/iden3/go-iden3/assignees{/user}","branches_url":"https://api.github.com/repos/iden3/go-iden3/branches{/branch}","tags_url":"https://api.github.com/repos/iden3/go-iden3/tags","blobs_url":"https://api.github.com/repos/iden3/go-iden3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iden3/go-iden3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iden3/go-iden3/git/refs{/sha}","trees_url":"https://api.github.com/repos/iden3/go-iden3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iden3/go-iden3/statuses/{sha}","languages_url":"https://api.github.com/repos/iden3/go-iden3/languages","stargazers_url":"https://api.github.com/repos/iden3/go-iden3/stargazers","contributors_url":"https://api.github.com/repos/iden3/go-iden3/contributors","subscribers_url":"https://api.github.com/repos/iden3/go-iden3/subscribers","subscription_url":"https://api.github.com/repos/iden3/go-iden3/subscription","commits_url":"https://api.github.com/repos/iden3/go-iden3/commits{/sha}","git_commits_url":"https://api.github.com/repos/iden3/go-iden3/git/commits{/sha}","comments_url":"https://api.github.com/repos/iden3/go-iden3/comments{/number}","issue_comment_url":"https://api.github.com/repos/iden3/go-iden3/issues/comments{/number}","contents_url":"https://api.github.com/repos/iden3/go-iden3/contents/{+path}","compare_url":"https://api.github.com/repos/iden3/go-iden3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iden3/go-iden3/merges","archive_url":"https://api.github.com/repos/iden3/go-iden3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iden3/go-iden3/downloads","issues_url":"https://api.github.com/repos/iden3/go-iden3/issues{/number}","pulls_url":"https://api.github.com/repos/iden3/go-iden3/pulls{/number}","milestones_url":"https://api.github.com/repos/iden3/go-iden3/milestones{/number}","notifications_url":"https://api.github.com/repos/iden3/go-iden3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iden3/go-iden3/labels{/name}","releases_url":"https://api.github.com/repos/iden3/go-iden3/releases{/id}","deployments_url":"https://api.github.com/repos/iden3/go-iden3/deployments","created_at":"2018-09-10T18:45:41Z","updated_at":"2018-12-05T15:29:48Z","pushed_at":"2018-12-10T12:55:35Z","git_url":"git://github.com/iden3/go-iden3.git","ssh_url":"git@github.com:iden3/go-iden3.git","clone_url":"https://github.com/iden3/go-iden3.git","svn_url":"https://github.com/iden3/go-iden3","homepage":null,"size":233,"stargazers_count":3,"watchers_count":3,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":2,"open_issues":3,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/iden3/go-iden3/pulls/34"},"html":{"href":"https://github.com/iden3/go-iden3/pull/34"},"issue":{"href":"https://api.github.com/repos/iden3/go-iden3/issues/34"},"comments":{"href":"https://api.github.com/repos/iden3/go-iden3/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/iden3/go-iden3/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/iden3/go-iden3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/iden3/go-iden3/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/iden3/go-iden3/statuses/411549b49306fa98c06f4071b5436145c8f1b2eb"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"arnaucube"}}