Blockchain Drive provides two complementary sharing systems. The first is a classic RBAC model where you grant individual usersDocumentation 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.
viewer or editor access to specific files or an entire drive. The second is a smart-contract-backed bulk sharing mechanism that records share grants on-chain, supports optional password protection, and can be revoked at any time.
All sharing endpoints require an authenticated session cookie.
RBAC file and drive sharing
These endpoints live alongside the drive and file routes and operate on the application-layer permission model.POST /share/:id
Grants another user access to a specific file. The caller must be the file owner.Numeric ID of the file to share.
Username of the recipient.
Access level:
viewer (read-only) or editor (read and write).The file’s encryption key re-encrypted with the recipient’s public key. Required when the file is encrypted and you want the recipient to be able to decrypt it. Retrieve the recipient’s public key first via
GET /share-target.200 on success (no body).
Errors: 400 invalid file ID or role, 404 file or target user not found, 403 contract-enforced access denied.
GET /shared-with-me
Lists all files that other users have shared with the authenticated user via RBAC.GET /files, augmented with share metadata (role, sharer).
POST /drive/share
Shares the authenticated user’s entire default drive with another user. All files within the drive are shared at once. For encrypted drives,keyShares must contain a re-encrypted key for each file.
Username of the recipient.
Access level:
viewer or editor.A map of
fileId → encryptedKey pairs. Each key is the file’s encryption key re-encrypted with the recipient’s public key. Required for encrypted files; omit for unencrypted drives.200 on success.
Errors: 400 missing username or invalid role, 404 recipient not found, 403 contract-enforced denial.
Smart-contract bulk sharing
These endpoints are served under the/api/shares prefix and use an on-chain share registry for auditability and revocation.
POST /api/shares/bulk
Creates a bulk share that grants a single recipient access to multiple files at once. The share is recorded on the Ethereum contract whenUSE_REAL_CONTRACTS=true.
Array of numeric file IDs to include in the share.
Ethereum wallet address of the recipient. The recipient must have a Blockchain Drive account.
Access level:
readonly (default) or readwrite.Optional password that the recipient must supply to access the share. The password is stored as a bcrypt hash — never in plaintext.
Number of days until the share automatically expires. Omit for no expiry.
shareId, transactionHash, and expiresAt.
Errors: 404 recipient not found, 400 invalid file IDs or parameters.
GET /api/shares/received
Lists all bulk shares received by the authenticated user.Unique share identifier.
ID of the user who created the share.
File IDs included in the share.
readonly or readwrite.Whether a password is required to access this share.
ISO 8601 expiry timestamp, or
null for no expiry.ISO 8601 timestamp if the share has been revoked, otherwise
null.Number of times the share has been accessed.
On-chain transaction hash of the share grant.
GET /api/shares/received/:shareId
Verifies and retrieves a specific received share. If the share is password-protected, the correct password must be supplied.Share ID from the share object.
Required when
passwordProtected is true.{ hasAccess: true, ...shareDetails } on success, or { hasAccess: false, error: "..." } with a 403 when access is denied.
GET /api/shares/sent
Lists all bulk shares created by the authenticated user.GET /api/shares/received.
POST /api/shares/revoke
Revokes a bulk share, immediately preventing the recipient from accessing it.ID of the share to revoke. The caller must be the share owner.
404 if the share does not exist or has already been revoked.
GET /api/shares/stats
Returns aggregate statistics about the authenticated user’s sharing activity.GET /api/shares/:shareId/check-access
Checks whether the authenticated user currently has access to a share without logging an access event.Share ID to check.
Required when the share is password-protected.
{ hasAccess: boolean, reason?: string }.
GET /api/shares/search
Searches shares visible to the authenticated user (both sent and received) by a keyword query.Search term matched against share metadata. Defaults to an empty string (returns all shares).