martinkasa / capacitor-secure-storage-plugin

Capacitor plugin for storing string values securly on iOS and Android.
MIT License
155 stars 56 forks source link

plugin uses local storage instead of keychain on ios #10

Closed Frotty closed 4 years ago

Frotty commented 4 years ago

I'm running a ionic project on an ios device (emulator or real) but the plugin only saves values into local storage, to be lost on app removal.

Here visible in the emulator using safari debug tools:

The same happens on a real device, nothing is saved to keychain.

You mentioned in another ticket that this might be related to imports - might it be a problem that I'm also using DeviceInfo import?

import { DeviceInfo } from '@capacitor/core';

[...]

import 'capacitor-secure-storage-plugin';
import { Plugins } from '@capacitor/core';
const { SecureStoragePlugin } = Plugins;
martinkasa commented 4 years ago

Import of the secure storage plugin seems OK, but import of DeviceInfo is not, check https://capacitor.ionicframework.com/docs/apis/device/

import 'capacitor-secure-storage-plugin';
import { Plugins } from '@capacitor/core';
const { SecureStoragePlugin, DeviceInfo } = Plugins;

Regarding secure storage plugin, please check if you have something like this

  pod 'CapacitorSecureStoragePlugin', :path => '../../node_modules/capacitor-secure-storage-plugin'

in the file ios/App/Podfile

Frotty commented 4 years ago

Import of the secure storage plugin seems OK, but import of DeviceInfo is not, check > https://capacitor.ionicframework.com/docs/apis/device/

The import is only for the type in this file.

Regarding secure storage plugin, please check if you have something like this in the file ios/App/Podfile

Thanks, I will check tomorrow and get back to you.

Frotty commented 4 years ago

@martinkasa Thanks, it worked with the podfile entry and running pod install. Can you add this info to the readme? I can't see it anywhere here or on https://capacitor.ionicframework.com/docs/basics/using-plugins/

Or is there a way for capacitor to add this config automatically?

martinkasa commented 4 years ago

@Frotty I think it is added automatically when you run

npx cap sync 

maybe you did not run this after you installed the plugin by npm.