Files
sonr/docs/reference/queries/query-dwn-encryption-status.mdx
T

91 lines
2.1 KiB
Plaintext

---
title: Query Encryption Status
description: Monitor the health and state of the consensus encryption system
seo:
title: "DWN Encryption System Status"
---
:::info
The encryption system uses validator consensus to generate keys that no single party controls.
:::
## System Components
### Key Management
- **currentKeyVersion**: Active encryption key version
- **lastRotation**: Timestamp of last rotation
- **nextRotation**: Scheduled rotation time
### Validator Participation
- **validatorSet**: Active validator addresses
- **singleNodeMode**: Development mode flag
- **minValidatorsForKeyGen**: Required threshold
### System Metrics
- **totalEncryptedRecords**: Global encrypted record count
## Health Monitoring
:::tip
Set up alerts for upcoming key rotations to ensure smooth operations.
:::
### Health Checks
```javascript
// Check rotation schedule
const rotationDue = nextRotation < Date.now();
// Verify validator participation
const hasQuorum = validatorSet.length >= minValidatorsForKeyGen;
// Monitor growth
const recordGrowthRate = totalEncryptedRecords / daysSinceLaunch;
```
## Key Rotation Schedule
### Automatic Rotation
- Triggered by `keyRotationDays` parameter
- Requires validator consensus
- Zero-downtime process
### Manual Rotation
- Governance proposals
- Security incidents
- Validator changes
:::warning
Key rotation requires sufficient validator participation. Monitor validator set health.
:::
## Development vs Production
### Production Mode
- Full validator consensus
- Distributed key generation
- No single point of failure
### Single-Node Mode
- Local key generation
- Simplified consensus
- For development only
## Monitoring Dashboard
:::note
Create monitoring dashboards using these metrics for operational visibility.
:::
### Key Metrics
```bash
# Query status
STATUS=$(snrd query dwn encryption-status -o json)
# Extract metrics
echo "Key Version: $(echo $STATUS | jq .currentKeyVersion)"
echo "Validators: $(echo $STATUS | jq '.validatorSet | length')"
echo "Records: $(echo $STATUS | jq .totalEncryptedRecords)"
echo "Next Rotation: $(echo $STATUS | jq .nextRotation)"
```