{"id":23532607,"url":"https://github.com/conduition/tokio-noise","last_synced_at":"2025-04-22T22:41:11.643Z","repository":{"id":232656318,"uuid":"784835765","full_name":"conduition/tokio-noise","owner":"conduition","description":"A Noise protocol encryption layer on top of tokio streams.","archived":false,"fork":false,"pushed_at":"2024-09-17T16:07:53.000Z","size":49,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-18T00:11:51.482Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/conduition.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-04-10T16:45:23.000Z","updated_at":"2025-01-05T10:47:14.000Z","dependencies_parsed_at":"2024-06-04T16:43:09.822Z","dependency_job_id":"44e9a266-6b53-4cd8-bb4b-5aed56a6c4e2","html_url":"https://github.com/conduition/tokio-noise","commit_stats":null,"previous_names":["conduition/tokio-noise"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduition%2Ftokio-noise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduition%2Ftokio-noise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduition%2Ftokio-noise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduition%2Ftokio-noise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/conduition","download_url":"https://codeload.github.com/conduition/tokio-noise/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250337257,"owners_count":21414092,"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-12-25T23:11:52.834Z","updated_at":"2025-04-22T22:41:11.622Z","avatar_url":"https://github.com/conduition.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tokio-noise\n\nAn authenticated encryption layer on top of [tokio](https://tokio.rs) streams, driven by the [Noise Protocol Framework](https://noiseprotocol.org/).\n\nThis library is [sponsored by dlcBTC](https://www.dlcbtc.com).\n\n## Usage\n\n```rust\nuse tokio::net::{TcpListener, TcpStream};\nuse tokio_noise::{NoiseError, NoiseTcpStream};\n\nconst PSK: [u8; 32] = [0xFF; 32];\n\nasync fn run_noise_server(tcp_stream: TcpStream) -\u003e Result\u003c(), NoiseError\u003e {\n    let mut noise_stream = NoiseTcpStream::handshake_responder_psk0(tcp_stream, \u0026PSK).await?;\n    let mut buf = [0u8; 1024];\n    let n = noise_stream.recv(\u0026mut buf).await?;\n    assert_eq!(\u0026buf[..n], b\"hello world\");\n    Ok(())\n}\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), NoiseError\u003e {\n    let listener = TcpListener::bind(\"127.0.0.1:0\").await?;\n    let addr = listener.local_addr()?;\n\n    let srv = tokio::task::spawn(async move {\n        let (tcp_stream, _) = listener.accept().await?;\n        run_noise_server(tcp_stream).await\n    });\n\n    // Client\n    let tcp_stream = TcpStream::connect(\u0026addr).await?;\n    let mut noise_stream = NoiseTcpStream::handshake_initiator_psk0(tcp_stream, \u0026PSK).await?;\n    noise_stream.send(b\"hello world\").await?;\n\n    // Wait for server to finish\n    srv.await.unwrap()?;\n\n    Ok(())\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconduition%2Ftokio-noise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconduition%2Ftokio-noise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconduition%2Ftokio-noise/lists"}