Creator Roles

Creator roles are handled by defining access control conditions that determine who can perform specific actions or access certain data. This is achieved using the Lit Protocol, which provides a decentralized approach to managing permissions. Index Network's API endpoints facilitate the creation and management of these conditions, thus enabling collaboration with trust and security at its core.

Managing Collaborative Permissions

In Index Network, each Index is managed by DID and we allow it that some permissions are granted to another DID user or a user holding an NFT specified by the original owner. We call it Creators, and they have the following permissions on the Index:

  • Adding and removing Item to the Index

  • Modifying Index attributes such as title

  • Adding another Creator

Adding Creators

To invite a new collaborator, you can specify conditions that must be met for them to become a Creator. This can be through a direct wallet address or an NFT they hold, ensuring only verified parties have access.

Adding a creator by using a wallet address,

const walletCondition = {
  chain: "ethereum", // Set your chain
  returnValueTest: {
    comparator: "=",
    value: "0xab451....eb9234", // Set the wallet address you want to allow
  },
};

await indexClient.addCreator({
  accessCondition: walletCondition,
  signerPublicKey: "0xc84e234...dc9", // Obtain from the Index
  signerFunction: "b42c45a...83ba" // Obtain from the Index
});

Adding a creator by using an NFT address

const nftCondition = {
  contractAddress: "0xa345...b4210e", // Contract address of the NFT
  chain: "ethereum", // Set your chain
  method: "ownerOf",
  parameters: ["0xe532...33ab"], // Set your tokenId
  returnValueTest: {
    comparator: "=",
    value: "0xab51....eb9234", // Set the wallet address you want to allow
  },
};

await indexClient.addCreator({
  accessCondition: condition,
  signerPublicKey: "0xc84e234...dc9", // Obtain from the Index
  signerFunction: "b42c45a...83ba" // Obtain from the Index
});

Removing Creators

To remove a collaborator or Creator from your Index, you would specify the condition that was previously set to identify them, such as their wallet address or the NFT they hold. The process involves revoking the permissions granted to them.

You can use the following code snippet:

const removeWalletCondition = {
  chain: "ethereum", // Set your chain
  returnValueTest: {
    comparator: "=",
    value: "0xab451....eb9234", // Set the wallet address you want to remove
  },
};

await indexClient.removeCreator({
  accessCondition: removeWalletCondition,
  signerPublicKey: "0xc84e234...dc9", // Obtain from the Index
  signerFunction: "b42c45a...83ba" // Obtain from the Index
});

Last updated