Blockchain Drive offers two distinct sharing systems that can be used independently or together. RBAC sharing (via the collaboration service) is designed for ongoing, role-based access to files or drives. Bulk smart-contract sharing is designed for one-time, potentially password-protected, time-limited shares of multiple files at once.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ankit-bista/Final-Project/llms.txt
Use this file to discover all available pages before exploring further.
File sharing (RBAC)
Individual files can be shared with any registered user by username. The owner selects a role — viewer or editor — that controls what the recipient can do.| Role | Permissions |
|---|---|
| viewer | View and download the file |
| editor | View, download, and edit the file; create expiring links |
Enter the recipient's username
Type the recipient’s username. The app looks up the user and, for encrypted files, fetches their encryption public key from
/share-target.Approve MetaMask (encrypted files only)
If the file is encrypted, your MetaMask wallet is prompted to decrypt the file’s raw key. The app then re-encrypts it for the recipient’s public key using
encryptForPublicKey. This re-encrypted key is stored with the share record so the recipient can decrypt the file with their own wallet.If the recipient has never connected their MetaMask wallet, they will not have a registered encryption public key. You can still share unencrypted files with them, but encrypted files cannot be re-keyed for their account until they log in with MetaMask at least once.
Viewing shared files
Recipients browse files shared with them atGET /shared-with-me. These files appear in the Shared with me section of the sidebar.
Drive sharing
Drive sharing applies the same RBAC model to every file in your personal drive at once. This is useful when you want to give a collaborator access to your entire drive in a single step.Open the Share dialog
From the drive view, click Share (or use the
ShareDialog). Ensure no individual file is selected — the dialog targets the whole drive.Enter the recipient's username and role
The app resolves the recipient and fetches their public key from
/share-target.Key preparation
The app iterates every encrypted file in your drive. For each file, it:
- Checks if the raw key is already cached in memory (
getCachedFileKeyByCid). - If not cached, prompts MetaMask to decrypt the file’s
ownerEncryptedKey(decryptWithMetaMask). A progress bar keeps you informed. - Re-encrypts the raw key for the recipient’s public key (
encryptForPublicKey) and adds it to thekeySharesmap.
Bulk smart-contract sharing
The bulk sharing API lets you share multiple files simultaneously viaPOST /api/shares/bulk. Shares are recorded in the database (and optionally on-chain) with optional password protection and expiry.
| Field | Type | Description |
|---|---|---|
fileIds | number[] | IDs of files to share. All must belong to you. |
recipientAddress | string | Username or wallet address of the recipient. |
permissionType | "readonly" | "readwrite" | Access level granted. |
sharePassword | string | Optional password. Stored as a bcrypt hash. |
expiresIn | number | Days until the share expires. Omit for no expiry. |
shareId and expiresAt timestamp.
Accessing a received bulk share
Recipients list all shares sent to them atGET /api/shares/received. To access a specific share:
permissionType and fileIds.
Revoking a bulk share
revoked_at timestamp is set on the share document. All subsequent access attempts return a Share has been revoked error. The revocation is permanent — there is no un-revoke operation.
Revocation is recorded immutably in the database. If you also configured the smart contract integration, the share status change is reflected on-chain, providing an auditable record.
Expiring links
For quick, unauthenticated sharing of any file, generate a time-limited link. The link redirects to the file’s IPFS gateway URL when visited. No account is required to follow the link.Generate the link
Call
POST /files/:id/link with an expiresInMinutes value. You must be the file owner or have editor access.Copy and share the URL
The response contains a URL in the form
/l/<token>. Share this URL — anyone with it can access the file until it expires.