How to Create Custom string as an encryption key in the Realm


(Dhiraj Bhujbal) #1

How to Create Custom string as an encryption key in the Realm.


(Stephen Steneker) #2

Hi @Dhiraj_Bhujbal,

Can you provide more details on what you have tried? You need to provide a 512-bit (64-byte) encryption key: https://realm.io/docs/javascript/latest/#encryption.

Typically this would be a created using a random sequence of bytes rather than a string. The same encryption key must be supplied every time you obtain a Realm instance.

If you want to use a string/password as a seed for the encryption key, you could use a 512-bit hash of the password as the encryption key. This GitHub issue has some relevant suggestions: https://github.com/realm/realm-js/issues/444.

Regards,
Stennie