Overview
Salud’s access sharing system allows you to securely share medical records with healthcare providers using temporary, cryptographically-secured access tokens. All access grants are time-limited and can be revoked at any time.Access sharing uses Aleo blockchain’s public mappings to verify permissions while keeping your medical data encrypted and private.
How Access Sharing Works
Access sharing in Salud uses a three-step verification process:Access Grant Structure
Each access grant contains the following information:Time-Limited
Access automatically expires after the specified duration
Revocable
You can manually revoke access before expiration
Doctor-Specific
Optionally restrict access to a specific doctor’s address
Blockchain-Verified
Access verification happens on-chain for security
Granting Access
From the UI
- Navigate to My Records
- Click on the record you want to share
- Click the Share button
- Configure access settings:
- Doctor’s Address (optional): Enter the doctor’s Aleo address
- Duration: Choose from 1 hour to 7 days
- Click Generate QR Code
- Share the QR code with your healthcare provider
Leaving the doctor’s address empty allows any doctor with the QR code to access the record. For maximum security, always enter a specific doctor’s address.
Access Duration Options
Salud offers 6 predefined duration options:| Duration | Blocks | Use Case |
|---|---|---|
| 1 Hour | 240 | Quick consultation |
| 4 Hours | 960 | Extended appointment |
| 12 Hours | 2,880 | Half day access |
| 24 Hours | 5,760 | Full day access |
| 3 Days | 17,280 | Multi-day care |
| 7 Days | 40,320 | Extended care (maximum) |
Using the Contract
Access is granted using thegrant_access transition:
medical_record: The record to sharedoctor: Healthcare provider’s Aleo addressduration_blocks: Access duration (240-40320 blocks)nonce: Client-provided randomness for token generation
- The original medical record (ownership maintained)
- Access token (to be shared with doctor)
- Future for async execution
- Minimum: 240 blocks (~1 hour)
- Maximum: 40,320 blocks (~7 days)
- Default: 5,760 blocks (~24 hours)
Implementation Example
Here’s how access grants are created in the frontend:Managing Access Grants
Viewing Active Shares
Navigate to the Shared Access page to see all your access grants:Active Shares
Currently valid access grants
Expired
Access grants that have passed their expiration time
Revoked
Access grants you manually revoked
Access Grant Card Details
Each access grant shows:- Record Title: Which medical record is shared
- Record Type: Category badge (e.g., Lab Results, Prescription)
- Doctor Address: Truncated Aleo address of the healthcare provider
- Expiration Time: When access will automatically expire
- Grant Time: When you created the access grant
- Status Badge: Active, Expired, or Revoked
Revoking Access
You can manually revoke access before it expires:- Go to Shared Access page
- Find the active grant you want to revoke
- Click Revoke Access
- Confirm the revocation
Revocation Contract Call
Doctor Access Verification
When a doctor scans your QR code, the system verifies:Token Exists
Token Exists
The access token must exist in the blockchain’s access_grants mapping
Doctor Match
Doctor Match
If a specific doctor was specified, addresses must match
Record Match
Record Match
The record ID in the token must match the requested record
Not Revoked
Not Revoked
The access grant must not be manually revoked
Not Expired
Not Expired
Current block height must be before the expiration block
Verification Contract Call
Privacy and Security
What’s Protected
Medical Data Stays Encrypted
The access token only verifies permission - medical data remains encrypted
Cryptographic Tokens
Access tokens use client-provided nonces for unpredictability
Blockchain Verification
All access checks happen on-chain and cannot be forged
Automatic Expiration
Enforced at block height level - cannot be bypassed
Best Practices
Use Doctor-Specific Grants
Always enter the doctor’s Aleo address when possible for maximum security
Encrypted View Keys
Access grants include encrypted view keys for data decryption:- View Key Generation: A view key is generated or retrieved for the record
- Public Key Derivation: The doctor’s public key is derived from their address
- Encryption: View key is encrypted with the doctor’s public key
- QR Code Inclusion: Encrypted view key is included in the QR code data
- Doctor Decryption: Doctor uses their private key to decrypt the view key
- Record Access: Decrypted view key allows access to the medical record
Troubleshooting
Doctor can't access record
Doctor can't access record
- Verify the access hasn’t expired
- Check if you revoked the access
- Ensure doctor is using the correct Aleo address
- Confirm the QR code data wasn’t corrupted
Can't create access grant
Can't create access grant
- Make sure you own the medical record
- Check you have Aleo credits for the transaction
- Verify doctor’s address format (must start with ‘aleo1’)
Access shows as expired immediately
Access shows as expired immediately
- Check your system clock is synchronized
- Verify the duration was set correctly
- Ensure the blockchain block height is current
Next Steps
QR Code Sharing
Learn about QR code generation and scanning
Privacy & Security
Understand the security model