How to Create Custom string as an encryption key in the Realm.
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.