SecureStore can't store string longer then 256 characters

Hi,

I’m using SecureStore to store the configuration of my application but unfortunately I’m facing a problem with storing strings longer then 256 characters (shorter then 256 works well). I’m always getting the following message:
Error: Set value encountered an error.
Is there any limitation of strings length in the Expo SecureStore? Maybe there are any configuration parameters which could be adjusted? As far as I know there is no limitation on Android(Shared Preferences) and iOS as well.

Regards,
Maciek

I am facing this same issue… Android and iOS native storage do not have any limitation (maybe just max value of String in general). What is this problem with SecureStore??

Hi, @ide has been making some improvements to this API recently and might be able to provide some clarity here.

In SDK 20 we used RSA with a 2048-bit key on Android to encrypt the value. Since RSA (by default) encrypts just one block, that’s why there was a size limit. In SDK 21 we made a number of improvements to SecureStore including a switch to use AES to encrypt an arbitrarily long byte stream. We’ll be releasing SDK 21 soon; when we announce it, please try it out and tell us if we can do anything to improve SecureStore.

hi! I’m looking at SecureStore to store access tokens from AppAuth, (SDK v37) and it still mentions the 2048 limit, which is just a couple of bytes too small for a proper JWT.

Is this limit still relevant?

And I’m not getting an error, still only a warning when using SecureStore with a payload greater than 2048.

I can do a PR to make it 4096?

Before making any changes, please carefully (1) read through the source code and (2) test across all supported Android versions to make sure it actually can handle larger values reliably. Changing the variable that specifies the limit is trivial and a thorough explanation and test plan would be the valuable contribution.

1 Like