我可以在Realm Studio中成功打开我的Realm DB,而无需输入加密密钥。我已经在代码中设置了加密密钥。
import * as Keychain from 'react-native-keychain';
const Realm = require('realm');
let encryptionKey;
let secret;
Keychain.getGenericPassword().then(secret => {
if(secret != false) {
encryptionKey = secret.password;
secret = new Uint8Array(encryptionKey.match(/[\da-f]{2}/gi).map(function (h) {
return parseInt(h, 16)
}));
console.log(secret);
}
});
export default new Realm({path: 'db.realm', schema: [Auth, Wiretransfer], encryptionKey: secret});