Class TransactionContext

Querying

ls: {
    (path, listOptions): Promise<DirectoryItemWithKind[]>;
    (path, listOptions): Promise<DirectoryItem[]>;
    (path): Promise<DirectoryItem[]>;
    (path, listOptions?): Promise<DirectoryItem[] | DirectoryItemWithKind[]>;
} = ...

Type declaration

  • Type Parameters

    Parameters

    • arg: [Partition, string, ...string[]] | {
          contentCID: CID<unknown, number, number, Version>;
      } | {
          capsuleCID: CID<unknown, number, number, Version>;
      } | {
          capsuleKey: Uint8Array;
      }
    • dataType: D
    • Optional options: {
          length?: number;
          offset?: number;
      }
      • Optional length?: number
      • Optional offset?: number

    Returns Promise<DataForType<D, V>>

Mutating

cp: ((fromParam, toParam) => Promise<void>) = ...

Type declaration

    • (fromParam, toParam): Promise<void>
    • Parameters

      Returns Promise<void>

mkdir: ((path) => Promise<void>) = ...

Type declaration

    • (path): Promise<void>
    • Parameters

      Returns Promise<void>

mv: ((fromParam, toParam) => Promise<void>) = ...

Type declaration

    • (fromParam, toParam): Promise<void>
    • Parameters

      Returns Promise<void>

rm: ((path) => Promise<void>) = ...

Type declaration

    • (path): Promise<void>
    • Parameters

      Returns Promise<void>

Methods

Properties

#blockstore: Blockstore<{}, {}, {}, {}, {}, {}, {}, {}>

Type declaration

    Type declaration

      Type declaration

        Type declaration

          Type declaration

            Type declaration

              Type declaration

                Type declaration

                  #modifications: Set<{
                      path: [Partition, ...string[]];
                      type: MutationType;
                  }>

                  Type declaration

                  #onCommit: CommitVerifier
                  #privateNodes: MountedPrivateNodes
                  #rng: Rng
                  #rootTree: RootTree

                  Sharing

                  • Check if an exchange key was already registered.

                    Parameters

                    Returns Promise<boolean>

                  • Load a shared item.

                    NOTE: A share can only be received if the exchange key was registered and the receiver is in possession of the associated private key.

                    Parameters

                    • sharerDataRoot: CID<unknown, number, number, Version>

                      The data root CID from the sharer

                    • exchangeKeyPair: {
                          privateKey: CryptoKey;
                          publicKey: Uint8Array | CryptoKey;
                      }

                      A RSA-OAEP-256 key pair

                      • privateKey: CryptoKey

                        A RSA-OAEP-256 private key in the form of a CryptoKey

                      • publicKey: Uint8Array | CryptoKey

                        A RSA-OAEP-256 public key in the form of a CryptoKey or its modulus bytes

                    • opts: {
                          shareId?: string;
                          sharerBlockstore?: Blockstore<{}, {}, {}, {}, {}, {}, {}, {}>;
                          sharerRootTreeClass?: typeof RootTree;
                      } = {}

                      Optional overrides

                      • Optional shareId?: string

                        Specify what shareId to use, otherwise this'll load the last share that was made to the given exchange key.

                      • Optional sharerBlockstore?: Blockstore<{}, {}, {}, {}, {}, {}, {}, {}>

                        Specify what blockstore to use to load the sharer's file system.

                      • Optional sharerRootTreeClass?: typeof RootTree

                        Specify what root tree class was used for the sharer's file system.

                    Returns Promise<Share>

                  • Register an exchange key.

                    Parameters

                    • name: string

                      A name for the key (using an existing name overrides the old key)

                    • exchangePublicKey: Uint8Array | CryptoKey

                      A RSA-OAEP-256 public key in the form of a CryptoKey or its modulus bytes

                    Returns Promise<Uint8Array>

                  • Share a private file or directory.

                    NOTE: A share can only be received if the exchange key was registered and the receiver is in possession of the associated private key.

                    Parameters

                    • path: [Path.Private, ...string[]]

                      Path to the private file or directory to share (with 'private' prefix)

                    • receiverDataRoot: CID<unknown, number, number, Version>

                      Data root CID of the receiver

                    • opts: {
                          receiverBlockstore?: Blockstore<{}, {}, {}, {}, {}, {}, {}, {}>;
                          receiverRootTreeClass?: typeof RootTree;
                      } = {}

                      Optional overrides

                      • Optional receiverBlockstore?: Blockstore<{}, {}, {}, {}, {}, {}, {}, {}>

                        Specify what blockstore to use to load the receiver's file system

                      • Optional receiverRootTreeClass?: typeof RootTree

                        Specify what root tree class was used for the receiver's file system

                    Returns Promise<{
                        shareId: string;
                    }>

                  Generated using TypeDoc