Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Re-Crypt an existing Storage instance (storage.encrypt(..)) #314

Merged
merged 7 commits into from
Feb 8, 2022

Conversation

mrousavy
Copy link
Owner

@mrousavy mrousavy commented Feb 7, 2022

const storage = new MMKV({ id: 'my.test.storage' })

storage.encrypt('my-private-key') // <-- encrypt with key 'my-private-key'
storage.set('test', 'works!')

storage.encrypt(undefined) // <-- remove encryption
storage.set('test', 'still works!')

closes: #179

@mrousavy mrousavy merged commit aabc43b into master Feb 8, 2022
@ddikodroid
Copy link
Contributor

so to encrypt, i need to call storage.encrypt('key') or storage.recrypt('key')?

in the README.md it stated like this

// encrypt all data with a private key
storage.recrypt('hunter2')

// remove encryption
storage.recrypt(undefined)

@mrousavy
Copy link
Owner Author

mrousavy commented Feb 9, 2022

recrypt, I renamed it - will release an update soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change encryptionKey on existing instances
2 participants