Skip to main content

Encall Function

The encall function in SwartzDB allows users to encrypt a pre-existing JSON file and convert it into a secure .sdb database file.


How encall Works

🔹 Reads the content of a JSON file from the database directory.
🔹 Stores the encrypted data into a .sdb file, preventing unauthorized access.


Why Use encall?

Protects sensitive data – Encrypts information before storage.
Converts JSON files into SwartzDB format – Ensures compatibility with the database.


Example Usage

Before Encryption (JSON File)

[
{"id": 1, "name": "Alice", "age": 25},
{"id": 2, "name": "Bob", "age": 30}
]

Calling encall

$sdb->encall("users", "users_encrypted");

users.json should be the unencrypted json file stored in the same drectory where the database should be in.

After Encryption (users_encrypted.sdb)

The file is now encrypted and cannot be read without decryption.


Conclusion

The encall function is perfect for securing JSON data and converting it into the SwartzDB .sdb format. This ensures data confidentiality while keeping it accessible through authorized database operations.