I'm having an issue with retrieving UserGroups within my app after logging out and then logging in. If I create a UserGroup, I'm able to access that user group while still logged in with my current session. However, upon logging out and logging back in to the same app, when I retrieve my group memberships, decryption errors are thrown, and the name and members do not get decrypted.
Steps to reproduce:
After user is logged in, create a new group:
const group = new UserGroup({ name: 'my new group' }); await group.create()
;
Check to make sure I have group membership:
UserGroup.myGroups().then(console.log);
This shows an array with the group I just created (with attrs.name === 'my new group'
).
Log out
const { userSession } = getConfig(); userSession.signUserOut();
Log back into app, then log my groups again:
UserGroup.myGroups().then(console.log);
Now the same group I just created does show up (the _id
property matches), but the name
and members
properties (under attrs
) are encrypted (They are objects with cipherTask
, ephemeralPK
, iv
, and mac
properties.) I see error logs from their retrieval:
Decryption error for key: 'members': num.words is null
Decryption error for key: 'name': num.words is null
One other strange thing: at this point, if I create a group and retrieve it using UserGroup.myGroups
, I will only see the group I just created, and it will be properly decrypted. I will not see the group that I created during my last session. However, if I log out and log back in again, I'll see both of the groups that I have created, and both will be encrypted (with attendant Decryption error
messages).
Thanks for your help, this is a really cool library! Please let me know if I'm doing anything incorrectly.