diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0ca9811..77c6766 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,10 @@
## 0.1.3
-## Fixed
-- a bug in `mCaptcha/pow_sha256` was causing errors in PoW computation
+
+## Added
+- `HashCache` was extended to store captcha responses
+- `HashCache` was extended to cache site keys when caching `PoW` configurations
+ as a result:
+- `Retrieve` `RetrievePoW` now returns `CachedPoWConfig`
## Changed
- `Cache` became `CachePoW` (`HashCache` extension)
@@ -8,9 +12,11 @@
- `DeleteString` became `DeletePoW` (`HashCache` extension)
- `Save` trait now requires three new message impls (`HashCache` extension_
-## Added
-- `HashCache` was extended to store captcha responses
+## Removed
+- `CachePoW` constructor was removed in favour of `CachwPoWBuilder`
+## Fixed
+- a bug in `mCaptcha/pow_sha256` was causing errors in PoW computation
## 0.1.2
## Changed
diff --git a/examples/simple.rs b/examples/simple.rs
index 07553a2..9947f4e 100644
--- a/examples/simple.rs
+++ b/examples/simple.rs
@@ -104,6 +104,7 @@ async fn main() -> std::io::Result<()> {
string: work_req.string,
result: work.result,
nonce: work.nonce,
+ key: mcaptcha_name.into(),
};
// Server evaluates client's work. Returns true if everything
diff --git a/src/cache/hashcache.rs b/src/cache/hashcache.rs
index 43496a6..df11898 100644
--- a/src/cache/hashcache.rs
+++ b/src/cache/hashcache.rs
@@ -27,20 +27,25 @@ use crate::errors::*;
#[derive(Clone, Default)]
/// cache datastructure implementing [Save]
pub struct HashCache {
- difficulty_map: HashMap,
+ difficulty_map: HashMap,
result_map: HashMap,
}
impl HashCache {
// save [PoWConfig] to cache
fn save_pow_config(&mut self, config: CachePoW) -> CaptchaResult<()> {
- self.difficulty_map
- .insert(config.string, config.difficulty_factor);
+ let challenge = config.string;
+ let config: CachedPoWConfig = CachedPoWConfig {
+ key: config.key,
+ difficulty_factor: config.difficulty_factor,
+ };
+
+ self.difficulty_map.insert(challenge, config);
Ok(())
}
// retrive [PoWConfig] from cache. Deletes config post retrival
- fn retrive_pow_config(&mut self, string: String) -> CaptchaResult