Index Network Documentation
  • Overview
    • What is Index Network
    • Architecture
  • Getting Started
    • Quick start
    • Data Models
  • API Reference
    • Identity
      • Authentication
      • Profile
    • Semantic Index
      • Index
        • Creator Roles
        • Privacy
      • IndexItem
      • Embedding
    • Discovery Protocol
      • Completions
      • Private Conversations
      • Semantic Listener
      • Vector Search
  • Resources
    • Libraries
      • Node.js SDK
      • Python SDK
      • React SDK
      • Langchain
  • More
    • Contact
Powered by GitBook
On this page
Edit on GitHub
  1. API Reference
  2. Semantic Index
  3. Index

Creator Roles

Last updated 1 year ago

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 , 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 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
});
Lit Protocol
Item
  • Managing Collaborative Permissions
  • Adding Creators
  • Removing Creators
  • POSTAdd a new Creator to an Index
  • POSTRemove a Creator from an Index

Add a new Creator to an Index

post
Body
signerPublicKeystringRequired
signerFunctionstringRequired
Responses
200
Creator successfully added
400
Invalid input
401
Authentication error
500
Server error
post
POST /api/addCreator HTTP/1.1
Host: index.network
Content-Type: application/json
Accept: */*
Content-Length: 141

{
  "accessCondition": {
    "chain": "ethereum",
    "returnValueTest": {
      "comparator": "=",
      "value": "text"
    }
  },
  "signerPublicKey": "text",
  "signerFunction": "text"
}

No content

Remove a Creator from an Index

post
Body
signerPublicKeystringRequired
signerFunctionstringRequired
Responses
200
Creator successfully removed
400
Invalid input
401
Authentication error
500
Server error
post
POST /api/removeCreator HTTP/1.1
Host: index.network
Content-Type: application/json
Accept: */*
Content-Length: 141

{
  "accessCondition": {
    "chain": "ethereum",
    "returnValueTest": {
      "comparator": "=",
      "value": "text"
    }
  },
  "signerPublicKey": "text",
  "signerFunction": "text"
}

No content