How to update the secretKey async
See original GitHub issueOn app load, I want to do the following:
- Check expo-secure-store async for a previous stored encryption secret key
- If it doesn’t exist, create a random uuid and save it in expo-secure-store async and use it as the secret key for encryption
- If it does exist, use it as the secret key for encryption
However, because this process is async, I don’t see how to export the store and persistor.
const persistConfig = {
key: 'root',
version: 2,
storage: FSStorage(),
transforms: [
encryptTransform({
secretKey: 'my-super-secret-key',
onError: function (error) {
// Handle the error.
},
}),
],
};
export const store = configureStore({
reducer: rootReducer,
enhancers: [autoRehydrate()]
});
export const persistor = persistStore(store, persistConfig);
Does anyone have an example of how to update the secretKey after the app has loaded, without hard-coding it?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9
Top Results From Across the Web
How to pass headers in axios as secret-key - Stack Overflow
REACT_APP_LOCAL_URL; const fetchPhotosFlocal = async () => { const response = await axios.get(localUrl, { headers: { "secret-key": secretKey ...
Read more >Azure Key Vault Secrets client library for Python
Set a secret; Retrieve a secret; Update secret metadata; Delete a secret; List secrets; Asynchronously create a secret; Asynchronously list ...
Read more >tweetnacl-async - npm
nacl.sign.keyPair.fromSecretKey(secretKey). Returns a signing key pair with public key corresponding to the given 64-byte secret key. The secret ...
Read more >Crypto | Node.js v19.3.0 Documentation
const { createHmac } = await import('node:crypto'); const secret = 'abcdefg'; const hash = createHmac('sha256', secret) .update('I love cupcakes') ...
Read more >Securing Node.js RESTful APIs with JSON Web Tokens(JWT ...
Securing Node.js RESTful APIs with JSON Web Tokens(JWT) using Async-await. Published Jul 18, 2018Last updated Jun 28, 2021. Securing Node.js RESTful APIs ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ou2s can you provide the example for this asap.
@rueiwoqp @gczene @andreaslydemann I’ve managed to do this. I think I will provide a more detailed example soon but for the moment, here are the guidelines: