Expand description
§use-api-key
API key primitives for RustUse.
Models key identifiers, prefixes, safe redaction, key metadata, and key status labels without generating cryptographic secrets.
§Example
use use_api_key::{ApiKeyStatus, ApiKeyId};
let value = ApiKeyId::new("sk_live_example").expect("valid API primitive");
assert_eq!(value.as_str(), "sk_live_example");
assert_eq!(ApiKeyStatus::Active.to_string(), "active");§Scope
- Small validated types for API metadata.
- Stable display labels and conservative parsing helpers.
- Dependency-light primitives that can be reused by other RustUse crates.
§Non-goals
- No key generation.
- No cryptographic storage.
- No authentication checks.
§License
Licensed under either of the following, at your option:
- Apache License, Version 2.0
- MIT license
Structs§
- ApiKey
- An API key value that redacts its debug representation.
- ApiKey
Id - ApiKey
Label - ApiKey
Metadata - API key metadata.
- ApiKey
Prefix - Primitive
Metadata - Lightweight metadata tying this crate’s primary text and label together.
Enums§
- ApiKey
Status - API key status labels.
- ApiPrimitive
Error - Error returned when API primitive text or labels are invalid.
Functions§
- redact_
api_ key - Redacts API key text while preserving short prefix context.