{"id":26656210,"url":"https://github.com/greekfetacheese/secure-types","last_synced_at":"2025-09-11T17:45:44.767Z","repository":{"id":283012290,"uuid":"949891778","full_name":"greekfetacheese/secure-types","owner":"greekfetacheese","description":"Secure data types that protect sensitive data in memory via locking, encryption, and zeroization.","archived":false,"fork":false,"pushed_at":"2025-09-06T10:14:21.000Z","size":225,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-06T12:17:53.867Z","etag":null,"topics":["memory-management","memory-security","no-std","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/greekfetacheese.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-17T09:59:21.000Z","updated_at":"2025-09-06T10:14:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"35bacf2b-620f-49ef-9688-6478bcd10a1b","html_url":"https://github.com/greekfetacheese/secure-types","commit_stats":null,"previous_names":["greekfetacheese/secure-types"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/greekfetacheese/secure-types","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greekfetacheese%2Fsecure-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greekfetacheese%2Fsecure-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greekfetacheese%2Fsecure-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greekfetacheese%2Fsecure-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/greekfetacheese","download_url":"https://codeload.github.com/greekfetacheese/secure-types/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greekfetacheese%2Fsecure-types/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274681157,"owners_count":25330234,"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","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"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":["memory-management","memory-security","no-std","rust"],"created_at":"2025-03-25T07:18:52.423Z","updated_at":"2025-09-11T17:45:44.739Z","avatar_url":"https://github.com/greekfetacheese.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Secure Types\n\nThe goal of this crate is to provide a simple way to handle sensitive data in memory (eg. passwords, private keys, etc).\n\nCurrently there are 3 types:\n\n- `SecureString`: For working with strings.\n- `SecureVec`: For working with `Vec\u003cT\u003e`.\n- `SecureArray`: For working with `\u0026[T; LENGTH]`.\n\n## Features\n\n- **Zeroization on Drop**: Memory is wiped when dropped.\n- **Memory Locking**: (std-only) On Linux/Windows the memory is locked to prevent memory swapping or unauthorized access, \nOn Linux it uses `mlock` and on Windows `VirtualLock` \u0026 `VirtualProtect` along with in-memory encryption using `CryptProtectMemory`.\n- **Safe Scoped Access**: Direct access on these types is not possible, data is protected by default and only accessible within safe blocks.\n- **`no_std` Support**: For embedded and Web environments (with zeroization only).\n- **Serde Support**: Optional serialization/deserialization.\n\n## Usage\n\n### SecureString\n\n```rust\nuse secure_types::SecureString;\n\n // Create a SecureString\nlet mut secret = SecureString::from(\"my_super_secret\");\n\n// The memory is locked here\n\n// Safely append more data.\nsecret.push_str(\"_password\");\n\n// The memory is locked here.\n\n// Use a scope to safely access the content as a \u0026str.\nsecret.unlock_str(|exposed_str| {\n     assert_eq!(exposed_str, \"my_super_secret_password\");\n });\n\n // When `secret` is dropped, its data zeroized.\n```\n\n### SecureVec\n\n```rust\nuse secure_types::SecureVec;\n\n// Create a new, empty secure vector.\nlet mut secret_key: SecureVec\u003cu8\u003e = SecureVec::new().unwrap();\n\n// Push some sensitive data into it.\nsecret_key.push(0);\nsecret_key.push(1);\nsecret_key.push(2);\n\n// The memory is locked here.\n\n// Use a scope to safely access the contents as a slice.\nsecret_key.unlock_slice(|unlocked_slice| {\n     assert_eq!(unlocked_slice, \u0026[0, 1, 2]);\n });\n```\n\n### SecureArray\n\n```rust\nuse secure_types::SecureArray;\n\nlet exposed_array: \u0026mut [u8; 3] = \u0026mut [1, 2, 3];\nlet mut secure_array = SecureArray::from_slice_mut(exposed_array).unwrap();\n\n\nsecure_array.unlock_mut(|unlocked_slice| {\n    assert_eq!(unlocked_slice, \u0026[1, 2, 3]);\n});\n```\n\n\n## See also the [examples](/examples/).\n\n\n## Feature Flags\n\n- `std` (default): Enables all OS-level security features.\n- `no_std`: For `no_std` environments. Only provides the Zeroize on Drop.\n- `serde`: Enables serialization/deserialization.\n\n\n## Credits\n- [zeroize](https://github.com/RustCrypto/utils/tree/master/zeroize)\n- [memsec](https://github.com/quininer/memsec)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreekfetacheese%2Fsecure-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreekfetacheese%2Fsecure-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreekfetacheese%2Fsecure-types/lists"}