await SecureStoragePlugin.set({ key: 'key', value: 'value' })
const { value: keys } = await SecureStoragePlugin.keys()
// [ 'cap_sec_key' ]
await SecureStoragePlugin.get({ key: keys[0] })
// 'Item with given key does not exist'
It fails, because .keys() function returns keys with cap_sec_ prefix and .get() function adds the prefix again, so it looks for cap_sec_cap_sec_key instead of cap_sec_key.
This affects web platform only. The above code works fine on Android and iOS platforms.
Consider below code:
It fails, because
.keys()
function returns keys withcap_sec_
prefix and.get()
function adds the prefix again, so it looks forcap_sec_cap_sec_key
instead ofcap_sec_key
.This affects web platform only. The above code works fine on Android and iOS platforms.