{"action":"created","issue":{"url":"https://api.github.com/repos/disusered/cordova-safe/issues/8","labels_url":"https://api.github.com/repos/disusered/cordova-safe/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/disusered/cordova-safe/issues/8/comments","events_url":"https://api.github.com/repos/disusered/cordova-safe/issues/8/events","html_url":"https://github.com/disusered/cordova-safe/issues/8","id":99911770,"number":8,"title":"No callback called with encrypt","user":{"login":"chi-mai2b","id":4801792,"avatar_url":"https://avatars.githubusercontent.com/u/4801792?v=3","gravatar_id":"","url":"https://api.github.com/users/chi-mai2b","html_url":"https://github.com/chi-mai2b","followers_url":"https://api.github.com/users/chi-mai2b/followers","following_url":"https://api.github.com/users/chi-mai2b/following{/other_user}","gists_url":"https://api.github.com/users/chi-mai2b/gists{/gist_id}","starred_url":"https://api.github.com/users/chi-mai2b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chi-mai2b/subscriptions","organizations_url":"https://api.github.com/users/chi-mai2b/orgs","repos_url":"https://api.github.com/users/chi-mai2b/repos","events_url":"https://api.github.com/users/chi-mai2b/events{/privacy}","received_events_url":"https://api.github.com/users/chi-mai2b/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-08-09T16:36:36Z","updated_at":"2015-08-12T23:05:42Z","closed_at":"2015-08-12T22:35:28Z","body":"Neither of the callbacks provided to `safe.encrypt` are getting called.\r\n\r\n**Info:**\r\n\r\n\tOS: Windows 7\r\n\tDevice:\r\n\t\tOnePlus One\r\n\t\tAndroid version: 5.0.2\r\n\r\n\t$ cordova --version\r\n\t\t5.1.1\r\n\t$ cordova plugins list\r\n\t\tcordova-plugin-file 2.1.0 \"File\"\r\n\t\tcordova-plugin-whitelist 1.0.0 \"Whitelist\"\r\n\t\tcordova-safe 1.1.1 \"Safe\"\r\n\r\nCode to reproduce the issue:\r\n\r\n\tvar\r\n\t    onDeviceReady = function () {\r\n            // create a file in the persistent storage\r\n\t        window.requestFileSystem(window.PERSISTENT, 5 * 1024 * 1024, onInitFs, onError);\r\n\t    },\r\n\t    onError = function (e) {\r\n\t        console.error('Error:', e, e.code);\r\n\t    },\r\n\t    onInitFs = function (fs) {\r\n\t        console.log('Opened file system: ' + fs.name);\r\n\r\n\t        fs.root.getFile('userData.json', {create: true, exclusive: false}, function (fileEntry) {\r\n\t            fileEntry.createWriter(function (fileWriter) {\r\n\t                fileWriter.onwriteend = onFileWriteComplete;\r\n\t                fileWriter.onerror = onError;\r\n\r\n\t                // Write a file containing some test data\r\n\t                fileWriter.write(new Blob(\r\n\t                        [JSON.stringify({some: 'data'})],\r\n\t                        {type: 'application/json'})\r\n\t                );\r\n\t            }, onError);\r\n\t        }, onError);\r\n\t    },\r\n\t    onFileWriteComplete = function (file) {\r\n\t        // here the file should be created and available on the device\r\n\t        var safe = cordova.plugins.disusered.safe,\r\n\t            key = 'someKey',\r\n\t            onEncryptSuccess = function (encryptedFile) {\r\n\t                console.log('Encrypted file: ' + encryptedFile);\r\n\t            };\r\n\t        // file.target.localURL value is \"cdvfile://localhost/persistent/userData.json\"\r\n\t        safe.encrypt(file.target.localURL, key, onEncryptSuccess, onError);\r\n\t    };\r\n\r\n\tdocument.addEventListener('deviceready', onDeviceReady, false);\r\n\r\nIn the code above `onEncryptSuccess` or `onError` should be called.\r\nThe function `onFileWriteComplete` is called and the file exists on the device with the rights: `-rw-rw----`.\r\n"},"comment":{"url":"https://api.github.com/repos/disusered/cordova-safe/issues/comments/130473023","html_url":"https://github.com/disusered/cordova-safe/issues/8#issuecomment-130473023","issue_url":"https://api.github.com/repos/disusered/cordova-safe/issues/8","id":130473023,"user":{"login":"disusered","id":246254,"avatar_url":"https://avatars.githubusercontent.com/u/246254?v=3","gravatar_id":"","url":"https://api.github.com/users/disusered","html_url":"https://github.com/disusered","followers_url":"https://api.github.com/users/disusered/followers","following_url":"https://api.github.com/users/disusered/following{/other_user}","gists_url":"https://api.github.com/users/disusered/gists{/gist_id}","starred_url":"https://api.github.com/users/disusered/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/disusered/subscriptions","organizations_url":"https://api.github.com/users/disusered/orgs","repos_url":"https://api.github.com/users/disusered/repos","events_url":"https://api.github.com/users/disusered/events{/privacy}","received_events_url":"https://api.github.com/users/disusered/received_events","type":"User","site_admin":false},"created_at":"2015-08-12T23:05:42Z","updated_at":"2015-08-12T23:05:42Z","body":"Awesome, great to hear!"}}