{"action":"created","issue":{"url":"https://api.github.com/repos/bryanjos/joken/issues/64","labels_url":"https://api.github.com/repos/bryanjos/joken/issues/64/labels{/name}","comments_url":"https://api.github.com/repos/bryanjos/joken/issues/64/comments","events_url":"https://api.github.com/repos/bryanjos/joken/issues/64/events","html_url":"https://github.com/bryanjos/joken/pull/64","id":101324784,"number":64,"title":"Added with_* and validate functions","user":{"login":"cs-victor-nascimento","id":7049728,"avatar_url":"https://avatars.githubusercontent.com/u/7049728?v=3","gravatar_id":"","url":"https://api.github.com/users/cs-victor-nascimento","html_url":"https://github.com/cs-victor-nascimento","followers_url":"https://api.github.com/users/cs-victor-nascimento/followers","following_url":"https://api.github.com/users/cs-victor-nascimento/following{/other_user}","gists_url":"https://api.github.com/users/cs-victor-nascimento/gists{/gist_id}","starred_url":"https://api.github.com/users/cs-victor-nascimento/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cs-victor-nascimento/subscriptions","organizations_url":"https://api.github.com/users/cs-victor-nascimento/orgs","repos_url":"https://api.github.com/users/cs-victor-nascimento/repos","events_url":"https://api.github.com/users/cs-victor-nascimento/events{/privacy}","received_events_url":"https://api.github.com/users/cs-victor-nascimento/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-17T02:30:35Z","updated_at":"2015-08-17T21:55:06Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/bryanjos/joken/pulls/64","html_url":"https://github.com/bryanjos/joken/pull/64","diff_url":"https://github.com/bryanjos/joken/pull/64.diff","patch_url":"https://github.com/bryanjos/joken/pull/64.patch"},"body":"This is to help on the ongoing effort of refactoring the code base. I know this is incomplete and feel free to deny this PR, but this implements partially (without tests, documentation and type specification) what is being discussed in #62 on top of your initial changes. \r\n\r\nWhat we have here is:\r\n\r\n- all default with_* functions.\r\n- verifying a token\r\n- some refactoring of where the code belongs to (moved signing and verifying to signer)\r\n\r\nThe intention is to help us move forward in the discussion. With this PR you can do this in iex:\r\n\r\n```elixir\r\nimport Joken\r\n\r\ntoken \r\n|> with_sub(\"I am the subject\") \r\n|> with_validation(:sub, %(&1 == \"I am the subject\"))\r\n|> with_HS512(\"my ultra secret secret\") # convenience function\r\n|> sign # also convenience. generates the token\r\n|> verify # generates the claims map from a token\r\n```\r\n\r\nThis still signs/verifies as soon as you call those functions and it returns the struct always. Following some other discussions here I changed errors to error (because the user will not have to pattern match on a list of errors) and assumed some more defaults (mainly Poison). I renamed payload to claims as that is more explicit to me, but feel free to revert that. \r\n\r\nI haven't implemented tests, documentation and specs because I feel like this is a good point to discuss a bit more."},"comment":{"url":"https://api.github.com/repos/bryanjos/joken/issues/comments/131975091","html_url":"https://github.com/bryanjos/joken/pull/64#issuecomment-131975091","issue_url":"https://api.github.com/repos/bryanjos/joken/issues/64","id":131975091,"user":{"login":"cs-victor-nascimento","id":7049728,"avatar_url":"https://avatars.githubusercontent.com/u/7049728?v=3","gravatar_id":"","url":"https://api.github.com/users/cs-victor-nascimento","html_url":"https://github.com/cs-victor-nascimento","followers_url":"https://api.github.com/users/cs-victor-nascimento/followers","following_url":"https://api.github.com/users/cs-victor-nascimento/following{/other_user}","gists_url":"https://api.github.com/users/cs-victor-nascimento/gists{/gist_id}","starred_url":"https://api.github.com/users/cs-victor-nascimento/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cs-victor-nascimento/subscriptions","organizations_url":"https://api.github.com/users/cs-victor-nascimento/orgs","repos_url":"https://api.github.com/users/cs-victor-nascimento/repos","events_url":"https://api.github.com/users/cs-victor-nascimento/events{/privacy}","received_events_url":"https://api.github.com/users/cs-victor-nascimento/received_events","type":"User","site_admin":false},"created_at":"2015-08-17T21:55:06Z","updated_at":"2015-08-17T21:55:06Z","body":"I think this work is to be done in multiple steps. You can merge this one and I will open another PR to adapt this for convenience functions. What you say?"}}