{"action":"created","comment":{"url":"https://api.github.com/repos/MasoniteFramework/core/pulls/comments/214524687","pull_request_review_id":151605134,"id":214524687,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNDUyNDY4Nw==","diff_hunk":"@@ -38,11 +38,16 @@ def sign(self, value):\n         \n         Returns:\n             string -- Returns the encrypted value.\n-        \"\"\"\n \n-        f = Fernet(self.key)\n-        self.encryption = f.encrypt(bytes(value, 'utf-8'))\n-        return self.encryption.decode('utf-8')\n+        Raises:\n+            InvalidSecretKey -- Thrown if the secret key does not have correct padding.\n+        \"\"\"\n+        try:\n+            f = Fernet(self.key)","path":"masonite/auth/Sign.py","position":22,"original_position":22,"commit_id":"60d53905ad59ea9e3e46282b49d865b949c16ec7","original_commit_id":"60d53905ad59ea9e3e46282b49d865b949c16ec7","user":{"login":"josephmancuso","id":20172538,"node_id":"MDQ6VXNlcjIwMTcyNTM4","avatar_url":"https://avatars1.githubusercontent.com/u/20172538?v=4","gravatar_id":"","url":"https://api.github.com/users/josephmancuso","html_url":"https://github.com/josephmancuso","followers_url":"https://api.github.com/users/josephmancuso/followers","following_url":"https://api.github.com/users/josephmancuso/following{/other_user}","gists_url":"https://api.github.com/users/josephmancuso/gists{/gist_id}","starred_url":"https://api.github.com/users/josephmancuso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josephmancuso/subscriptions","organizations_url":"https://api.github.com/users/josephmancuso/orgs","repos_url":"https://api.github.com/users/josephmancuso/repos","events_url":"https://api.github.com/users/josephmancuso/events{/privacy}","received_events_url":"https://api.github.com/users/josephmancuso/received_events","type":"User","site_admin":false},"body":"This is prob more of a pet peeve of mine but can we just wrap the code that was throwing the exception? Can we do something like:\r\n\r\n```python\r\ntry:\r\n    f = Fernet(self.key)\r\nexcept binascii.Error:\r\n    raise InvalidSecretKey(\"The encryption key passed does not have correct padding and therefore cannot be used as a secret key.\")\r\n\r\nself.encryption = f.encrypt(bytes(value, 'utf-8'))\r\nreturn self.encryption.decode('utf-8')\r\n```","created_at":"2018-09-01T22:56:56Z","updated_at":"2018-09-01T22:58:02Z","html_url":"https://github.com/MasoniteFramework/core/pull/269#discussion_r214524687","pull_request_url":"https://api.github.com/repos/MasoniteFramework/core/pulls/269","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/MasoniteFramework/core/pulls/comments/214524687"},"html":{"href":"https://github.com/MasoniteFramework/core/pull/269#discussion_r214524687"},"pull_request":{"href":"https://api.github.com/repos/MasoniteFramework/core/pulls/269"}}},"pull_request":{"url":"https://api.github.com/repos/MasoniteFramework/core/pulls/269","id":212567403,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyNTY3NDAz","html_url":"https://github.com/MasoniteFramework/core/pull/269","diff_url":"https://github.com/MasoniteFramework/core/pull/269.diff","patch_url":"https://github.com/MasoniteFramework/core/pull/269.patch","issue_url":"https://api.github.com/repos/MasoniteFramework/core/issues/269","number":269,"state":"open","locked":false,"title":"Hotfix/invalid key exception","user":{"login":"hammacktony","id":10157988,"node_id":"MDQ6VXNlcjEwMTU3OTg4","avatar_url":"https://avatars0.githubusercontent.com/u/10157988?v=4","gravatar_id":"","url":"https://api.github.com/users/hammacktony","html_url":"https://github.com/hammacktony","followers_url":"https://api.github.com/users/hammacktony/followers","following_url":"https://api.github.com/users/hammacktony/following{/other_user}","gists_url":"https://api.github.com/users/hammacktony/gists{/gist_id}","starred_url":"https://api.github.com/users/hammacktony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammacktony/subscriptions","organizations_url":"https://api.github.com/users/hammacktony/orgs","repos_url":"https://api.github.com/users/hammacktony/repos","events_url":"https://api.github.com/users/hammacktony/events{/privacy}","received_events_url":"https://api.github.com/users/hammacktony/received_events","type":"User","site_admin":false},"body":"Now, the classes throws an InvalidSecretKey exception due to incorrect padding.","created_at":"2018-09-01T22:40:05Z","updated_at":"2018-09-01T22:58:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"de198c28dbbc230977e22a6eb93a81702599bddd","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/MasoniteFramework/core/pulls/269/commits","review_comments_url":"https://api.github.com/repos/MasoniteFramework/core/pulls/269/comments","review_comment_url":"https://api.github.com/repos/MasoniteFramework/core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MasoniteFramework/core/issues/269/comments","statuses_url":"https://api.github.com/repos/MasoniteFramework/core/statuses/60d53905ad59ea9e3e46282b49d865b949c16ec7","head":{"label":"hammacktony:hotfix/invalid-key-exception","ref":"hotfix/invalid-key-exception","sha":"60d53905ad59ea9e3e46282b49d865b949c16ec7","user":{"login":"hammacktony","id":10157988,"node_id":"MDQ6VXNlcjEwMTU3OTg4","avatar_url":"https://avatars0.githubusercontent.com/u/10157988?v=4","gravatar_id":"","url":"https://api.github.com/users/hammacktony","html_url":"https://github.com/hammacktony","followers_url":"https://api.github.com/users/hammacktony/followers","following_url":"https://api.github.com/users/hammacktony/following{/other_user}","gists_url":"https://api.github.com/users/hammacktony/gists{/gist_id}","starred_url":"https://api.github.com/users/hammacktony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammacktony/subscriptions","organizations_url":"https://api.github.com/users/hammacktony/orgs","repos_url":"https://api.github.com/users/hammacktony/repos","events_url":"https://api.github.com/users/hammacktony/events{/privacy}","received_events_url":"https://api.github.com/users/hammacktony/received_events","type":"User","site_admin":false},"repo":{"id":147034375,"node_id":"MDEwOlJlcG9zaXRvcnkxNDcwMzQzNzU=","name":"core","full_name":"hammacktony/core","owner":{"login":"hammacktony","id":10157988,"node_id":"MDQ6VXNlcjEwMTU3OTg4","avatar_url":"https://avatars0.githubusercontent.com/u/10157988?v=4","gravatar_id":"","url":"https://api.github.com/users/hammacktony","html_url":"https://github.com/hammacktony","followers_url":"https://api.github.com/users/hammacktony/followers","following_url":"https://api.github.com/users/hammacktony/following{/other_user}","gists_url":"https://api.github.com/users/hammacktony/gists{/gist_id}","starred_url":"https://api.github.com/users/hammacktony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammacktony/subscriptions","organizations_url":"https://api.github.com/users/hammacktony/orgs","repos_url":"https://api.github.com/users/hammacktony/repos","events_url":"https://api.github.com/users/hammacktony/events{/privacy}","received_events_url":"https://api.github.com/users/hammacktony/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hammacktony/core","description":"Main pip package location for Masonite","fork":true,"url":"https://api.github.com/repos/hammacktony/core","forks_url":"https://api.github.com/repos/hammacktony/core/forks","keys_url":"https://api.github.com/repos/hammacktony/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hammacktony/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hammacktony/core/teams","hooks_url":"https://api.github.com/repos/hammacktony/core/hooks","issue_events_url":"https://api.github.com/repos/hammacktony/core/issues/events{/number}","events_url":"https://api.github.com/repos/hammacktony/core/events","assignees_url":"https://api.github.com/repos/hammacktony/core/assignees{/user}","branches_url":"https://api.github.com/repos/hammacktony/core/branches{/branch}","tags_url":"https://api.github.com/repos/hammacktony/core/tags","blobs_url":"https://api.github.com/repos/hammacktony/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hammacktony/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hammacktony/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/hammacktony/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hammacktony/core/statuses/{sha}","languages_url":"https://api.github.com/repos/hammacktony/core/languages","stargazers_url":"https://api.github.com/repos/hammacktony/core/stargazers","contributors_url":"https://api.github.com/repos/hammacktony/core/contributors","subscribers_url":"https://api.github.com/repos/hammacktony/core/subscribers","subscription_url":"https://api.github.com/repos/hammacktony/core/subscription","commits_url":"https://api.github.com/repos/hammacktony/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/hammacktony/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/hammacktony/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/hammacktony/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/hammacktony/core/contents/{+path}","compare_url":"https://api.github.com/repos/hammacktony/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hammacktony/core/merges","archive_url":"https://api.github.com/repos/hammacktony/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hammacktony/core/downloads","issues_url":"https://api.github.com/repos/hammacktony/core/issues{/number}","pulls_url":"https://api.github.com/repos/hammacktony/core/pulls{/number}","milestones_url":"https://api.github.com/repos/hammacktony/core/milestones{/number}","notifications_url":"https://api.github.com/repos/hammacktony/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hammacktony/core/labels{/name}","releases_url":"https://api.github.com/repos/hammacktony/core/releases{/id}","deployments_url":"https://api.github.com/repos/hammacktony/core/deployments","created_at":"2018-09-01T21:34:33Z","updated_at":"2018-09-01T21:34:35Z","pushed_at":"2018-09-01T22:37:35Z","git_url":"git://github.com/hammacktony/core.git","ssh_url":"git@github.com:hammacktony/core.git","clone_url":"https://github.com/hammacktony/core.git","svn_url":"https://github.com/hammacktony/core","homepage":"http://masoniteproject.com","size":721,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"2.0"}},"base":{"label":"MasoniteFramework:master","ref":"master","sha":"eb3951e9ac6548e4f1fcfcc7d2670cbe57120196","user":{"login":"MasoniteFramework","id":35498523,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NDk4NTIz","avatar_url":"https://avatars2.githubusercontent.com/u/35498523?v=4","gravatar_id":"","url":"https://api.github.com/users/MasoniteFramework","html_url":"https://github.com/MasoniteFramework","followers_url":"https://api.github.com/users/MasoniteFramework/followers","following_url":"https://api.github.com/users/MasoniteFramework/following{/other_user}","gists_url":"https://api.github.com/users/MasoniteFramework/gists{/gist_id}","starred_url":"https://api.github.com/users/MasoniteFramework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MasoniteFramework/subscriptions","organizations_url":"https://api.github.com/users/MasoniteFramework/orgs","repos_url":"https://api.github.com/users/MasoniteFramework/repos","events_url":"https://api.github.com/users/MasoniteFramework/events{/privacy}","received_events_url":"https://api.github.com/users/MasoniteFramework/received_events","type":"Organization","site_admin":false},"repo":{"id":116712367,"node_id":"MDEwOlJlcG9zaXRvcnkxMTY3MTIzNjc=","name":"core","full_name":"MasoniteFramework/core","owner":{"login":"MasoniteFramework","id":35498523,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NDk4NTIz","avatar_url":"https://avatars2.githubusercontent.com/u/35498523?v=4","gravatar_id":"","url":"https://api.github.com/users/MasoniteFramework","html_url":"https://github.com/MasoniteFramework","followers_url":"https://api.github.com/users/MasoniteFramework/followers","following_url":"https://api.github.com/users/MasoniteFramework/following{/other_user}","gists_url":"https://api.github.com/users/MasoniteFramework/gists{/gist_id}","starred_url":"https://api.github.com/users/MasoniteFramework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MasoniteFramework/subscriptions","organizations_url":"https://api.github.com/users/MasoniteFramework/orgs","repos_url":"https://api.github.com/users/MasoniteFramework/repos","events_url":"https://api.github.com/users/MasoniteFramework/events{/privacy}","received_events_url":"https://api.github.com/users/MasoniteFramework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MasoniteFramework/core","description":"Main pip package location for Masonite","fork":false,"url":"https://api.github.com/repos/MasoniteFramework/core","forks_url":"https://api.github.com/repos/MasoniteFramework/core/forks","keys_url":"https://api.github.com/repos/MasoniteFramework/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MasoniteFramework/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MasoniteFramework/core/teams","hooks_url":"https://api.github.com/repos/MasoniteFramework/core/hooks","issue_events_url":"https://api.github.com/repos/MasoniteFramework/core/issues/events{/number}","events_url":"https://api.github.com/repos/MasoniteFramework/core/events","assignees_url":"https://api.github.com/repos/MasoniteFramework/core/assignees{/user}","branches_url":"https://api.github.com/repos/MasoniteFramework/core/branches{/branch}","tags_url":"https://api.github.com/repos/MasoniteFramework/core/tags","blobs_url":"https://api.github.com/repos/MasoniteFramework/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MasoniteFramework/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MasoniteFramework/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/MasoniteFramework/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MasoniteFramework/core/statuses/{sha}","languages_url":"https://api.github.com/repos/MasoniteFramework/core/languages","stargazers_url":"https://api.github.com/repos/MasoniteFramework/core/stargazers","contributors_url":"https://api.github.com/repos/MasoniteFramework/core/contributors","subscribers_url":"https://api.github.com/repos/MasoniteFramework/core/subscribers","subscription_url":"https://api.github.com/repos/MasoniteFramework/core/subscription","commits_url":"https://api.github.com/repos/MasoniteFramework/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/MasoniteFramework/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/MasoniteFramework/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/MasoniteFramework/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/MasoniteFramework/core/contents/{+path}","compare_url":"https://api.github.com/repos/MasoniteFramework/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MasoniteFramework/core/merges","archive_url":"https://api.github.com/repos/MasoniteFramework/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MasoniteFramework/core/downloads","issues_url":"https://api.github.com/repos/MasoniteFramework/core/issues{/number}","pulls_url":"https://api.github.com/repos/MasoniteFramework/core/pulls{/number}","milestones_url":"https://api.github.com/repos/MasoniteFramework/core/milestones{/number}","notifications_url":"https://api.github.com/repos/MasoniteFramework/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MasoniteFramework/core/labels{/name}","releases_url":"https://api.github.com/repos/MasoniteFramework/core/releases{/id}","deployments_url":"https://api.github.com/repos/MasoniteFramework/core/deployments","created_at":"2018-01-08T18:23:39Z","updated_at":"2018-09-01T22:22:05Z","pushed_at":"2018-09-01T22:40:06Z","git_url":"git://github.com/MasoniteFramework/core.git","ssh_url":"git@github.com:MasoniteFramework/core.git","clone_url":"https://github.com/MasoniteFramework/core.git","svn_url":"https://github.com/MasoniteFramework/core","homepage":"http://masoniteproject.com","size":720,"stargazers_count":18,"watchers_count":18,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":13,"mirror_url":null,"archived":false,"open_issues_count":17,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":13,"open_issues":17,"watchers":18,"default_branch":"2.0"}},"_links":{"self":{"href":"https://api.github.com/repos/MasoniteFramework/core/pulls/269"},"html":{"href":"https://github.com/MasoniteFramework/core/pull/269"},"issue":{"href":"https://api.github.com/repos/MasoniteFramework/core/issues/269"},"comments":{"href":"https://api.github.com/repos/MasoniteFramework/core/issues/269/comments"},"review_comments":{"href":"https://api.github.com/repos/MasoniteFramework/core/pulls/269/comments"},"review_comment":{"href":"https://api.github.com/repos/MasoniteFramework/core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MasoniteFramework/core/pulls/269/commits"},"statuses":{"href":"https://api.github.com/repos/MasoniteFramework/core/statuses/60d53905ad59ea9e3e46282b49d865b949c16ec7"}},"author_association":"NONE"}}
{"actor":{"display_login":"josephmancuso"}}