Updating Zencrypt Databases
Updating Zencrypt Databases:
┌──────────────────────────────────┐
│ START - DB FLOW │
└──────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ 1) Load DB Config & Env. Vars │
│ - Retrieve database credentials, connection strings │
│ from config file or environment variables │
└─────────────────────────────────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ 2) Initialize Database Connection │
│ - Connect to SQL/NoSQL DB (MySQL, PostgreSQL, │
│ MongoDB, etc.) │
│ - Handle exceptions if DB is unreachable │
└────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ 3) Check/Perform User Authentication │
│ - If user not logged in: prompt login/signup │
│ (salt + hash password, verify in DB) │
│ - Generate or validate JWT on successful login │
│ - Retrieve any user roles/permissions │
└─────────────────────────────────────────────────────────┘
│
│
┌─────┴───────────────────┐
│ User Authenticated? │
│ (JWT Valid?) │
└─────────────────────────┘
│
│
┌───────────┴────────────┐
│ NO │
│ (Auth fails or token │
│ invalid) │
▼ │
┌─────────────────────────┐ │
│ Return Error / │ │
│ Prompt Re-Login │ │
└─────────────────────────┘ │
│ YES
▼
┌────────────────────────────────────────┐
│ 4) Present DB-Related Actions │
│ A) Store/Retrieve Keys in DB │
│ B) Store/Retrieve Encrypted Data │
│ C) Log Usage (encryption events) │
│ D) Insert Access / Audit Records │
│ E) Key Expiry & Rotation Checks │
└────────────────────────────────────────┘
│
▼
┌────────────────────────────────────────────────┐
│ 5) Execute Chosen DB Operation │
│ - "Insert new key," "Get user’s key," │
│ "Write encryption log entry," etc. │
│ - Enforce user permissions/roles │
│ - Handle success/errors gracefully │
└────────────────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────┐
│ 6) Return Response / Results to Zencrypt Main App │
│ - Encryption key retrieved? Next step is encrypt. │
│ - Log entry stored? Display success message. │
│ - Access denied? Inform user with error/log details. │
└──────────────────────────────────────────────────────────┘
│
│
▼
┌─────────────────────────────────────────────────────┐
│ 7) Continue Zencrypt Workflow or Exit │
│ - If more actions needed, loop back (Step 4) │
│ - Otherwise finalize/close DB connection if done │
└─────────────────────────────────────────────────────┘
│
│
▼
┌───────────────────────────────────┐
│ END - DB FLOW │
└───────────────────────────────────┘Last updated