{"id":13740947,"url":"https://github.com/haze/zig-libressl","last_synced_at":"2025-05-14T03:32:33.985Z","repository":{"id":44879580,"uuid":"404790342","full_name":"haze/zig-libressl","owner":"haze","description":"LibreSSL stream wrappers for Zig","archived":false,"fork":false,"pushed_at":"2023-03-30T05:01:39.000Z","size":121,"stargazers_count":29,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-15T10:43:49.894Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haze.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-09-09T16:16:25.000Z","updated_at":"2024-10-25T07:04:07.000Z","dependencies_parsed_at":"2024-01-25T03:02:13.799Z","dependency_job_id":"29d9ab7b-130a-45b8-9eec-10a73b918268","html_url":"https://github.com/haze/zig-libressl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haze%2Fzig-libressl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haze%2Fzig-libressl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haze%2Fzig-libressl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haze%2Fzig-libressl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haze","download_url":"https://codeload.github.com/haze/zig-libressl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225275731,"owners_count":17448387,"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":[],"created_at":"2024-08-03T04:00:53.872Z","updated_at":"2024-11-19T00:47:36.525Z","avatar_url":"https://github.com/haze.png","language":"Zig","funding_links":[],"categories":["Applications"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eZig-LibreSSL\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"LICENSE\"\u003e\u003cimg src=\"https://badgen.net/github/license/haze/zig-libressl\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n   Zig-LibreSSL is an idiomatic zig wrapper around LibreSSL's libTLS for `std.net.Stream`\n\u003c/p\u003e\n\n## Project status\n\nZig-LibreSSL is currently a work in progress. I've hand verified that simple\nmessage transactions work, along with use in a homebrewed HTTP client, but there\nis still much more to test! Please feel free to open issues for features you\nwant, or bugs that you encounter.\n\n## Quickstart Client\n\n```zig\nconst std = @import(\"std\");\n\npub fn main() !void {\n    var gpa = std.heap.GeneralPurposeAllocator(.{}){};\n    defer _ = gpa.deinit();\n\n    var tls_configuration = (TlsConfigurationParams{}).build() catch unreachable;\n\n    var connection = try std.net.tcpConnectToHost(\u0026gpa.allocator, \"haz.ee\", 443);\n    var ssl_connection = try SslStream.wrapClientStream(tls_configuration, connection, \"haz.ee\");\n    defer ssl_connection.deinit();\n\n    var writer = ssl_connection.writer();\n    var reader = ssl_connection.reader();\n\n    try writer.writeAll(\"GET / HTTP/1.1\\n\\n\");\n\n    while (try reader.readUntilDelimiterOrEofAlloc(\u0026gpa.allocator, '\\n', std.math.maxInt(usize))) |line| {\n        std.debug.print(\"{s}\\n\", .{line});\n        defer gpa.allocator.free(line);\n        if (std.mem.eql(u8, line, \"\u003c/html\u003e\")) break;\n    }\n}\n```\n\n## Quickstart Server\n\n```zig\nconst std = @import(\"std\");\n\npub fn main() !void {\n    var gpa = std.heap.GeneralPurposeAllocator(.{}){};\n    defer _ = gpa.deinit();\n\n    var tls_configuration = try (TlsConfigurationParams{\n        .ca = .{ .memory = @embedFile(\"test_files/root.pem\") },\n        .cert = .{ .memory = @embedFile(\"test_files/server.crt\") },\n        .key = .{ .memory = @embedFile(\"test_files/server.key\") },\n    }).build();\n\n    var stream_server = std.net.StreamServer.init(.{});\n    try stream_server.listen(std.net.Address.parseIp(\"127.0.0.1\", 0) catch unreachable);\n    std.debug.print(\"Listening on :{}\", .{stream_server.listen_address.getPort()});\n\n    var ssl_server = try SslServer.wrap(tls_configuration, stream_server);\n    defer ssl_server.deinit();\n\n    var visitor_count: u64 = 0;\n    while (visitor_count \u003c 100) : (visitor_count += 1) {\n        var ssl_connection = try ssl_server.accept();\n        defer ssl_connection.deinit();\n\n        var writer = ssl_connection.writer();\n        try writer.print(\"You are visitor no. {}!\\n\", .{visitor_count});\n    }\n}\n```\n\n## TODOS\n\nPlease see the todos in `src/main.zig`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaze%2Fzig-libressl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaze%2Fzig-libressl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaze%2Fzig-libressl/lists"}