The Shared File Index module manages the encrypted index of shared files, tracking which files have been shared and their associated encryption metadata.
The Shared Index stores information about shared files in an encrypted file structure (shared_index.json) in the .zephyrus repository. This allows the system to:
- Track which files have been shared
- Store share reference IDs and share passwords
- Map share IDs back to original files
- Revoke access by managing share entries
{
"shares": {
"72cTWg": {
"filename": "report.pdf",
"vault_path": "documents/report.pdf",
"share_password": "encrypted_password",
"created_at": "2026-02-04T15:30:00Z",
"access_count": 0
},
"AbXkLm": {
"filename": "budget.xlsx",
"vault_path": "financial/budget.xlsx",
"share_password": "encrypted_password",
"created_at": "2026-02-03T10:15:00Z",
"access_count": 0
}
}
}| Field | Type | Purpose |
|---|---|---|
filename |
string | Original filename for reference |
vault_path |
string | Full path in vault |
share_password |
string | Encrypted share password |
created_at |
ISO 8601 | Timestamp of share creation |
access_count |
integer | Number of times shared file was accessed |
Load shared index from encrypted storage.
Function Signature:
func LoadSharedIndex(username string, password string) (*SharedIndex, error)Parameters:
username: GitHub usernamepassword: Vault password
Returns:
- Populated
SharedIndexstruct - Error if file not found or decryption fails
Process:
- Fetch encrypted
shared_index.jsonfrom GitHub - Decrypt using vault password
- Parse JSON into SharedIndex struct
- Return index
Save shared index to encrypted storage.
Function Signature:
func (si *SharedIndex) Save(username string, password string, keyPath string) errorParameters:
username: GitHub usernamepassword: Vault passwordkeyPath: Path to SSH private key
Returns:
- Error if save fails
Process:
- Serialize SharedIndex to JSON
- Encrypt using vault password with PBKDF2
- Push to
.zephyrus/shared_index.jsonvia git - Return error or nil
Add a new share entry to the index.
Function Signature:
func (si *SharedIndex) AddShare(shareID string, filename string, vaultPath string, sharePassword string) errorParameters:
shareID: Unique reference ID for sharefilename: Original filenamevaultPath: Full vault pathsharePassword: Password for share decryption
Returns:
- Error if entry already exists
Remove a share entry from the index.
Function Signature:
func (si *SharedIndex) RemoveShare(shareID string) errorParameters:
shareID: Share reference to revoke
Returns:
- Error if share not found
Retrieve a specific share entry.
Function Signature:
func (si *SharedIndex) GetShare(shareID string) (*ShareEntry, error)Returns:
- ShareEntry struct
- Error if not found
Share passwords are encrypted before storage:
- Generate random share password (user-provided or generated)
- Encrypt with vault password using AES-256-GCM
- Store in index as encrypted hex string
- Decrypt when needed for share operations
The entire shared index is encrypted:
- Serialized to JSON
- Encrypted with vault password using PBKDF2 + AES-256-GCM
- Stored as
.zephyrus/shared_index.json - Same encryption as vault index
User calls: share documents/report.pdf
↓
Generate share ID (base62, 6 chars)
↓
Encrypt file with share password
↓
Store share reference in index
↓
Save encrypted index to GitHub
↓
Return share string to user
User calls: shared rm 72cTWg
↓
Load shared index
↓
Find and remove share entry
↓
Save encrypted index to GitHub
↓
Share link becomes invalid
The shared index is stored at:
.zephyrus/shared_index.json (encrypted)
Format:
[16-byte salt][12-byte nonce][encrypted JSON + auth tag]
The Shared Index is used by:
- Share Module: Creates entries when sharing files
- Shared Manage: Removes entries when revoking
- Shared Search: Queries index for shares
- Authentication: Loaded during session setup
# Download shared index manually if needed
./zep download .zephyrus/shared_index.json ./shared_index_backup.jsonIf shared index is corrupted:
- Delete
.zephyrus/shared_index.jsonfrom GitHub - Existing shares remain functional (still encrypted on GitHub)
- New shares will start with empty index
- Can manually recreate shares using
sharecommand
- Shared index overwrites with each change
- No history of share operations
- But: Git commits show what changed
- Single source of truth on GitHub
- Local cache exists in session
- Multiple concurrent edits may conflict
- Use
connect/disconnectfor explicit sync
- Share passwords are encrypted in the index
- Only vault password holder can see them
- Recipients use different share password
If shared index is leaked:
- Individual share passwords are encrypted
- Attacker cannot decrypt without vault password
- Shared files themselves are still encrypted
access_countfield can track usage (not currently incremented)- Could be enhanced for audit logging
- No automatic expiration of shares
- Share Module - Creating shares
- Shared Manage Module - Revoking shares
- Shared Search Module - Finding shares
- Encryption Module - Cryptographic details
- Index Module - Vault index structure