import { AccessGroup, AccessTokenClaims, Field, Role, UserPermission } from './model/data'; import { CreateFieldRequest, UpdateRoleRequest, CreateRoleRequest, CreateAccessGroupRequest, UpdateFieldRequest, UpdateAccessGroupRequest } from './model/requests'; declare type AliasBundle = { primary_user_id: string; aliases: string[]; }; export declare type SigningFn = (claims: AccessTokenClaims) => Promise; export declare class PrivyConfig { /** * Links a new user id alias to an pre-existing user id. * @param userId A user id for which data already exists. * @param alias A new user id to be linked to the pre-existing user id. * No data should previously exist for this new user id. * @returns AliasBundle containing the id's of all users that are linked together. */ link(userId: string, alias: string): Promise; /** * Delinks a particular user id alias from any other user id's it's linked to. If * it is not linked to any other user id, an error is thrown. * @param userId A user id that the alias is initially linked to. * @param alias The user id to be delinked from the bundle. * @returns AliasBundle if everything succeeds. Otherwise an error is thrown. */ delink(userId: string, alias: string): Promise; /** * Reads and decrypts the aliases a given user id is linked to. * @param userId Any user id within the alias bundle. * @returns AliasBundle if everything succeeds. Otherwise an error is thrown. */ fetchAliases(userId: string): Promise; /** * Generate a Privy access token for the given data requester. * @param requesterId Data requester user ID. */ createAccessToken(requesterId: string): Promise; /** * List all fields. */ listFields(): Promise; /** * Create a field. * @param attributes * @param attributes.name The field name of which the field id is derived. * @param attributes.description Description of the field's purpose. * @param attributes.default_access_group The default access group for this field. */ createField(attributes: CreateFieldRequest): Promise; /** * Retrieve a field. * @param fieldId Unique alphanumeric identifier for the field. */ getField(fieldId: string): Promise; /** * Update a field. * @param attributes * @param attributes.name The field name of which the field id is derived. * @param attributes.description Description of the field's purpose. * @param attributes.default_access_group The default access group for this field. */ updateField(fieldId: string, attributes: UpdateFieldRequest): Promise; /** * Delete a field. * @param fieldId Unique alphanumeric identifier for the field. */ deleteField(fieldId: string): Promise; /** * List all roles. * Retrieves all the defined roles for this account. */ listRoles(): Promise; /** * Create a role. * @param attributes * @param attributes.name Unique name for the role. * @param attributes.description Arbitrary string attached to the role. */ createRole(attributes: CreateRoleRequest): Promise; /** * Retrieve a role. * @param roleId Unique alphanumeric identifier for the role. */ getRole(roleId: string): Promise; /** * Update a role. * Default roles cannot be updated. * @param roleId Unique alphanumeric identifier for the role. * @param attributes * @param attributes.name Unique name for the role. * @param attributes.description Arbitrary string attached to the role. */ updateRole(roleId: string, attributes: UpdateRoleRequest): Promise; /** * Delete a role. * Default roles cannot be deleted. * @param roleId Unique alphanumeric identifier for the role. */ deleteRole(roleId: string): Promise; /** * List all access groups. * Retrieves all the defined access groups for this account. */ listAccessGroups(): Promise; /** * Create an access group. * @param attributes * @param attributes.name The access group name of which the access group id is derived. * @param attributes.description Description of the access group's purpose. * @param attributes.read_roles List of role ids that have READ permission in this group. * @param attributes.write_roles List of role ids that have WRITE permission in this group. */ createAccessGroup(attributes: CreateAccessGroupRequest): Promise; /** * Retrieve an access group. * @param accessGroupId The id of the access group. */ getAccessGroup(accessGroupId: string): Promise; /** * Update an access group. * Default access groups cannot be updated. * @param accessGroupId The id of the access group. * @param attributes * @param attributes.name The access group name of which the access group id is derived. * @param attributes.description Description of the access group's purpose. * @param attributes.read_roles List of role ids that have READ permission in this group. * @param attributes.write_roles List of role ids that have WRITE permission in this group. */ updateAccessGroup(accessGroupId: string, attributes: UpdateAccessGroupRequest): Promise; /** * Delete an access group * Default access groups cannot be deleted. * @param accessGroupId The id of the access group. */ deleteAccessGroup(accessGroupId: string): Promise; /** * Get the permissions required for accessing a given user's data. * @param userId The id of the user to fetch permissions for. * @param fieldIds Optional list of field ids to scope the request to. */ getUserPermissions(userId: string, fieldIds?: string[]): Promise; /** * Update the permissions required for accessing a given user's data. * @param userId The id of the user to fetch permissions for. * @param permissions A list of permissions objects. */ updateUserPermissions(userId: string, permissions: UserPermission[]): Promise; /** * Get all the roles assigned to the requester. * @param requesterId The id of the requester. */ getRequesterRoles(requesterId: string): Promise; /** * Get all the requesters assigned to the given role id. * @param roleId The id of the role. */ getRoleRequesters(roleId: string): Promise; /** * Assign the given role to a list of requesters. * @param roleId The id of the role. * @param requesterIds A list of requester ids to assign the role. */ addRequestersToRole(roleId: string, requesterIds: string[]): Promise; /** * Remove the requester from the given role. * @param roleId The id of the role. * @param requesterId The requester to remove from the role. */ removeRequesterFromRole(roleId: string, requesterId: string): Promise; } export {};