{"id":20905152,"url":"https://github.com/bb-301/c-getpass-in-rust","last_synced_at":"2026-04-27T10:31:07.739Z","repository":{"id":220591354,"uuid":"751502981","full_name":"BB-301/c-getpass-in-rust","owner":"BB-301","description":"A simple wrapper library that allows using the non-standard getpass C function, which is available on some UNIX-like systems such as, for instance, various GNU/Linux distributions and macOS.","archived":false,"fork":false,"pushed_at":"2024-02-02T22:35:39.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-27T21:49:47.864Z","etag":null,"topics":["c","demo","ffi-bindings","learning-exercise","rust"],"latest_commit_sha":null,"homepage":"https://bb-301.github.io/c-getpass-in-rust-docs/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BB-301.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}},"created_at":"2024-02-01T18:30:01.000Z","updated_at":"2024-02-02T16:30:47.000Z","dependencies_parsed_at":"2024-02-02T23:43:49.307Z","dependency_job_id":null,"html_url":"https://github.com/BB-301/c-getpass-in-rust","commit_stats":null,"previous_names":["bb-301/c-getpass-in-rust"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BB-301/c-getpass-in-rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BB-301%2Fc-getpass-in-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BB-301%2Fc-getpass-in-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BB-301%2Fc-getpass-in-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BB-301%2Fc-getpass-in-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BB-301","download_url":"https://codeload.github.com/BB-301/c-getpass-in-rust/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BB-301%2Fc-getpass-in-rust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32333193,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["c","demo","ffi-bindings","learning-exercise","rust"],"created_at":"2024-11-18T13:22:29.349Z","updated_at":"2026-04-27T10:31:07.475Z","avatar_url":"https://github.com/BB-301.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Using C's `getpass` function in Rust\n\nA simple wrapper library that allows using the non-standard `getpass` C function, which is available on some UNIX-like systems such as, for instance, various GNU/Linux distributions and macOS.\n\n## Quick example\n\n```rust\nuse c_getpass::getpass;\n\nfn main() {\n    // Using a prompt\n    let max_len: usize = 5;\n    let prompt = Some(\"Enter a secret value: \");\n    let secret_value = getpass(max_len, prompt).expect(\"a multi-byte character was probably split\");\n    assert!(secret_value.len() \u003c= max_len);\n    println!(\"secret_value[{}] = {}\", secret_value.len(), secret_value);\n\n    // Without a prompt\n    let max_len: usize = 50;\n    let secret_value = getpass(max_len, \u003cOption\u003cString\u003e\u003e::None)\n        .expect(\"a multi-byte character was probably split\");\n    assert!(secret_value.len() \u003c= max_len);\n    println!(\"secret_value[{}] = {}\", secret_value.len(), secret_value);\n}\n```\n\n## Disclaimer and word of caution\n\nI created this library for fun, as an opportunity to experiment with the concept of [FFI bindings](https://doc.rust-lang.org/nomicon/ffi.html) in Rust. Before using this library, you should carefully read `man 3 getpass` on the target system, as well as review the source code in both [./src/lib.rs](https://github.com/BB-301/c-getpass-in-rust/blob/main/src/lib.rs) and [./c/my_lib.c](https://github.com/BB-301/c-getpass-in-rust/blob/main/c/my_lib.c).\n\n## Contact\n\nIf you have any questions, if you find bugs, or if you have suggestions for this project, please feel free to contact me by opening an issue on the [repository](https://github.com/BB-301/c-getpass-in-rust/issues).\n\n## License\n\nThis project is released under the [MIT License](https://github.com/BB-301/c-getpass-in-rust/blob/main/LICENSE).\n\n## Copyright\n\nCopyright (c) 2024 BB-301 (fw3dg3@gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbb-301%2Fc-getpass-in-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbb-301%2Fc-getpass-in-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbb-301%2Fc-getpass-in-rust/lists"}