Adding user's secrets to app.secrets?

Continuing the discussion from End-to-end encryption with Anvil:

What I’m trying to do:
Allow users to store text (strings) so that app administrators only see encrypted text. The users can share the data among themselves (in the same role).

What I’ve tried and what’s not working:
A group of user’s are in a role. The role owns the data. The role has an encryption key. The data is encrypted/decrypted with this key using:

anvil.secrets.encrypt_with_key(key_name, value)

Problem is, there is no

anvil.secrets.set_secret(role['key_name'])

so there doesn’t seem to be a way each role can have an encryption key.

Or… is there?

Consider using a database table to store keys, one row per role.

1 Like