{"action":"created","issue":{"url":"https://api.github.com/repos/grant-project/grant-monorepo/issues/138","repository_url":"https://api.github.com/repos/grant-project/grant-monorepo","labels_url":"https://api.github.com/repos/grant-project/grant-monorepo/issues/138/labels{/name}","comments_url":"https://api.github.com/repos/grant-project/grant-monorepo/issues/138/comments","events_url":"https://api.github.com/repos/grant-project/grant-monorepo/issues/138/events","html_url":"https://github.com/grant-project/grant-monorepo/pull/138","id":367060144,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwNTg1OTEy","number":138,"title":"EIP-712 User Authorization","user":{"login":"dternyak","id":7861465,"node_id":"MDQ6VXNlcjc4NjE0NjU=","avatar_url":"https://avatars2.githubusercontent.com/u/7861465?v=4","gravatar_id":"","url":"https://api.github.com/users/dternyak","html_url":"https://github.com/dternyak","followers_url":"https://api.github.com/users/dternyak/followers","following_url":"https://api.github.com/users/dternyak/following{/other_user}","gists_url":"https://api.github.com/users/dternyak/gists{/gist_id}","starred_url":"https://api.github.com/users/dternyak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dternyak/subscriptions","organizations_url":"https://api.github.com/users/dternyak/orgs","repos_url":"https://api.github.com/users/dternyak/repos","events_url":"https://api.github.com/users/dternyak/events{/privacy}","received_events_url":"https://api.github.com/users/dternyak/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-10-05T04:58:50Z","updated_at":"2018-10-20T05:00:30Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/grant-project/grant-monorepo/pulls/138","html_url":"https://github.com/grant-project/grant-monorepo/pull/138","diff_url":"https://github.com/grant-project/grant-monorepo/pull/138.diff","patch_url":"https://github.com/grant-project/grant-monorepo/pull/138.patch"},"body":"Depends on https://github.com/grant-project/grant-monorepo/pull/137\r\n\r\nCloses https://github.com/grant-project/grant-monorepo/issues/65\r\n\r\n### What this does\r\nThis PR introduces a `requires_sm` decorator. This decorator is used to decorate a flask API route to validate that a `Data` and `Signature` header with raw EIP-712 typed data and the corresponding signature is valid.\r\n\r\nThe server will respond with a `4xx` in the case that these headers either don't exist or are invalid.\r\n\r\nAssuming that validation passes, the decorator will add the authorized `user` object as `g.current_user`, a request scoped global variable that Flask provides to make it easy to safely store and access request specific data (like the authorized user!).\r\n\r\nThis PR also introduces the `api/v1/users/me/` endpoint that implements the `requires_sm` decorator to demonstrate this working in action.\r\n\r\n##### Note: You will need network access when interacting with endpoints that make use of `requires_sm` due to an external call to the https://github.com/grant-project/eip-712-server based service."},"comment":{"url":"https://api.github.com/repos/grant-project/grant-monorepo/issues/comments/431549063","html_url":"https://github.com/grant-project/grant-monorepo/pull/138#issuecomment-431549063","issue_url":"https://api.github.com/repos/grant-project/grant-monorepo/issues/138","id":431549063,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTU0OTA2Mw==","user":{"login":"dternyak","id":7861465,"node_id":"MDQ6VXNlcjc4NjE0NjU=","avatar_url":"https://avatars2.githubusercontent.com/u/7861465?v=4","gravatar_id":"","url":"https://api.github.com/users/dternyak","html_url":"https://github.com/dternyak","followers_url":"https://api.github.com/users/dternyak/followers","following_url":"https://api.github.com/users/dternyak/following{/other_user}","gists_url":"https://api.github.com/users/dternyak/gists{/gist_id}","starred_url":"https://api.github.com/users/dternyak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dternyak/subscriptions","organizations_url":"https://api.github.com/users/dternyak/orgs","repos_url":"https://api.github.com/users/dternyak/repos","events_url":"https://api.github.com/users/dternyak/events{/privacy}","received_events_url":"https://api.github.com/users/dternyak/received_events","type":"User","site_admin":false},"created_at":"2018-10-20T05:00:30Z","updated_at":"2018-10-20T05:00:30Z","author_association":"COLLABORATOR","body":"@wbobeirne Good point! I renamed to `MsgSignature` and `RawTypedData` for the headers."}}
{"actor":{"display_login":"dternyak"}}