đ¤ Share Encrypted Files
Once you've uploaded an encrypted file to Walrus, you can share access with other SUI addresses by adding them to the file's allowlist.
- UI
- Code
Sharing an Encrypted Fileâ
Follow these steps from the Lighthouse Files Dapp:
Step 1: Locate Your Encrypted Fileâ
From your files dashboard, find the encrypted file you want to share. Encrypted files are marked with a lock icon.

Click on the file to open its details view.
Step 2: Open the Share Panelâ
In the file details view, click the Share button. This opens the share panel where you can manage who has access to your encrypted file.

Step 3: Add a Wallet Addressâ
Enter the Sui wallet address of the person you want to share the file with. This is the address that will be granted permission to decrypt the file.

The address must be a valid Sui wallet address. Lighthouse will validate the format before proceeding.
Step 4: Sign the Transactionâ
After entering the wallet address, your Sui wallet will prompt you to sign a transaction. This transaction:
- Calls the
add_userfunction on the file'sFileAllowlistobject - Adds the specified wallet address to the allowlist
- Updates the on-chain access control for the encrypted file

Step 5: Confirmationâ
Once the transaction is confirmed on-chain, the recipient's wallet address is added to the allowlist. They can now:
- View the encrypted file in their own dashboard (if they have the CID)
- Prove ownership and decrypt the file using SEAL
- Access the file contents on their device
The shared wallet will appear in your file's access list, confirming the share was successful.

You can repeat this process to share the file with multiple wallet addresses. Each address is added independently to the allowlist.
Sharing an Encrypted File (Code)â
Sharing an encrypted file adds a wallet address to the FileAllowlist object, granting them permission to decrypt the file.
The share flow requires:
- The
FileAllowlistobject ID for the encrypted file - The
Capobject ID owned by the file owner (proves authority over the allowlist) - The recipient's Sui wallet address
- The original uploader's keypair (must own the
Cap)
Share Functionâ
import { Transaction } from "@mysten/sui/transactions";
const LATEST_PACKAGE_ID =
"0x89815d9feb1e8e526bed4b3c7ad35056a6abf692f293103f435d909180cecb7d";
export async function shareFile(
keypair: Keypair,
fileAllowlistId: string,
capId: string,
recipientAddress: string,
) {
const tx = new Transaction();
tx.moveCall({
target: `${LATEST_PACKAGE_ID}::allowlist::add_user`,
arguments: [
tx.object(fileAllowlistId),
tx.object(capId),
tx.pure.address(recipientAddress),
],
});
const result = await suiClient.signAndExecuteTransaction({
signer: keypair,
transaction: tx,
});
await suiClient.waitForTransaction({
digest: result.digest,
});
return result.digest;
}
Where:
keypairis the keypair of the file owner (who holds theCap)fileAllowlistIdis the object ID of theFileAllowlistcreated during encryptioncapIdis the object ID of theCapreturned when the allowlist was created â required to authorizeadd_userrecipientAddressis the Sui wallet address to grant access to
The recipient needs:
- The CID of the encrypted file on Walrus
- The
FileAllowlistobject ID - The same SEAL configuration (package IDs, key server object IDs)