# Groups

Seald supports groups. You can create a group which contains multiple users, so that you can easily encrypt data for all members of the group.

You can also easily add or remove members of the group. Of course, when you add members to a group, they immediately have access to data previously encrypted for the group; conversely, when you remove members from a group, they lose access to all the data encrypted for the group.

# Creating a group

In order to create a group, you must use the method SealdSDK.createGroup.

TIP

To accelerate the creation of groups, you can pre-generate the private keys by calling the seald.preGenerateIdentityKeys() function in advance.

# Encrypting for a group

When a user encrypts data for a group, all members of the group can decrypt it.

TIP

If you are encrypting for a group of which the user is a member, you can use the optional argument encryptForSelf: false so that you do not encrypt directly for their own identities. The user will still be able to decrypt the data thanks to their group membership. This can allow you to improve the performance of the encryption.

# Adding /removing group members

Group administrators can add and remove members to the group.

When a member is added to the group, they can then decrypt the data previously encrypted for that group.

Conversely, when a member is removed from the group, they can no longer decrypt the data encrypted for that group.

In this case, and for more security, it is advisable to renew the group keys.

A group administrator can also add and remove administrators to the group.