✨
Features Documentation
  • Streaming
  • Sharing
  • Live Streaming
  • Download flow
    • Download Implementation
    • Fixed Merkle Tree
    • Validation (Merkle) Tree
    • Necessity of signature method
    • Resuming downloads
  • Stripe Payment
    • About Stripe
    • Reusable Stripe Flow
  • Upload flow
  • šŸ†Challenge Flow
  • šŸŽ­Reward & Penalty
    • šŸ“ˆRewards
    • šŸ“‰Penalty
  • šŸš‘Allocation Repair/Rollback
    • Repair
    • Rollback
Powered by GitBook
On this page
  • Public File Sharing
  • AuthTicket format
  • File Sharing
  • Folder Sharing
  • Private Sharing
  • 0box Share APIs Documentation
  • POST v2/share/shareinfo
  • DELETE v2/share/shareinfo
  • GET

Sharing

The following documentation provides information on how to use the file-sharing feature within our SDK. To share files, an authTicket is required. You can obtain the authTicket by using the sdk.share

PreviousStreamingNextLive Streaming

Last updated 1 year ago

Public File Sharing

To share files publicly, you must provide the allocation ID and remote path to retrieve the authTicket.

AuthTicket format

The authTicket is encoded in Base64 format. To access the information contained within the authTicket, you can decode it to retrieve the following details:

ā— actual_file_hash: The actual hash of the shared file.

ā— file_name: The name of the shared file.

ā— reference_type: Indicates whether it is a file or a folder.

ā— expiration: The duration for which the authTicket remains valid.

ā— timestamp: The timestamp when the authTicket was created.

ā— encrypted: Indicates whether the authTicket is encrypted. If set to true, the sharing is private.

ā— signature: The signature of the authTicket.

File Sharing

To download a shared file; you can utilize the sdk.download function or consult the for detailed instructions. The authTicket and lookup_hash must be provided as parameters when downloading the file.

Folder Sharing

To list the files within a shared folder, the following information is required:

ā— Auth Ticket

ā— Lookup Hash

ā— Wallet ID of the owner

ā— Allocation ID of the owner

The lookup_hash can be obtained from the authTicket using the file_path_hash attribute. Similarly, the wallet_id and allocation_id can be extracted from the authTicket.

To list the files within the shared folder, you must retrieve the allocation (blobbers) details using the sdk.getAllocation function or the allocation details API. After that, you can select a random blobber from the allocation details. Each blobber has a URL, which needs to be combined with the endpoint "/v1/file/list/" to obtain the list of files.

Example code:

const blobber = getRandomArrayElement(allocationInfo.blobbers);
const params = `?path_hash=${lookup_hash}`;
const url = blobber.url + '/v1/file/list/' + allocationId + params; 

Note: When making the request, make sure to include the wallet ID of the owner in the headers using `X-App-Client-ID`.

A complete URL for listing the files may look like this:

https://demo3.zus.network/blobber01/v1/file/list/7aa73fdd041d1982a183bab4f23e75f53a09df
8bdb689375ace9b45b130607cd?path_hash=22f2d545e2cc579c793b8e153c26226b6b5373bf23f5a661ba
e06a9897b2352c

Private Sharing

To share files privately, you need to provide the allocation ID, remotePath, wallet ID of the receiver, and the encryption public key of the receiver to retrieve the authTicket.

0box Share APIs Documentation

Public Share

Parameter
Description

auth_ticket

authTicket

from_info

wallet id of the user who makes this request

receiver_client_id

wallet id of the user who makes this request

Private Share

Parameter
Description

auth_ticket

authTicket

receiver_client_id

receiver's wallet id

We can delete the share info by authTicket or lookup_hash.

GET

Check these endpoints on Swagger.

To get the list of users with access to the current file/folder.

This is the data I’m showing here.

To get the list of private and public shared files.

To get the list of only publicly shared files.

The endpoint is not ready to get the list of only private shared files.

You can use the to obtain additional details, such as the wallet ID and encryption key of the receiver.

POST

We must pass the following data in the body as formdata; check for more reference.

We must pass the following data in the body as formdata; check for more reference.

DELETE

(also add lookup_hash query param)

(Shared to me)

private

CLI documentation
corresponding API
v2/share/shareinfo
the swagger
the swagger
v2/share/shareinfo
/v2/share/shareinfo/received
/v2/share/shareinfo/shared
/v2/share/shareinfo/shared/public
/v2/share/shareinfo/shared/