1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// -*- coding: utf-8 -*-
// _ __
// | |/ /___ ___ _ __ ___ _ _ (R)
// | ' </ -_) -_) '_ \/ -_) '_|
// |_|\_\___\___| .__/\___|_|
// |_|
//
// Keeper Secrets Manager
// Copyright 2024 Keeper Security Inc.
// Contact: sm@keepersecurity.com
//
//! # Keeper Secrets Manager Rust SDK
//!
//! Type-safe, zero-knowledge client library for accessing secrets stored in Keeper's vault.
//!
//! ## Features
//!
//! - **Type-Safe API** - Leverages Rust's type system for compile-time safety
//! - **Never Panics** - All operations return `Result<T, KSMRError>` with comprehensive error handling
//! - **Multiple Storage Options** - File-based, in-memory, and caching support
//! - **Zero-Knowledge Architecture** - All encryption/decryption happens client-side
//! - **Keeper Notation** - URI-based field access (`keeper://UID/field/password`)
//! - **Password Rotation** - Transaction-based rotation with commit/rollback
//! - **GraphSync Support** - Linked record retrieval for managing relationships
//! - **Disaster Recovery Caching** - Automatic fallback to cached data on network failures
//!
//! ## Quick Start
//!
//! ```no_run
//! use keeper_secrets_manager_core::{SecretsManager, ClientOptions, KSMRError, KvStoreType, FileKeyValueStorage};
//!
//! fn main() -> Result<(), KSMRError> {
//! // Initialize with one-time token
//! let storage = FileKeyValueStorage::new(Some("config.json".to_string()))?;
//! let config = KvStoreType::File(storage);
//! let token = "US:YOUR_ONE_TIME_TOKEN".to_string();
//! let options = ClientOptions::new_client_options_with_token(token, config);
//! let mut secrets_manager = SecretsManager::new(options)?;
//!
//! // Retrieve secrets
//! let secrets = secrets_manager.get_secrets(Vec::new())?;
//! for secret in secrets {
//! println!("Title: {}", secret.title);
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! Or use the builder:
//!
//! ```no_run
//! use keeper_secrets_manager_core::{SecretsManager, ClientOptionsBuilder, KSMRError, KvStoreType, InMemoryKeyValueStorage};
//!
//! fn main() -> Result<(), KSMRError> {
//! let config_b64 = std::env::var("KSM_CONFIG").expect("KSM_CONFIG required");
//! let storage = InMemoryKeyValueStorage::new(Some(config_b64))?;
//! let options = ClientOptionsBuilder::new(KvStoreType::InMemory(storage))
//! .token("US:YOUR_ONE_TIME_TOKEN")
//! .build();
//! let mut sm = SecretsManager::new(options)?;
//! let secrets = sm.get_secrets(Vec::new())?;
//! println!("Found {} secrets", secrets.len());
//! Ok(())
//! }
//! ```
//!
//! ## Modules
//!
//! - [`core`] - Main `SecretsManager` API and client configuration
//! - [`storage`] - Storage backends (File, InMemory)
//! - [`cache`] - Performance caching layer
//! - [`caching`] - Disaster recovery caching with network fallback
//! - [`crypto`] - Cryptographic operations (AES-GCM, ECDH, ECDSA)
//! - [`dto`] - Data transfer objects (Record, Folder, File, Payload types)
//! - [`utils`] - Utilities (password generation, TOTP, Base64 encoding)
//! - [`custom_error`] - Error types (`KSMRError` enum)
//! - [`enums`] - Type enums (field types, record types, storage types)
//!
//! ## Cargo Features
//!
//! | Feature | Default | Description |
//! |---------|---------|-------------|
//! | `blocking` | yes | Enables `reqwest/blocking` HTTP client |
//! | `totp` | yes | TOTP code generation (`get_totp_code`) |
//! | `password-gen` | yes | Password generation (`generate_password`) |
//! | `tracing-init` | yes | `env_logger` initializer in the binary |
// --- Flat re-exports for ergonomic top-level imports ---
pub use KSMCache;
pub use ;
pub use KSMRError;
pub use ;
pub use ;
pub use ;
/// Convenient glob import for the most common types.
///
/// ```no_run
/// use keeper_secrets_manager_core::prelude::*;
/// ```