{"action":"created","comment":{"url":"https://api.github.com/repos/bigchaindb/cryptoconditions/pulls/comments/81170250","pull_request_review_id":2170172,"id":81170250,"diff_hunk":"@@ -1,269 +1,121 @@\n # Separate all crypto code so that we can easily test several implementations\n-from abc import ABCMeta, abstractmethod\n import base64\n-\n import base58\n-import ed25519\n-\n-\n-class SigningKey(metaclass=ABCMeta):\n-    \"\"\"\n-    SigningKey instance\n-    \"\"\"\n-\n-    @abstractmethod\n-    def sign(self, data):\n-        \"\"\"\n-        Sign data with private key\n+import nacl.signing\n+import nacl.encoding\n+import nacl.exceptions\n \n-        Args:\n-            data:\n-        \"\"\"\n+from cryptoconditions import exceptions\n \n-    @abstractmethod\n-    def get_verifying_key(self):\n-        \"\"\"\n-        Get the associated verifying key\n-\n-        Returns:\n-            A VerifyingKey object\n-        \"\"\"\n-\n-    @abstractmethod\n-    def to_ascii(self, prefix, encoding):\n-        \"\"\"\n-        Encode the external value\n-\n-        Args:\n-            prefix:\n-            encoding:\n-        \"\"\"\n-\n-    @staticmethod\n-    @abstractmethod\n-    def encode(private_value):\n-        \"\"\"\n-        Encode the internal private_value to base58\n \n-        Args:\n-            private_value:\n-        \"\"\"\n+class Base58Encoder(object):\n \n     @staticmethod\n-    @abstractmethod\n-    def decode(private_base58):\n-        \"\"\"\n-        Decode the base58 private value to internal value\n-\n-        Args:\n-            private_base58 (base58):\n-        \"\"\"\n-        raise NotImplementedError\n-\n-\n-class VerifyingKey(metaclass=ABCMeta):\n-\n-    @abstractmethod\n-    def verify(self, data, signature):\n-        \"\"\"\n-        Check the if the signature matches the data and this verifyingkey\n-\n-        Args:\n-            data:\n-            signature:\n-\n-        Returns:\n-            boolean:\n-        \"\"\"\n-\n-    @abstractmethod\n-    def to_ascii(self, prefix, encoding):\n-        \"\"\"\n-        Encode the external value\n-\n-        Args:\n-            prefix:\n-            encoding:\n-        \"\"\"\n+    def encode(data):\n+        return base58.b58encode(data).encode()\n \n     @staticmethod\n-    @abstractmethod\n-    def encode(public_value):\n-        \"\"\"\n-        Encode the public key to base58 represented by the internal values\n-\n-        Args:\n-            public_value\n-        \"\"\"\n-\n-    @staticmethod\n-    @abstractmethod\n-    def decode(public_base58):\n-        \"\"\"\n-        Decode the base58 public_value to internal value\n-\n-        Args:\n-            public_base58 (base58):\n-        \"\"\"\n-\n-\n-class Ed25519SigningKey(ed25519.SigningKey, SigningKey):\n+    def decode(data):\n+        return base58.b58decode(data)\n+\n+\n+def _get_nacl_encoder(encoding):\n+    if encoding == 'base58':\n+        return Base58Encoder\n+    elif encoding == 'base64':\n+        return nacl.encoding.Base64Encoder\n+    elif encoding == 'base32':\n+        return nacl.encoding.Base32Encoder\n+    elif encoding == 'base16':\n+        return nacl.encoding.Base16Encoder\n+    elif encoding == 'hex':\n+        return nacl.encoding.HexEncoder\n+    elif encoding is 'bytes':\n+        return nacl.encoding.RawEncoder\n+    else:\n+        raise exceptions.UnknownEncodingError(\"Unknown or unsupported encoding\")\n+\n+\n+class Ed25519SigningKey(nacl.signing.SigningKey):","path":"cryptoconditions/crypto.py","position":139,"original_position":139,"commit_id":"a5b7cee91ee909e7a13a0c28f9972072243eef00","original_commit_id":"0d72c9903957f0c7a67f92c7c3112d5cedc7d145","user":{"login":"diminator","id":6178597,"avatar_url":"https://avatars.githubusercontent.com/u/6178597?v=3","gravatar_id":"","url":"https://api.github.com/users/diminator","html_url":"https://github.com/diminator","followers_url":"https://api.github.com/users/diminator/followers","following_url":"https://api.github.com/users/diminator/following{/other_user}","gists_url":"https://api.github.com/users/diminator/gists{/gist_id}","starred_url":"https://api.github.com/users/diminator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diminator/subscriptions","organizations_url":"https://api.github.com/users/diminator/orgs","repos_url":"https://api.github.com/users/diminator/repos","events_url":"https://api.github.com/users/diminator/events{/privacy}","received_events_url":"https://api.github.com/users/diminator/received_events","type":"User","site_admin":false},"body":"BTW: in this case it seems not worth spending effort in discussing the most elegant pattern... bigger fish","created_at":"2016-09-29T15:52:54Z","updated_at":"2016-09-29T15:52:54Z","html_url":"https://github.com/bigchaindb/cryptoconditions/pull/28#discussion_r81170250","pull_request_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/pulls/28","_links":{"self":{"href":"https://api.github.com/repos/bigchaindb/cryptoconditions/pulls/comments/81170250"},"html":{"href":"https://github.com/bigchaindb/cryptoconditions/pull/28#discussion_r81170250"},"pull_request":{"href":"https://api.github.com/repos/bigchaindb/cryptoconditions/pulls/28"}}},"pull_request":{"url":"https://api.github.com/repos/bigchaindb/cryptoconditions/pulls/28","id":87139868,"html_url":"https://github.com/bigchaindb/cryptoconditions/pull/28","diff_url":"https://github.com/bigchaindb/cryptoconditions/pull/28.diff","patch_url":"https://github.com/bigchaindb/cryptoconditions/pull/28.patch","issue_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/issues/28","number":28,"state":"open","locked":false,"title":"Fix encoding problem","user":{"login":"r-marques","id":1793187,"avatar_url":"https://avatars.githubusercontent.com/u/1793187?v=3","gravatar_id":"","url":"https://api.github.com/users/r-marques","html_url":"https://github.com/r-marques","followers_url":"https://api.github.com/users/r-marques/followers","following_url":"https://api.github.com/users/r-marques/following{/other_user}","gists_url":"https://api.github.com/users/r-marques/gists{/gist_id}","starred_url":"https://api.github.com/users/r-marques/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/r-marques/subscriptions","organizations_url":"https://api.github.com/users/r-marques/orgs","repos_url":"https://api.github.com/users/r-marques/repos","events_url":"https://api.github.com/users/r-marques/events{/privacy}","received_events_url":"https://api.github.com/users/r-marques/received_events","type":"User","site_admin":false},"body":"resolves #22 \r\n\r\nThis pull request replaces the ed25519 python library with pynacl.\r\npynacl is a python binding for libsodium and is under active development.\r\n\r\nBesides replacing the libraries, also change the way encoding is handled. Now instead of the `encode`, `to_ascii`, and `to_bytes` methods we have only `encode` and we can pass the encoding that we want. Supported  encoders are hex, bytes, base16, base32, base58, base64\r\n\r\n__TODO__:\r\n- [x] Fix the docstrings and documentation","created_at":"2016-09-28T15:09:59Z","updated_at":"2016-09-29T15:52:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2d53327f19f68e74be42c0d811bf80e0b98123ca","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/pulls/28/commits","review_comments_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/pulls/28/comments","review_comment_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/issues/28/comments","statuses_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/statuses/a5b7cee91ee909e7a13a0c28f9972072243eef00","head":{"label":"bigchaindb:fix-encoding-problem","ref":"fix-encoding-problem","sha":"a5b7cee91ee909e7a13a0c28f9972072243eef00","user":{"login":"bigchaindb","id":17097586,"avatar_url":"https://avatars.githubusercontent.com/u/17097586?v=3","gravatar_id":"","url":"https://api.github.com/users/bigchaindb","html_url":"https://github.com/bigchaindb","followers_url":"https://api.github.com/users/bigchaindb/followers","following_url":"https://api.github.com/users/bigchaindb/following{/other_user}","gists_url":"https://api.github.com/users/bigchaindb/gists{/gist_id}","starred_url":"https://api.github.com/users/bigchaindb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bigchaindb/subscriptions","organizations_url":"https://api.github.com/users/bigchaindb/orgs","repos_url":"https://api.github.com/users/bigchaindb/repos","events_url":"https://api.github.com/users/bigchaindb/events{/privacy}","received_events_url":"https://api.github.com/users/bigchaindb/received_events","type":"Organization","site_admin":false},"repo":{"id":54462422,"name":"cryptoconditions","full_name":"bigchaindb/cryptoconditions","owner":{"login":"bigchaindb","id":17097586,"avatar_url":"https://avatars.githubusercontent.com/u/17097586?v=3","gravatar_id":"","url":"https://api.github.com/users/bigchaindb","html_url":"https://github.com/bigchaindb","followers_url":"https://api.github.com/users/bigchaindb/followers","following_url":"https://api.github.com/users/bigchaindb/following{/other_user}","gists_url":"https://api.github.com/users/bigchaindb/gists{/gist_id}","starred_url":"https://api.github.com/users/bigchaindb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bigchaindb/subscriptions","organizations_url":"https://api.github.com/users/bigchaindb/orgs","repos_url":"https://api.github.com/users/bigchaindb/repos","events_url":"https://api.github.com/users/bigchaindb/events{/privacy}","received_events_url":"https://api.github.com/users/bigchaindb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bigchaindb/cryptoconditions","description":"Multi-algorithm, multi-level, multi-signature format for expressing conditions and fulfillments according to the Interledger Protocol (ILP)","fork":false,"url":"https://api.github.com/repos/bigchaindb/cryptoconditions","forks_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/forks","keys_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/teams","hooks_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/hooks","issue_events_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/issues/events{/number}","events_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/events","assignees_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/assignees{/user}","branches_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/branches{/branch}","tags_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/tags","blobs_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/git/refs{/sha}","trees_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/statuses/{sha}","languages_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/languages","stargazers_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/stargazers","contributors_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/contributors","subscribers_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/subscribers","subscription_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/subscription","commits_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/commits{/sha}","git_commits_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/git/commits{/sha}","comments_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/comments{/number}","issue_comment_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/issues/comments{/number}","contents_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/contents/{+path}","compare_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/merges","archive_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/downloads","issues_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/issues{/number}","pulls_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/pulls{/number}","milestones_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/milestones{/number}","notifications_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/labels{/name}","releases_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/releases{/id}","deployments_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/deployments","created_at":"2016-03-22T09:29:30Z","updated_at":"2016-09-26T16:41:59Z","pushed_at":"2016-09-29T12:39:22Z","git_url":"git://github.com/bigchaindb/cryptoconditions.git","ssh_url":"git@github.com:bigchaindb/cryptoconditions.git","clone_url":"https://github.com/bigchaindb/cryptoconditions.git","svn_url":"https://github.com/bigchaindb/cryptoconditions","homepage":"","size":166,"stargazers_count":13,"watchers_count":13,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":14,"forks":3,"open_issues":14,"watchers":13,"default_branch":"master"}},"base":{"label":"bigchaindb:master","ref":"master","sha":"a2c8390cd23f53ff22e88a760b1e62cf17f5db79","user":{"login":"bigchaindb","id":17097586,"avatar_url":"https://avatars.githubusercontent.com/u/17097586?v=3","gravatar_id":"","url":"https://api.github.com/users/bigchaindb","html_url":"https://github.com/bigchaindb","followers_url":"https://api.github.com/users/bigchaindb/followers","following_url":"https://api.github.com/users/bigchaindb/following{/other_user}","gists_url":"https://api.github.com/users/bigchaindb/gists{/gist_id}","starred_url":"https://api.github.com/users/bigchaindb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bigchaindb/subscriptions","organizations_url":"https://api.github.com/users/bigchaindb/orgs","repos_url":"https://api.github.com/users/bigchaindb/repos","events_url":"https://api.github.com/users/bigchaindb/events{/privacy}","received_events_url":"https://api.github.com/users/bigchaindb/received_events","type":"Organization","site_admin":false},"repo":{"id":54462422,"name":"cryptoconditions","full_name":"bigchaindb/cryptoconditions","owner":{"login":"bigchaindb","id":17097586,"avatar_url":"https://avatars.githubusercontent.com/u/17097586?v=3","gravatar_id":"","url":"https://api.github.com/users/bigchaindb","html_url":"https://github.com/bigchaindb","followers_url":"https://api.github.com/users/bigchaindb/followers","following_url":"https://api.github.com/users/bigchaindb/following{/other_user}","gists_url":"https://api.github.com/users/bigchaindb/gists{/gist_id}","starred_url":"https://api.github.com/users/bigchaindb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bigchaindb/subscriptions","organizations_url":"https://api.github.com/users/bigchaindb/orgs","repos_url":"https://api.github.com/users/bigchaindb/repos","events_url":"https://api.github.com/users/bigchaindb/events{/privacy}","received_events_url":"https://api.github.com/users/bigchaindb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bigchaindb/cryptoconditions","description":"Multi-algorithm, multi-level, multi-signature format for expressing conditions and fulfillments according to the Interledger Protocol (ILP)","fork":false,"url":"https://api.github.com/repos/bigchaindb/cryptoconditions","forks_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/forks","keys_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/teams","hooks_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/hooks","issue_events_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/issues/events{/number}","events_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/events","assignees_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/assignees{/user}","branches_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/branches{/branch}","tags_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/tags","blobs_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/git/refs{/sha}","trees_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/statuses/{sha}","languages_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/languages","stargazers_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/stargazers","contributors_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/contributors","subscribers_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/subscribers","subscription_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/subscription","commits_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/commits{/sha}","git_commits_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/git/commits{/sha}","comments_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/comments{/number}","issue_comment_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/issues/comments{/number}","contents_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/contents/{+path}","compare_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/merges","archive_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/downloads","issues_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/issues{/number}","pulls_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/pulls{/number}","milestones_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/milestones{/number}","notifications_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/labels{/name}","releases_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/releases{/id}","deployments_url":"https://api.github.com/repos/bigchaindb/cryptoconditions/deployments","created_at":"2016-03-22T09:29:30Z","updated_at":"2016-09-26T16:41:59Z","pushed_at":"2016-09-29T12:39:22Z","git_url":"git://github.com/bigchaindb/cryptoconditions.git","ssh_url":"git@github.com:bigchaindb/cryptoconditions.git","clone_url":"https://github.com/bigchaindb/cryptoconditions.git","svn_url":"https://github.com/bigchaindb/cryptoconditions","homepage":"","size":166,"stargazers_count":13,"watchers_count":13,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":14,"forks":3,"open_issues":14,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bigchaindb/cryptoconditions/pulls/28"},"html":{"href":"https://github.com/bigchaindb/cryptoconditions/pull/28"},"issue":{"href":"https://api.github.com/repos/bigchaindb/cryptoconditions/issues/28"},"comments":{"href":"https://api.github.com/repos/bigchaindb/cryptoconditions/issues/28/comments"},"review_comments":{"href":"https://api.github.com/repos/bigchaindb/cryptoconditions/pulls/28/comments"},"review_comment":{"href":"https://api.github.com/repos/bigchaindb/cryptoconditions/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bigchaindb/cryptoconditions/pulls/28/commits"},"statuses":{"href":"https://api.github.com/repos/bigchaindb/cryptoconditions/statuses/a5b7cee91ee909e7a13a0c28f9972072243eef00"}}}}
{"actor":{"display_login":"diminator"}}