{"id":21339188,"url":"https://github.com/r4gus/kdbx","last_synced_at":"2025-03-16T02:23:04.531Z","repository":{"id":260939783,"uuid":"882480731","full_name":"r4gus/kdbx","owner":"r4gus","description":"This Zig module allows you to integrate KDBX support into your application.","archived":false,"fork":false,"pushed_at":"2025-01-20T15:51:28.000Z","size":1824,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T17:44:36.762Z","etag":null,"topics":["kdbx","kdbx-database","kdbx-files","keepass","zig","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r4gus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-02T22:14:43.000Z","updated_at":"2025-01-20T15:51:29.000Z","dependencies_parsed_at":"2024-11-03T19:18:41.293Z","dependency_job_id":"7ca696e9-f13d-4ea9-8d0d-3fba2a299040","html_url":"https://github.com/r4gus/kdbx","commit_stats":null,"previous_names":["r4gus/kdbx"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r4gus%2Fkdbx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r4gus%2Fkdbx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r4gus%2Fkdbx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r4gus%2Fkdbx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r4gus","download_url":"https://codeload.github.com/r4gus/kdbx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814979,"owners_count":20352077,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kdbx","kdbx-database","kdbx-files","keepass","zig","ziglang"],"created_at":"2024-11-22T00:42:53.041Z","updated_at":"2025-03-16T02:23:04.209Z","avatar_url":"https://github.com/r4gus.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KDBX - Keepass Database XML\n\nThis Zig module allows you to integrate KDBX support into your application.\n\n\u003e Currently only KDBX4 is supported.\n\n## Getting Started\n\nFirst add this project as a dependency to your `build.zig.zon` file:\n\n```zig\n.{\n    // ...\n\n    .dependencies = .{\n        // ...\n\n        .kdbx = .{\n            .url = \"https://github.com/r4gus/kdbx/archive/master.tar.gz\",\n            .hash = \u003chash\u003e,\n        }\n    },\n\n    // ...\n}\n```\n\nThen, within your `build.zig` add the following code:\n\n```zig\nconst kdbx_dep = b.dependency(\"kdbx\", .{\n    .target = target,\n    .optimize = optimize,\n});\nconst kdbx_module = zbor_dep.module(\"kdbx\");\n\n// ...\n\nexe.root_module.addImport(\"kdbx\", kdbx_module);\n```\n\nThen within your project just use `@import(\"kdbx\")`.\n\n## Reading and writing databases\n\n\u003e When saving, the inner XML data structure is generated from\n\u003e the Zig objects that represent the database, i.e., unsupported\n\u003e fields are lost when reading and then writing a existing database.\n\u003e\n\u003e If in doubt, backup your database!\n\u003e\n\u003e Feel free to open pull requests for missing features.\n\n```zig\nconst std = @import(\"std\");\nconst kdbx = @import(\"kdbx\");\n\nvar gpa = std.heap.GeneralPurposeAllocator(.{}){};\nconst allocator = gpa.allocator();\n\npub fn main() !void {\n    var database = try kdbx.Database.new(.{\n        .allocator = allocator,\n    });\n    defer database.deinit();\n\n    var entry1 = kdbx.Entry.new(allocator);\n    try entry1.set(\"Title\", \"Demo Entry\", false);\n    try entry1.set(\"UserName\", \"max\", false);\n    try entry1.set(\"Password\", \"supersecret\", true);\n    errdefer entry1.deinit();\n\n    try database.body.root.addEntry(entry1);\n\n    const db_key = kdbx.DatabaseKey{\n        .password = try allocator.dupe(u8, \"1234\"),\n        .allocator = allocator,\n    };\n    defer db_key.deinit();\n\n    const raw = try database.save(\n        db_key,\n        allocator,\n    );\n    defer allocator.free(raw);\n\n    var file = try std.fs.cwd().createFile(\"db.kdbx\", .{});\n    defer file.close();\n\n    try file.writeAll(raw);\n}\n```\n\n\u003e Also see `main.zig` for an example.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr4gus%2Fkdbx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr4gus%2Fkdbx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr4gus%2Fkdbx/lists"}