{"action":"created","issue":{"url":"https://api.github.com/repos/haskell-crypto/cryptonite/issues/53","labels_url":"https://api.github.com/repos/haskell-crypto/cryptonite/issues/53/labels{/name}","comments_url":"https://api.github.com/repos/haskell-crypto/cryptonite/issues/53/comments","events_url":"https://api.github.com/repos/haskell-crypto/cryptonite/issues/53/events","html_url":"https://github.com/haskell-crypto/cryptonite/pull/53","id":120235276,"number":53,"title":"[ChaChaPoly1305] fix type error of example code","user":{"login":"kinoru","id":309724,"avatar_url":"https://avatars.githubusercontent.com/u/309724?v=3","gravatar_id":"","url":"https://api.github.com/users/kinoru","html_url":"https://github.com/kinoru","followers_url":"https://api.github.com/users/kinoru/followers","following_url":"https://api.github.com/users/kinoru/following{/other_user}","gists_url":"https://api.github.com/users/kinoru/gists{/gist_id}","starred_url":"https://api.github.com/users/kinoru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinoru/subscriptions","organizations_url":"https://api.github.com/users/kinoru/orgs","repos_url":"https://api.github.com/users/kinoru/repos","events_url":"https://api.github.com/users/kinoru/events{/privacy}","received_events_url":"https://api.github.com/users/kinoru/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-03T18:14:16Z","updated_at":"2016-01-05T17:52:14Z","closed_at":"2016-01-05T17:49:58Z","pull_request":{"url":"https://api.github.com/repos/haskell-crypto/cryptonite/pulls/53","html_url":"https://github.com/haskell-crypto/cryptonite/pull/53","diff_url":"https://github.com/haskell-crypto/cryptonite/pull/53.diff","patch_url":"https://github.com/haskell-crypto/cryptonite/pull/53.patch"},"body":"The example code had a type mismatch.\r\n\r\n    Couldn't match expected type ‘State’\r\n                with actual type ‘CryptoFailable State’\r\n    In the second argument of ‘appendAAD’, namely ‘st1’\r\n    In the second argument of ‘($)’, namely ‘appendAAD hdr st1’\r\n\r\nThis is due to the following part:\r\n\r\n    let st1 = ChaChaPoly1305.initialize key nonce\r\n        st2 = ChaChaPoly1305.finalizeAAD $ ChaChaPoly1305.appendAAD hdr st1\r\n\r\n`initialize` returns `CryptoFailable State`, not `State`.\r\n\r\nThis commit fixes the type mismatch, changes the return type of the example function to `CryptoFailable ByteString`, and makes the code to be immediately copy-and-paste-able.\r\n\r\nBy the way, will it be a good idea to put the corresponding `decrypt` function? (having the type of `CryptoFailable ByteString` with a correct auth tag checking.)"},"comment":{"url":"https://api.github.com/repos/haskell-crypto/cryptonite/issues/comments/169079877","html_url":"https://github.com/haskell-crypto/cryptonite/pull/53#issuecomment-169079877","issue_url":"https://api.github.com/repos/haskell-crypto/cryptonite/issues/53","id":169079877,"user":{"login":"vincenthz","id":174631,"avatar_url":"https://avatars.githubusercontent.com/u/174631?v=3","gravatar_id":"","url":"https://api.github.com/users/vincenthz","html_url":"https://github.com/vincenthz","followers_url":"https://api.github.com/users/vincenthz/followers","following_url":"https://api.github.com/users/vincenthz/following{/other_user}","gists_url":"https://api.github.com/users/vincenthz/gists{/gist_id}","starred_url":"https://api.github.com/users/vincenthz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vincenthz/subscriptions","organizations_url":"https://api.github.com/users/vincenthz/orgs","repos_url":"https://api.github.com/users/vincenthz/repos","events_url":"https://api.github.com/users/vincenthz/events{/privacy}","received_events_url":"https://api.github.com/users/vincenthz/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T17:52:14Z","updated_at":"2016-01-05T17:52:14Z","body":"Thanks.\r\n\r\nFor the missing 20, it's a simple omission but unless there's some conflicts in what the name means, I suspect it's a bit too costly to fix now; However, if someone want to fix this, one could create a duplicated ChaCha20Poly1305 module and add a deprecation to the current one in several months or so."}}