Profile Manager

Learn to set up Profile Managers and enable a Signless Experience.


A Profile Manager is an EVM address authorized to sign social operations on behalf of a Profile.

This separation allows the Profile owner to maintain control while delegating the execution of social operations. The owner always has the authority to appoint or revoke Profile Managers.

Note: A Profile Manager can sign most operations, except for those that necessitate the Profile owner's signature for security reasons.

List All

One of the initial steps you can take is to surface all Profile Managers associated with your Profile.

You can accomplish this using the useProfileManagers hook.

Available in @lens-protocol/react-web and @lens-protocol/react-native

Combine this hook with the ProfileSession returned by useSession to retrieve the Profile Managers for the currently authenticated Profile, if any. For details on using the useSession hook, see the session management section.

ProfileManagers.tsx
import { ProfileSession, useProfileManagers } from '@lens-protocol/client';
export function ProfileManagers({ session }: { session: ProfileSession }) {  const { data, error, loading } = useProfileManagers({    for: session.profile.id,  });
  if (loading) {    return <p>Loading...</p>;  }
  if (error) {    return <p>Error: {error.message}</p>;  }
  return (    <ul>      {data.map(({ address }) => (        <li key={address}>{address}</li>      ))}    </ul>  );}

The hook yields a PaginatedReadResult<ProfileManager[]>. For more information on pagination, refer to this guide.

Add and Remove

In this section, we will guide you on how to add and remove Profile Managers from your Profile.

Updating Profile Managers is considered a sensitive operation and thus always requires the Profile owner's signature.

You must be authenticated with the Profile you intend to update Profile Managers for. See Profile Login for more information.

The useUpdateProfileManagers hook allows you to add and remove Profile Managers for the currently authenticated Profile.

Note: To ensure a smooth user experience, the hook will not return until the Profile Manager update operation is fully completed (mined and indexed by the Lens API).

Below is an example of a simple UI for adding and removing Profile Managers.

UpdateProfileManagers.tsx
import { useUpdateProfileManagers } from '@lens-protocol/react-web';
export function UpdateProfileManagers() {  const { execute, loading, error } = useUpdateProfileManagers();
  const add = async () => {    const result = await execute({      add: ['0x01'],    });
    if (result.isFailure()) {      console.log(result.error.message);    }  };
  const remove = async () => {    const result = await execute({      remove: ['0x01'],    });
    if (result.isFailure()) {      console.log(result.error.message);    }  };
  return (    <div>      { error && <p>Error: {error.message}</p> }      <button onClick={add} disabled={loading}>Add</button>      <button onClick={remove} disabled={loading}>Remove</button>    </div>  );}

Signless Experience

In this section, we will guide you on how to offer a Signless Experience to your users.

Lens's Signless Experience utilizes the Profile Manager mechanism to sign operations on behalf of the user. We refer to this as the Lens Profile Manager.

You must be authenticated with the Profile you intend to enable the Signless Experience for. See Authentication for more information.

Verify Eligibility

To determine if the authenticated Profile is eligible for the Signless Experience, examine the signless property on the Profile. This field is only populated for the currently logged-in Profile; for all other profiles, it's always set to null.

Generally, when using the Lens React SDK, you don't need to manually manage this. The SDK automatically provides a Signless Experience when possible.

However, you can still check the eligibility of the authenticated Profile directly from the Profile object returned by the useSession hook.

Example
import { SessionType, useSession } from '@lens-protocol/react-web';
export function SignlessExperienceChecker() {  const { data } = useSession();
  if (data?.type ==== SessionType.WithProfile && data.profile.signless) {    return <p>Profile is eligible for the Signless Experience</p>  }
  return <p>Profile is NOT eligible for the Signless Experience</p>}

Enable and Disable

As the Signless Experience is based on the Profile Manager mechanism, its setup process is similar to the one previously described. We will focus on the differences here.

You can toggle the Signless Experience using the useUpdateProfileManagers hook, as demonstrated in the example below.

import { useUpdateProfileManagers } from '@lens-protocol/react-web';
const { execute, loading, error } = useUpdateProfileManagers();
// ...
const result = await execute({  approveSignless: true,});

When listing the Profile Managers, you can differentiate the Lens Profile Manager from the others by checking the isLensManager flag.

ProfileManagers.tsx
import { ProfileSession, useProfileManagers } from '@lens-protocol/client';
export function ProfileManagers({ session }: { session: ProfileSession }) {  const { data, error, loading } = useProfileManagers({    for: session.profile.id,  });
  if (loading) {    return <p>Loading...</p>;  }
  if (error) {    return <p>Error: {error.message}</p>;  }
  return (    <ul>      {data.map(({ address, isLensManager }) => (        <li key={address}>          {address} - {isLensManager ? 'Lens Profile Manager' : 'Other'}        </li>      ))}    </ul>  );}