secure-types 0.5.0

Secure data types that protect sensitive data in memory via locking and zeroization.
Documentation
[package]
name = "secure-types"
version = "0.5.0"
authors = ["Michalis Molfetas"]
edition = "2024"
description = "Secure data types that protect sensitive data in memory via locking and zeroization."
repository = "https://github.com/greekfetacheese/secure-types"
readme = "readme.md"
keywords = ["security", "secure", "memory", "zeroize", "no_std"]
categories = ["memory-management", "no-std", "security"]
license = "MIT"

[dependencies.memsec]
version = "0.7.0"
features = ["alloc_ext"]
optional = true

[target.'cfg(unix)'.dependencies]
libc = { version = "0.2" }

[dependencies.zeroize]
version = "1.9.0"

[dependencies.serde]
version = "1"
features = ["derive"]
optional = true


[dev-dependencies.serde_json]
version = "1"

[dev-dependencies.serde]
version = "1"
features = ["derive"]

[features]
default = ["use_os"]
use_os = ["memsec"]
serde = ["dep:serde"]

# `codec`: a binary vault format implemented as `serde::Serializer` /
# `serde::Deserializer`, so a value encodes straight into locked `SecureBytes`
# and decodes straight out of it. Implies `serde` and adds no dependency.
codec = ["serde"]

# no_std + alloc mode: zeroization only, no OS memory locking.
# When `use_os` is absent, the crate automatically builds in no_std mode.
#
# `no_os` itself is a no-op kept for backwards compatibility: enabling one feature
# cannot disable a default feature. Build with `--no-default-features` instead.
no_os = []

# Only for testing crash behavior
expose-ptr = []

# `access_violation` dereferences the raw pointer of a locked array to
# demonstrate the SIGSEGV, so it needs the `expose-ptr` testing feature.
[[example]]
name = "access_violation"
required-features = ["expose-ptr"]

# These use constructors that only exist with OS support: `SecureString: From<String>`
# and `SecureVec::from_vec` are `use_os`-only.
[[example]]
name = "secure_string"
required-features = ["use_os"]

[[example]]
name = "secure_vec"
required-features = ["use_os"]