Code Monkey home page Code Monkey logo

Comments (20)

ggozad avatar ggozad commented on July 26, 2024

Can you give me a few more details? iOS, Android? Versions?

from cordova-plugin-secure-storage.

ggozad avatar ggozad commented on July 26, 2024

Also it's actually cordova.plugins.SecureStorage not SecureStorage. Is this it?

from cordova-plugin-secure-storage.

clarklight avatar clarklight commented on July 26, 2024

Hi Sorry, Android running on 5.0. I tried var ss = new cordova.plugins.SecureStorage(
It called that error saying cordova.plugins.SecureStorage isnt a function, so i tried the
var ss = new SecureStorage(
But it also called the same error.

from cordova-plugin-secure-storage.

ggozad avatar ggozad commented on July 26, 2024

Could you please try with an empty app and describe the steps you follow?
I made a new app, run
cordova plugin add cordova-plugin-secure-storage
and can see the constructor fine.

from cordova-plugin-secure-storage.

clarklight avatar clarklight commented on July 26, 2024

Hiii

I think i might have got it working, but it asked me to set my screen lock?? And i have to have a screen lock on for it to work??

from cordova-plugin-secure-storage.

ggozad avatar ggozad commented on July 26, 2024

Could you please let us know what was the problem?
You do indeed need to have screen lock to access certain parts of the crypto API.

from cordova-plugin-secure-storage.

clarklight avatar clarklight commented on July 26, 2024

Hi thanks, the first problem was my mistake i was pulling from a wrong fork.

But when i fixed that up, the second problem was with the id,because i am using phonegap build. The reference had to be changed. So i just renamed the id to com.secure.plugins.crypho, but because the securestorage.js is referencing the sjcl_ss, so i also had to change the first line of the sjcl_ss to var sjcl_ss = cordova.require('com.secure.plugins.crypho.sjcl_ss'); So it is referencing it correctly.

Then it worked.

So a quick question, if i just want to put some encrypted data into secure storage for Android/IOS, would i also need the screen lock to be on?? the ss.set/ss.get for example?

Sorry i didnt understand before how this work, so basically for android the user sets a screen lock pin to the native device and that pin is used to encrypt with the AES right? thats why the screen lock pin is needed?

from cordova-plugin-secure-storage.

ggozad avatar ggozad commented on July 26, 2024

You shouldn't have to do any of that. Would you please try again by:

cordova create test
cd test
cordova plugin add cordova-plugin-secure-storage
cordova platform add android

Then try using the storage.
To your second question:
Yes, in order to use the RSA storage built in with android, you need to have some sort of locking on the phone. The minimum is a PIN password.

from cordova-plugin-secure-storage.

mysoko avatar mysoko commented on July 26, 2024

I also encountered the same problem:『TypeError: Cannot read property 'SecureStorage' of undefined

Js files are loaded in.

1

code:

return new cordova.plugins.SecureStorage(
                    function () { console.log('Success') },
                    function (error) { console.error('Error ' + error); },
                    name);

from cordova-plugin-secure-storage.

ggozad avatar ggozad commented on July 26, 2024

Perhaps you guys could help debug this? I am not seeing this in a clean installation. Is this android also?
Could you try to debug and figure out what happens?

from cordova-plugin-secure-storage.

clarklight avatar clarklight commented on July 26, 2024

Hey guys

I had that problem before but i have resolved that. @mysoko did you install it thru cordova or Phonegap?
I had that problem when i packaged it and installed through phonegap, the core reason for me was the file directory name. I just renamed the file; as it was calling SecureStorage of undefined, it isn't seeing that file i assumed.

Have a look if that solve your problem.

from cordova-plugin-secure-storage.

ggozad avatar ggozad commented on July 26, 2024

@clarklight can you please elaborate a bit? What file directory?

from cordova-plugin-secure-storage.

ggozad avatar ggozad commented on July 26, 2024

Also @mysoko are you also on phonegap? We've only tested with crodova, perhaps there are some quirks we need to figure out on phonegap.

from cordova-plugin-secure-storage.

mysoko avatar mysoko commented on July 26, 2024

crodova 5.4.0, cordova android 5.0.0

from cordova-plugin-secure-storage.

mysoko avatar mysoko commented on July 26, 2024

Probably locate the problem, load order problem js of, cordova js plugin loader is asynchronous, so not every get cordova.plugins.SecureStorage

2

3

from cordova-plugin-secure-storage.

demetris-manikas avatar demetris-manikas commented on July 26, 2024

@mysoko From the trace looks like you try to instantiate the SecureStorage before having received the deviceready event,

Just tested on Cordova 5.4.1 fresh project (android, browser platforms) the following code and did not experience any exceptions

var app = {
    // Application Constructor
    initialize: function() {
        this.bindEvents();
    },
    // Bind Event Listeners
    //
    // Bind any events that are required on startup. Common events are:
    // 'load', 'deviceready', 'offline', and 'online'.
    bindEvents: function() {
        document.addEventListener('deviceready', this.onDeviceReady, false);
    },
    // deviceready Event Handler
    //
    // The scope of 'this' is the event. In order to call the 'receivedEvent'
    // function, we must explicitly call 'app.receivedEvent(...);'
    onDeviceReady: function() {
        app.receivedEvent('deviceready');
        var ss = new cordova.plugins.SecureStorage(
                    function () { console.log('Success') },
                    function (error) { console.error('Error ' + error); },
                    name);

    },
    // Update DOM on a Received Event
    receivedEvent: function(id) {
        var parentElement = document.getElementById(id);
        var listeningElement = parentElement.querySelector('.listening');
        var receivedElement = parentElement.querySelector('.received');

        listeningElement.setAttribute('style', 'display:none;');
        receivedElement.setAttribute('style', 'display:block;');

        console.log('Received Event: ' + id);
    }
};

app.initialize();

from cordova-plugin-secure-storage.

demetris-manikas avatar demetris-manikas commented on July 26, 2024

@mysoko Also note that at least on Android the plugin is usable only after the success method has been called

from cordova-plugin-secure-storage.

ggozad avatar ggozad commented on July 26, 2024

@mysoko @clarklight can you confirm what @demetris-manikas suggests solves your problem?

from cordova-plugin-secure-storage.

mysoko avatar mysoko commented on July 26, 2024

@demetris-manikas @ggozad

Loading problem, put onDeviceReady's ok.
Because the angular and ui-router route I use, will first perform homeCtrl so it did not get any information.

We made the following changes:

angular.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {
        //$urlRouterProvider.otherwise("/");

to:

 onDeviceReady: function() {
        location.hash = '/';
    }

First contact cordova encountered many problems, thank you for help.

from cordova-plugin-secure-storage.

ggozad avatar ggozad commented on July 26, 2024

Closing this, @clarklight if it still persists, let me know and I will open it. Added an FAQ section on the README with explicit instructions.

from cordova-plugin-secure-storage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.