@nillion/secretvaults
    Preparing search index...

    Class SecretVaultUserClient

    Client for user operations on SecretVaults.

    This client handles user-specific operations for managing owned documents, including creation, retrieval, updates, and deletion. It supports automatic handling of concealed data when configured with blindfold.

    const client = await SecretVaultUserClient.from({
    keypair: myKeypair,
    baseUrls: [
    'https://nildb-stg-n1.nillion.network',
    'https://nildb-stg-n2.nillion.network',
    'https://nildb-stg-n3.nillion.network',
    ],
    blindfold: { // optional blindfold config }
    })

    Hierarchy

    • SecretVaultBaseClient<NilDbUserClient>
      • SecretVaultUserClient
    Index

    Constructors

    • Parameters

      • options: SecretVaultBaseOptions<NilDbUserClient>

      Returns SecretVaultUserClient

    Accessors

    • get did(): Did

      The DID of the keypair associated with this client.

      Returns Did

    • get id(): string

      Returns string

    • get keypair(): Keypair

      The keypair used by this client for signing.

      Returns Keypair

    • get nodes(): TClient[]

      The array of underlying node clients for the cluster.

      Returns TClient[]

    Methods

    • Creates one or more data documents owned by the user.

      Parameters

      • delegation: string
      • body: {
            acl: {
                execute: boolean;
                grantee: string & $brand<"Did">;
                read: boolean;
                write: boolean;
            };
            collection: string;
            data: Record<string, unknown>[];
            owner: string & $brand<"Did">;
        }

      Returns Promise<
          ByNodeName<
              {
                  data: {
                      created: string[];
                      errors: { document: unknown; error: string }[];
                  };
              },
          >,
      >

    • Deletes a user-owned document from all nodes.

      Parameters

      • params: { collection: string; document: string }

      Returns Promise<ByNodeName<string>>

    • Grants a given Did access to a given user-owned document.

      Parameters

      • body: {
            acl: {
                execute: boolean;
                grantee: string & $brand<"Did">;
                read: boolean;
                write: boolean;
            };
            collection: string;
            document: string;
        }

      Returns Promise<ByNodeName<string>>

    • Lists references to all data documents owned by the user.

      Returns Promise<
          {
              data: {
                  builder: string & $brand<"Did">;
                  collection: string;
                  document: string;
              }[];
          },
      >

    • Retrieves information about each node in the cluster.

      Returns Promise<
          ByNodeName<
              {
                  build: { commit: string; time: string; version: string };
                  maintenance: { active: boolean; started_at: string };
                  public_key: string;
                  started: string;
                  url: string;
              },
          >,
      >

    • Reads a single data document, automatically revealing concealed values if a key is configured.

      Parameters

      • params: { collection: string; document: string }

      Returns Promise<
          {
              data: {
                  _acl: {
                      execute: boolean;
                      grantee: string & $brand<"Did">;
                      read: boolean;
                      write: boolean;
                  }[];
                  _created: string;
                  _id: string;
                  _owner: string & $brand<"Did">;
                  _updated: string;
                  [key: string]: unknown;
              };
          },
      >

    • Reads the user's profile information from the cluster.

      Returns Promise<
          {
              data: {
                  _created: string;
                  _id: string & $brand<"Did">;
                  _updated: string;
                  data: { collection: string; id: string }[];
                  logs: {
                      acl?: {
                          execute: boolean;
                          grantee: string & $brand<"Did">;
                          read: boolean;
                          write: boolean;
                      };
                      collection: string;
                      op: string;
                      [key: string]: unknown;
                  }[];
              };
          },
      >

    • Revokes access for a given Did to the specified user-owned document.

      Parameters

      • body: { collection: string; document: string; grantee: string & $brand<"Did"> }

      Returns Promise<ByNodeName<string>>

    • Creates and initializes a new SecretVaultUserClient instance.

      Parameters

      • options: { baseUrls: string[]; blindfold?: BlindfoldFactoryConfig; keypair: Keypair }

        Configuration options for the client

        • baseUrls: string[]

          URL Array of nilDB node endpoints

        • Optionalblindfold?: BlindfoldFactoryConfig

          Optional blindfold configuration for concealed data

        • keypair: Keypair

          The user's keypair for authentication

      Returns Promise<SecretVaultUserClient>

      A promise that resolves to a configured SecretVaultUserClient

      const client = await SecretVaultUserClient.from({
      keypair: myKeypair,
      baseUrls: [
      'https://nildb-stg-n1.nillion.network',
      'https://nildb-stg-n2.nillion.network',
      'https://nildb-stg-n3.nillion.network',
      ],
      });