Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 如何安全地保存redux持久转换加密密钥?_React Native_Security_Redux_Redux Persist - Fatal编程技术网

React native 如何安全地保存redux持久转换加密密钥?

React native 如何安全地保存redux持久转换加密密钥?,react-native,security,redux,redux-persist,React Native,Security,Redux,Redux Persist,我正在尝试保存并加密redux存储我的react本机应用程序 我正试图按照文档使用: import { persistReducer } from 'redux-persist' import createEncryptor from 'redux-persist-transform-encrypt' const encryptor = createEncryptor({ secretKey: 'my-super-secret-key' }) const reducer = persis

我正在尝试保存并加密redux存储我的react本机应用程序

我正试图按照文档使用:

import { persistReducer } from 'redux-persist'
import createEncryptor from 'redux-persist-transform-encrypt'

const encryptor = createEncryptor({
  secretKey: 'my-super-secret-key'
})

const reducer = persistReducer(
  {
    transforms: [encryptor]
  },
  baseReducer
)
但重要的是找到一种安全的方法来存储“我的超级秘密密钥”。 我已成功地从用户输入中获取它,并将其保存为。 现在的问题是,从keychain获取密钥的函数是异步的,我需要在商店初始化之前获取密钥

结果是这样的

import { persistReducer } from 'redux-persist'
import createEncryptor from 'redux-persist-transform-encrypt'

const encryptionKey = // get the key here from the keychain before initiating the store

const encryptor = createEncryptor({
  secretKey: encryptionKey
})

const reducer = persistReducer(
  {
    transforms: [encryptor]
  },
  baseReducer
)
有人能帮我解决吗