> ## Documentation Index
> Fetch the complete documentation index at: https://docutrack-docs.icpitalia.io/llms.txt
> Use this file to discover all available pages before exploring further.

# User Canister

> User Canister API

```did theme={null}
service : (UserCanisterInstallArgs) -> {
  delete_file : (nat64) -> (DeleteFileResponse);
  download_file : (nat64, nat64) -> (FileDownloadResponse) query;
  get_alias_info : (text) -> (Result) query;
  get_requests : () -> (vec PublicFileMetadata) query;
  get_shared_files : (principal) -> (vec PublicFileMetadata) query;
  public_key : () -> (blob) query;
  request_file : (text) -> (RequestFileResponse);
  revoke_share : (principal, nat64) -> ();
  set_public_key : (blob) -> ();
  share_file : (principal, nat64, blob) -> (FileSharingResponse);
  share_file_with_users : (vec principal, nat64, vec blob) -> ();
  upload_file : (UploadFileRequest) -> (Result_1);
  upload_file_atomic : (UploadFileAtomicRequest) -> (UploadFileAtomicResponse);
  upload_file_continue : (UploadFileContinueRequest) -> (
      UploadFileContinueResponse,
    );
}
```

### delete\_file

Deletes a file from the user's storage canister.

Arguments:

* `file_id`: The ID of the file to delete.

Returns:

`DeleteFileResponse`: A response object indicating the result of the delete operation.

### download\_file

Downloads a file from the user's storage canister.

Arguments:

* `file_id`: The ID of the file to download.
* `chunk`: The chunk number to download.

Returns:

`FileDownloadResponse`: A response object containing the file data and metadata.

### get\_alias\_info

Returns information about a file alias that is being uploaded.

Arguments:

* `alias`: The alias of the file to retrieve information for.

Returns:

`Result`: A response object containing the result of the alias lookup, including the file ID and metadata if found.

### get\_requests

Returns a list of file requests made by the user.

Returns:

`vec PublicFileMetadata`: A vector of `PublicFileMetadata` objects containing information about the file requests.

### get\_shared\_files

Returns a list of files shared with a specific user.

Arguments:

* `user_id`: The user ID of the user to retrieve shared files for.

Returns:

`vec PublicFileMetadata`: A vector of `PublicFileMetadata` objects containing information about the shared files.

### public\_key

Returns the public key of the user.

Returns:

`blob`: The public key of the user in binary format.

### request\_file

Creates a new file request for the user for uploading a file.

Arguments:

* `path`: The path where the file will be uploaded.

Returns:

`RequestFileResponse`: A response object containing the opreation result. In case of success, it contains the file alias (UUIDv7) that can be used to upload the file.

### revoke\_share

Revokes access to a shared file for a specific user.

Arguments:

* `user_id`: The user ID of the user to revoke access from.
* `file_id`: The ID of the file to revoke access to.

### set\_public\_key

Updates the public key of the user.

Arguments:

* `blob`: The new public key of the user in binary format.

### share\_file (2)

Shares a file with a specific user.

Arguments:

* `user_id`: The user ID of the user to share the file with.
* `file_id`: The ID of the file to share.
* `blob`: file key encrypted with the user's public key.

### share\_file\_with\_users (2)

Shares a file with multiple users.

Arguments:

* `user_ids`: A vector of user IDs to share the file with.
* `file_id`: The ID of the file to share.
* `vec blob`: A vector of file keys encrypted with the users' public keys.

### upload\_file

Uploads the first chunk of a file to the user's storage canister.

Arguments:

* `UploadFileRequest`: An object containing the file data and metadata to upload.

Returns:

A response object indicating the result of the upload operation.

### upload\_file\_atomic

Uploads a file atomically to the user's storage canister. This means that the file is either created and uploaded in one go, or not created at all.

Arguments:

* `UploadFileAtomicRequest`: An object containing the file data and metadata to upload.

Returns:

`UploadFileAtomicResponse`: A response object indicating the result of the atomic upload operation.

### upload\_file\_continue

Upload any chunk after the first one of a file that was started with `upload_file`.

All chunks after the first one must be uploaded with this method.

Arguments:

* `UploadFileContinueRequest`: An object containing the file data and metadata to continue the upload.

Returns:

`UploadFileContinueResponse`: A response object indicating the result of the continued upload operation.
