use custom key to encript mmkv storage

This commit is contained in:
GleidsonDaniel 2023-08-09 10:09:03 -03:00
parent c9f4ca1197
commit f1d5df41e1
2 changed files with 2 additions and 1 deletions

View File

@ -5,7 +5,7 @@ export class MMKVLoader {
setProcessingMode = jest.fn().mockImplementation(() => ({ setProcessingMode = jest.fn().mockImplementation(() => ({
withEncryption: jest.fn().mockImplementation(() => ({ withEncryption: jest.fn().mockImplementation(() => ({
initialize: jest.fn().mockImplementation(() => {}) encryptWithCustomKey: jest.fn().mockImplementation(() => ({ initialize: jest.fn().mockImplementation(() => {}) }))
})) }))
})); }));
} }

View File

@ -4,6 +4,7 @@ const MMKV = new MMKVLoader()
// MODES.MULTI_PROCESS = ACCESSIBLE BY APP GROUP (iOS) // MODES.MULTI_PROCESS = ACCESSIBLE BY APP GROUP (iOS)
.setProcessingMode(ProcessingModes.MULTI_PROCESS) .setProcessingMode(ProcessingModes.MULTI_PROCESS)
.withEncryption() .withEncryption()
.encryptWithCustomKey('rocket-chat') // JUST A TEST KEY
.initialize(); .initialize();
export const useUserPreferences = create(MMKV); export const useUserPreferences = create(MMKV);