{"action":"created","issue":{"url":"https://api.github.com/repos/jedisct1/libsodium.js/issues/175","repository_url":"https://api.github.com/repos/jedisct1/libsodium.js","labels_url":"https://api.github.com/repos/jedisct1/libsodium.js/issues/175/labels{/name}","comments_url":"https://api.github.com/repos/jedisct1/libsodium.js/issues/175/comments","events_url":"https://api.github.com/repos/jedisct1/libsodium.js/issues/175/events","html_url":"https://github.com/jedisct1/libsodium.js/issues/175","id":365533310,"node_id":"MDU6SXNzdWUzNjU1MzMzMTA=","number":175,"title":"Unable to use sodium.crypto_pwhash_MEMLIMIT_INTERACTIVE in browser","user":{"login":"fredemmott","id":360927,"node_id":"MDQ6VXNlcjM2MDkyNw==","avatar_url":"https://avatars2.githubusercontent.com/u/360927?v=4","gravatar_id":"","url":"https://api.github.com/users/fredemmott","html_url":"https://github.com/fredemmott","followers_url":"https://api.github.com/users/fredemmott/followers","following_url":"https://api.github.com/users/fredemmott/following{/other_user}","gists_url":"https://api.github.com/users/fredemmott/gists{/gist_id}","starred_url":"https://api.github.com/users/fredemmott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fredemmott/subscriptions","organizations_url":"https://api.github.com/users/fredemmott/orgs","repos_url":"https://api.github.com/users/fredemmott/repos","events_url":"https://api.github.com/users/fredemmott/events{/privacy}","received_events_url":"https://api.github.com/users/fredemmott/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-10-01T16:07:28Z","updated_at":"2018-10-01T19:31:27Z","closed_at":null,"author_association":"NONE","body":"Code:\r\n\r\n```\r\n<html>\r\n  <head>\r\n    <script language=\"javascript\">\r\n      console.log(\"starting\");\r\n      window.sodium = {\r\n        onload: function(sodium) {\r\n          console.log('hello');\r\n          let password = 'toor';\r\n          let salt = sodium.randombytes_buf(sodium.crypto_pwhash_SALTBYTES);\r\n          let key = sodium.crypto_pwhash(\r\n            sodium.crypto_secretbox_KEYBYTES,\r\n            password,\r\n            salt,\r\n            sodium.crypto_pwhash_OPSLIMIT_INTERACTIVE,\r\n            sodium.crypto_pwhash_MEMLIMIT_INTERACTIVE, // 1024 * 1024 * 10 is fine, 11MB breaks\r\n            sodium.crypto_pwhash_ALG_DEFAULT\r\n          );\r\n          console.log(key);\r\n        }\r\n      };\r\n    </script>\r\n    <script language=\"javascript\" src=\"sodium.js\" async></script>\r\n  </head>\r\n  <body>\r\n    Hello, world\r\n  </body>\r\n</html>\r\n```\r\n\r\nFailure:\r\n\r\n```\r\n[Error] Unhandled Promise Rejection: TypeError: E is not a function. (In 'E(A)', 'E' is undefined)\r\n\tiA (sodium.js:1:474327)\r\n\tY (sodium.js:1:308668)\r\n\tenlargeMemory (sodium.js:1:471688)\r\n\twasm-stub\r\n\t<?>.wasm-function[44]\r\n\t<?>.wasm-function[37]\r\n\t<?>.wasm-function[247]\r\n\t<?>.wasm-function[246]\r\n\t<?>.wasm-function[329]\r\n\t<?>.wasm-function[330]\r\n\t<?>.wasm-function[322]\r\n\t<?>.wasm-function[59]\r\n\t<?>.wasm-function[318]\r\n\t<?>.wasm-function[308]\r\n\t<?>.wasm-function[213]\r\n\twasm-stub\r\n\t_crypto_pwhash\r\n\tFA (sodium.js:1:534619)\r\n\tonload (index.htm:10)\r\n\t(anonymous function) (sodium.js:1:557384)\r\n\tpromiseReactionJob\r\n```\r\n\r\nTested with latest Chrome and Safari on MacOS 10.14"},"comment":{"url":"https://api.github.com/repos/jedisct1/libsodium.js/issues/comments/426033752","html_url":"https://github.com/jedisct1/libsodium.js/issues/175#issuecomment-426033752","issue_url":"https://api.github.com/repos/jedisct1/libsodium.js/issues/175","id":426033752,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNjAzMzc1Mg==","user":{"login":"fredemmott","id":360927,"node_id":"MDQ6VXNlcjM2MDkyNw==","avatar_url":"https://avatars2.githubusercontent.com/u/360927?v=4","gravatar_id":"","url":"https://api.github.com/users/fredemmott","html_url":"https://github.com/fredemmott","followers_url":"https://api.github.com/users/fredemmott/followers","following_url":"https://api.github.com/users/fredemmott/following{/other_user}","gists_url":"https://api.github.com/users/fredemmott/gists{/gist_id}","starred_url":"https://api.github.com/users/fredemmott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fredemmott/subscriptions","organizations_url":"https://api.github.com/users/fredemmott/orgs","repos_url":"https://api.github.com/users/fredemmott/repos","events_url":"https://api.github.com/users/fredemmott/events{/privacy}","received_events_url":"https://api.github.com/users/fredemmott/received_events","type":"User","site_admin":false},"created_at":"2018-10-01T19:31:27Z","updated_at":"2018-10-01T19:31:27Z","author_association":"NONE","body":"That's with https://github.com/jedisct1/libsodium.js/blob/9d4455cfd8c68a53238475b9f900f42582d7c925/dist/browsers/sodium.js (current master, but permalink)\r\n\r\nfredemmott-pro:sodiumtest fredemmott$ openssl sha256 sodium.js\r\nSHA256(sodium.js)= e5ab837bad21af11bc7d874e3fd08f4e3732d7fe93c264a96fa9791b8bac2751"}}
{"actor":{"display_login":"fredemmott"}}